From 9112a4e614dbc7f85b782b962c59e78ea3c6ab01 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Fri, 21 Jun 2024 09:42:24 +0900 Subject: [PATCH] Add preview option for sourceOptions --- denops/ddc/base/source.ts | 1 + denops/ddc/ext.ts | 2 +- denops/ddc/types.ts | 1 + doc/ddc.txt | 6 ++++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/denops/ddc/base/source.ts b/denops/ddc/base/source.ts index 0a71a90..c1b559e 100644 --- a/denops/ddc/base/source.ts +++ b/denops/ddc/base/source.ts @@ -153,6 +153,7 @@ export function defaultSourceOptions(): SourceOptions { maxKeywordLength: 0, minAutoCompleteLength: 2, minKeywordLength: 0, + preview: true, replaceSourceInputPattern: "", sorters: [], timeout: 2000, diff --git a/denops/ddc/ext.ts b/denops/ddc/ext.ts index c3f172e..b17fd6c 100644 --- a/denops/ddc/ext.ts +++ b/denops/ddc/ext.ts @@ -211,7 +211,7 @@ export async function getPreviewer( options, sourceName, ); - if (!source || !source.getPreviewer) { + if (!source || !source.getPreviewer || !sourceOptions.preview) { return { kind: "empty" }; } diff --git a/denops/ddc/types.ts b/denops/ddc/types.ts index f10ae29..e27f5c5 100644 --- a/denops/ddc/types.ts +++ b/denops/ddc/types.ts @@ -89,6 +89,7 @@ export type SourceOptions = { maxKeywordLength: number; minAutoCompleteLength: number; minKeywordLength: number; + preview: boolean; sorters: UserFilter[]; timeout: number; replaceSourceInputPattern: string; diff --git a/doc/ddc.txt b/doc/ddc.txt index c827961..21341ce 100644 --- a/doc/ddc.txt +++ b/doc/ddc.txt @@ -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