Skip to content

Commit

Permalink
Add maxManualCompleteLength and minManualCompleteLength
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jul 5, 2024
1 parent c70af43 commit 0959ed7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
2 changes: 2 additions & 0 deletions denops/ddc/base/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,11 @@ export function defaultSourceOptions(): SourceOptions {
matcherKey: "",
matchers: [],
maxAutoCompleteLength: 80,
maxManualCompleteLength: 80,
maxItems: 500,
maxKeywordLength: 0,
minAutoCompleteLength: 2,
minManualCompleteLength: 1,
minKeywordLength: 0,
preview: true,
replaceSourceInputPattern: "",
Expand Down
8 changes: 5 additions & 3 deletions denops/ddc/ddc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ export class Ddc {
? this.#prevResults[s.name]
: null;

const invalidCompleteLength =
completeStr.length < o.minAutoCompleteLength ||
completeStr.length > o.maxAutoCompleteLength;
const invalidCompleteLength = context.event === "Manual"
? (completeStr.length < o.minManualCompleteLength ||
completeStr.length > o.maxManualCompleteLength)
: (completeStr.length < o.minAutoCompleteLength ||
completeStr.length > o.maxAutoCompleteLength);

const triggerForIncomplete = (checkPrevResult?.isIncomplete ?? false) &&
context.lineNr === checkPrevResult?.lineNr &&
Expand Down
2 changes: 2 additions & 0 deletions denops/ddc/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ export type SourceOptions = {
matcherKey: string;
matchers: UserFilter[];
maxAutoCompleteLength: number;
maxManualCompleteLength: number;
maxItems: number;
maxKeywordLength: number;
minAutoCompleteLength: number;
minManualCompleteLength: number;
minKeywordLength: number;
preview: boolean;
sorters: UserFilter[];
Expand Down
38 changes: 22 additions & 16 deletions doc/ddc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -754,20 +754,6 @@ mark (string)

Default: ""

*ddc-source-option-maxAutoCompleteLength*
maxAutoCompleteLength (number)
Ignored length of keyword for auto completion.
It is useful to edit BASE64 files.

Default: 80

*ddc-source-option-maxItems*
maxItems (number)
If there are more items than this value, ddc will ignore the
filtering.

Default: 500

*ddc-source-option-matcherKey*
matcherKey (string)
Matcher compare key instead of "word".
Expand All @@ -792,10 +778,11 @@ matchers (string[])

*ddc-source-option-maxAutoCompleteLength*
maxAutoCompleteLength (number)
The mamimum length of keyword required for auto completion.
Ignored length of keyword for auto completion.
It is useful to edit BASE64 files.
NOTE: It does not work for manual completion.

Default: 2
Default: 80

*ddc-source-option-maxKeywordLength*
maxKeywordLength (number)
Expand All @@ -804,13 +791,32 @@ maxKeywordLength (number)

Default: 0

*ddc-source-option-maxItems*
maxItems (number)
If there are more items than this value, ddc will ignore the
filtering.

Default: 500

*ddc-source-option-maxManualCompleteLength*
maxManualCompleteLength (number)
The mamimum length of keyword required for manual completion.

Default: 80

*ddc-source-option-minAutoCompleteLength*
minAutoCompleteLength (number)
The minimum length of keyword required for auto completion.
NOTE: It does not work for manual completion.

Default: 2

*ddc-source-option-minManualCompleteLength*
minManualCompleteLength (number)
The minimum length of keyword required for manual completion.

Default: 1

*ddc-source-option-minKeywordLength*
minKeywordLength (number)
The minimum word of length for items.
Expand Down

0 comments on commit 0959ed7

Please sign in to comment.