File tree 2 files changed +7
-2
lines changed
lua/blink/cmp/sources/snippets
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -384,6 +384,9 @@ MiniDeps.add({
384
384
global_snippets = { ' all' },
385
385
extended_filetypes = {},
386
386
ignored_filetypes = {},
387
+ get_filetype = function (context )
388
+ return vim .bo .filetype
389
+ end
387
390
}
388
391
389
392
--- Example usage for disabling the snippet provider after pressing trigger characters (i.e. ".")
Original file line number Diff line number Diff line change 4
4
--- @field global_snippets string[]
5
5
--- @field extended_filetypes table<string , string[]>
6
6
--- @field ignored_filetypes string[]
7
+ --- @field get_filetype fun ( context : blink.cmp.Context ): string
7
8
8
9
local snippets = {}
9
10
@@ -13,11 +14,12 @@ function snippets.new(opts)
13
14
self .cache = {}
14
15
--- @type blink.cmp.SnippetsOpts
15
16
self .registry = require (' blink.cmp.sources.snippets.registry' ).new (opts or {})
17
+ self .get_filetype = opts .get_filetype or function () return vim .bo .filetype end
16
18
return self
17
19
end
18
20
19
- function snippets :get_completions (_ , callback )
20
- local filetype = vim . bo . filetype
21
+ function snippets :get_completions (context , callback )
22
+ local filetype = self . get_filetype ( context )
21
23
if vim .tbl_contains (self .registry .config .ignored_filetypes , filetype ) then return callback () end
22
24
23
25
if not self .cache [filetype ] then
You can’t perform that action at this time.
0 commit comments