File tree 4 files changed +8
-7
lines changed
4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ function source.new(config)
9
9
local self = setmetatable ({}, { __index = source })
10
10
self .name = config .name
11
11
--- @type blink.cmp.Source
12
- self .module = require (config [1 ]).new (config . opts or {} )
12
+ self .module = require (config [1 ]).new (config )
13
13
self .config = config
14
14
self .last_response = nil
15
15
Original file line number Diff line number Diff line change 9
9
--- @field items blink.cmp.CompletionItem[]
10
10
---
11
11
--- @class blink.cmp.Source
12
- --- @field new fun ( opts : table ): blink.cmp.Source
12
+ --- @field new fun ( config : blink.cmp.SourceProviderConfig ): blink.cmp.Source
13
13
--- @field get_trigger_characters (fun ( self : blink.cmp.Source ): string[] ) | nil
14
14
--- @field get_completions fun ( self : blink.cmp.Source , context : blink.cmp.Context , callback : fun ( response : blink.cmp.CompletionResponse )): ( fun (): nil ) | nil
15
15
--- @field filter_completions (fun ( self : blink.cmp.Source , response : blink.cmp.CompletionResponse ): blink.cmp.CompletionItem[] ) | nil
Original file line number Diff line number Diff line change @@ -6,10 +6,10 @@ local NAME_REGEX = '\\%([^/\\\\:\\*?<>\'"`\\|]\\)'
6
6
local PATH_REGEX =
7
7
assert (vim .regex (([[ \%(\%(/PAT*[^/\\\\:\\*?<>\'"`\\| .~]\)\|\%(/\.\.\)\)*/\zePAT*$]] ):gsub (' PAT' , NAME_REGEX )))
8
8
9
- function path .new (opts )
9
+ function path .new (config )
10
10
local self = setmetatable ({}, { __index = path })
11
11
12
- opts = vim .tbl_deep_extend (' keep' , opts , {
12
+ local opts = vim .tbl_deep_extend (' keep' , config . opts or {} , {
13
13
trailing_slash = false ,
14
14
label_trailing_slash = true ,
15
15
get_cwd = function (context ) return vim .fn .expand ((' #%d:p:h' ):format (context .bufnr )) end ,
@@ -22,7 +22,7 @@ function path.new(opts)
22
22
show_hidden_files_by_default = { opts .show_hidden_files_by_default , ' boolean' },
23
23
})
24
24
25
- self .opts = opts or {}
25
+ self .opts = opts
26
26
return self
27
27
end
28
28
Original file line number Diff line number Diff line change 7
7
8
8
local snippets = {}
9
9
10
- --- @param opts blink.cmp.SnippetsOpts
11
- function snippets .new (opts )
10
+ function snippets .new (config )
12
11
local self = setmetatable ({}, { __index = snippets })
13
12
--- @type table<string , blink.cmp.CompletionItem[]>
14
13
self .cache = {}
14
+ --- @type blink.cmp.SnippetsOpts
15
+ local opts = config .opts or {}
15
16
self .registry = require (' blink.cmp.sources.snippets.registry' ).new (opts )
16
17
return self
17
18
end
You can’t perform that action at this time.
0 commit comments