File tree 2 files changed +18
-2
lines changed
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,10 @@ function cmp.snippet_backward()
133
133
return true
134
134
end
135
135
136
+ --- Tells the sources to reload a specific provider or all providers (when nil)
137
+ --- @param provider ? string
138
+ function cmp .reload (provider ) require (' blink.cmp.sources.lib' ).reload (provider ) end
139
+
136
140
--- @param override ? lsp.ClientCapabilities
137
141
--- @param include_nvim_defaults ? boolean
138
142
function cmp .get_lsp_capabilities (override , include_nvim_defaults )
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ local config = require('blink.cmp.config')
23
23
--- @field get_signature_help fun ( context : blink.cmp.SignatureHelpContext , callback : fun ( signature_help : lsp.SignatureHelp | nil ))
24
24
--- @field cancel_signature_help fun ()
25
25
---
26
- --- @field reload fun ()
26
+ --- @field reload fun ( source ?: string )
27
27
--- @field get_lsp_capabilities fun ( override ?: lsp.ClientCapabilities , include_nvim_defaults ?: boolean ): lsp.ClientCapabilities
28
28
29
29
--- @class blink.cmp.SourceCompletionsEvent
220
220
--- Misc ---
221
221
222
222
--- For external integrations to force reloading the source
223
- function sources .reload ()
223
+ function sources .reload (provider )
224
+ -- Reload specific provider
225
+ if provider ~= nil then
226
+ assert (type (provider ) == ' string' , ' Expected string for provider' )
227
+ assert (
228
+ sources .providers [provider ] ~= nil or config .sources .providers [provider ] ~= nil ,
229
+ ' Source ' .. provider .. ' does not exist'
230
+ )
231
+ if sources .providers [provider ] ~= nil then sources .providers [provider ]:reload () end
232
+ return
233
+ end
234
+
235
+ -- Reload all providers
224
236
for _ , source in pairs (sources .providers ) do
225
237
source :reload ()
226
238
end
You can’t perform that action at this time.
0 commit comments