@@ -28,7 +28,10 @@ copilot.lsp_start_client = function(cmd, handler_names, opts, settings)
2828 if # workspace_folders == 0 then
2929 workspace_folders = nil
3030 end
31- id = (vim .lsp .start or vim .lsp .start_client )({
31+ -- start_client() is deprecated, but the replacement start() breaks our
32+ -- restart workflow by returning the old client that's shutting down.
33+ -- https://github.com/neovim/neovim/issues/33616
34+ id = vim .lsp .start_client ({
3235 cmd = cmd ,
3336 cmd_cwd = vim .call (' copilot#job#Cwd' ),
3437 name = ' GitHub Copilot' ,
@@ -60,9 +63,14 @@ copilot.lsp_request = function(client_id, method, params, bufnr)
6063 bufnr = nil
6164 end
6265 local _ , id
63- _ , id = client . request ( method , params , function (err , result )
66+ local handler = function (err , result )
6467 vim .call (' copilot#client#LspResponse' , client_id , { id = id , error = err , result = result })
65- end , bufnr )
68+ end
69+ if vim .fn .has (' nvim-0.11' ) == 1 then
70+ _ , id = client :request (method , params , handler , bufnr )
71+ else
72+ _ , id = client .request (method , params , handler , bufnr )
73+ end
6674 return id
6775end
6876
0 commit comments