File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,14 @@ local client_config = require("copilot.client.config")
88local is_disabled = false
99
1010--- @class CopilotClient
11+ --- @field augroup string | nil
1112--- @field id integer | nil
1213--- @field capabilities lsp.ClientCapabilities | nil
1314--- @field config vim.lsp.ClientConfig | nil
1415--- @field startup_error string | nil
1516--- @field initialized boolean
1617local M = {
17- augroup = " copilot.client " ,
18+ augroup = nil ,
1819 id = nil ,
1920 capabilities = nil ,
2021 config = nil ,
@@ -150,7 +151,11 @@ function M.setup()
150151 is_disabled = false
151152
152153 M .id = nil
153- vim .api .nvim_create_augroup (M .augroup , { clear = true })
154+
155+ -- nvim_clear_autocmds throws an error if the group does not exist
156+ local augroup = " copilot.client"
157+ vim .api .nvim_create_augroup (augroup , { clear = true })
158+ M .augroup = augroup
154159
155160 vim .api .nvim_create_autocmd (" FileType" , {
156161 group = M .augroup ,
165170function M .teardown ()
166171 is_disabled = true
167172
168- vim .api .nvim_clear_autocmds ({ group = M .augroup })
173+ -- nvim_clear_autocmds throws an error if the group does not exist
174+ if M .augroup then
175+ vim .api .nvim_clear_autocmds ({ group = M .augroup })
176+ end
169177
170178 if M .id then
171179 vim .lsp .stop_client (M .id )
You can’t perform that action at this time.
0 commit comments