Skip to content

Commit

Permalink
Remove "ddu#get_previewer()".
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed May 28, 2023
1 parent 8a8047d commit 0a15fe0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 36 deletions.
3 changes: 0 additions & 3 deletions autoload/ddu.vim
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ endfunction
function! ddu#get_item_actions(name, items) abort
return ddu#_request('getItemActions', [a:name, a:items])
endfunction
function! ddu#get_previewer(name, item, params, context) abort
return ddu#_request('getPreviewer', [a:name, a:item, a:params, a:context])
endfunction
function! ddu#get_context(name) abort
return ddu#_request('getContext', [a:name])
endfunction
Expand Down
21 changes: 0 additions & 21 deletions denops/ddu/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from "./deps.ts";
import {
ActionHistory,
BaseActionParams,
BaseFilterParams,
Clipboard,
Context,
Expand All @@ -20,8 +19,6 @@ import {
DduOptions,
ExpandItem,
FilterOptions,
PreviewContext,
Previewer,
UserOptions,
} from "./types.ts";
import { Ddu } from "./ddu.ts";
Expand Down Expand Up @@ -355,24 +352,6 @@ export async function main(denops: Denops) {
}
return actions;
},
async getPreviewer(
arg1: unknown,
arg2: unknown,
arg3: unknown,
arg4: unknown,
): Promise<Previewer | undefined> {
const name = ensureString(arg1);
const item = ensureObject(arg2) as DduItem;
const actionParams = arg3 as BaseActionParams;
const previewContext = ensureObject(arg4) as PreviewContext;
const ddu = getDdu(name);
return await ddu.getPreviewer(
denops,
item,
actionParams,
previewContext,
);
},
async getFilter(arg1: unknown, arg2: unknown): Promise<
[
string,
Expand Down
9 changes: 9 additions & 0 deletions denops/ddu/base/ui.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import {
ActionFlags,
BaseActionParams,
Context,
DduItem,
DduOptions,
PreviewContext,
Previewer,
SourceInfo,
UiOptions,
} from "../types.ts";
Expand Down Expand Up @@ -111,6 +114,12 @@ export type ActionArguments<Params extends BaseUiParams> = {
uiOptions: UiOptions;
uiParams: Params;
actionParams: unknown;
getPreviewer: (
denops: Denops,
item: DduItem,
actionParams: BaseActionParams,
previewContext: PreviewContext,
) => Promise<Previewer | undefined>;
};

export abstract class BaseUi<
Expand Down
1 change: 1 addition & 0 deletions denops/ddu/ddu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ export class Ddu {
uiOptions,
uiParams,
actionParams,
getPreviewer: this.getPreviewer.bind(this),
});
}

Expand Down
6 changes: 6 additions & 0 deletions denops/ddu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ export type ActionArguments<Params extends BaseActionParams> = {
items: DduItem[];
clipboard: Clipboard;
actionHistory: ActionHistory;
getPreviewer: (
denops: Denops,
item: DduItem,
actionParams: BaseActionParams,
previewContext: PreviewContext,
) => Promise<Previewer | undefined>;
};

export type Actions<Params extends BaseActionParams> = Record<
Expand Down
15 changes: 3 additions & 12 deletions doc/ddu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,6 @@ ddu#get_item_actions({name}, {items})
Get the {name} actions for {items}.
Note: You cannot mix multiple kinds/sources.

*ddu#get_previewer()*
ddu#get_previewer({name}, {item}, {params}, {context})
Get previewer for {item}.

{name} is specified ddu name(|ddu-option-name|).

{params} is action params.

{context} is preview context.

Note: It is for creating UI interface.

*ddu#item_action()*
ddu#item_action({name}, {action}, {items}, {params})
Do the {action} action for {items}.
Expand Down Expand Up @@ -1159,6 +1147,9 @@ A: You can use dummy |ddu#start()| for it. >
==============================================================================
COMPATIBILITY *ddu-compatibility*

2023.05.28
* Remove "ddu#get_previewer()".

2023.04.11
* Change "ddu-option-volatile" to "ddu-source-option-volatile".

Expand Down

0 comments on commit 0a15fe0

Please sign in to comment.