Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit a2935ee

Browse files
authored
Merge pull request #174 from aca/master
Add all matching strategy
2 parents 43cb0b1 + cb68f90 commit a2935ee

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ let g:completion_sorting = "length"
196196
### Matching Strategy
197197

198198
- There are three different kind of matching technique implement in
199-
completion-nvim: `substring`, `fuzzy` or `exact`.
199+
completion-nvim: `substring`, `fuzzy`, `exact` or `all`.
200200

201201
- You can specify a list of matching strategy, completion-nvim will loop through the list and
202202
assign priority from high to low. For example
203203

204204
```vim
205-
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
205+
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy', 'all']
206206
```
207207

208208
*NOTE* Fuzzy match highly dependent on what language server you're using. It might not

doc/completion-nvim.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,11 @@ g:completion_auto_change_source *g:completion_auto_change_source*
344344
g:completion_matching_strategy_list *g:completion_matching_strategy_list*
345345

346346
There are three different kind of matching technique implement in
347-
completion-nvim: 'substring', 'fuzzy' or 'exact'. You can specify a list
347+
completion-nvim: 'substring', 'fuzzy', 'exact' or 'all'. You can specify a list
348348
of matching strategy, completion-nvim will loop through the list and
349349
assign priority from high to low. For example
350350
>
351-
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
351+
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy', 'all']
352352
<
353353
default value: ['exact']
354354

lua/completion/matching.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ local function exact_match(prefix, word)
4141
end
4242
end
4343

44+
local function all_match()
45+
return true
46+
end
47+
4448
local matching_strategy = {
4549
fuzzy = fuzzy_match,
4650
substring = substring_match,
47-
exact = exact_match
51+
exact = exact_match,
52+
all = all_match,
4853
}
4954

5055
M.matching = function(complete_items, prefix, item)

0 commit comments

Comments
 (0)