Skip to content

Commit

Permalink
Add preview option for sourceOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jun 21, 2024
1 parent df96090 commit 9112a4e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions denops/ddc/base/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export function defaultSourceOptions(): SourceOptions {
maxKeywordLength: 0,
minAutoCompleteLength: 2,
minKeywordLength: 0,
preview: true,
replaceSourceInputPattern: "",
sorters: [],
timeout: 2000,
Expand Down
2 changes: 1 addition & 1 deletion denops/ddc/ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export async function getPreviewer(
options,
sourceName,
);
if (!source || !source.getPreviewer) {
if (!source || !source.getPreviewer || !sourceOptions.preview) {
return { kind: "empty" };
}

Expand Down
1 change: 1 addition & 0 deletions denops/ddc/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export type SourceOptions = {
maxKeywordLength: number;
minAutoCompleteLength: number;
minKeywordLength: number;
preview: boolean;
sorters: UserFilter[];
timeout: number;
replaceSourceInputPattern: string;
Expand Down
6 changes: 6 additions & 0 deletions doc/ddc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,12 @@ minKeywordLength (number)

Default: 0

*ddc-source-option-preview*
preview (boolean)
If it is False, ddc disables preview feature.

Default: v:true

*ddc-source-option-replaceSourceInputPattern*
replaceSourceInputPattern
It defines the regexp pattern to remove a match in the source
Expand Down

0 comments on commit 9112a4e

Please sign in to comment.