Skip to content

Commit 1f893df

Browse files
authored
fix: add required editor info for LSP initialization (#387)
Fix LSP warning by providing required editorInfo and editorPluginInfo fields in initializationOptions for the Copilot LSP client.
1 parent dbcee96 commit 1f893df

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lua/copilot/client.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function M.use_client(callback)
169169
return
170170
end
171171

172-
local timer, err, _ = vim.loop.new_timer()
172+
local timer, err, _ = vim.uv.new_timer()
173173

174174
if not timer then
175175
logger.error(string.format("error creating timer: %s", err))
@@ -249,6 +249,8 @@ local function prepare_client_config(overrides)
249249
end
250250
end
251251

252+
local editor_info = util.get_editor_info()
253+
252254
-- LSP config, not to be confused with config.lua
253255
return vim.tbl_deep_extend("force", {
254256
cmd = {
@@ -303,6 +305,11 @@ local function prepare_client_config(overrides)
303305
handlers = handlers,
304306
init_options = {
305307
copilotIntegrationId = "vscode-chat",
308+
-- Fix LSP warning: editorInfo and editorPluginInfo will soon be required in initializationOptions
309+
-- We are sending these twice for the time being as it will become required here and we get a warning if not set.
310+
-- However if not passed in setEditorInfo, that one returns an error.
311+
editorInfo = editor_info.editorInfo,
312+
editorPluginInfo = editor_info.editorPluginInfo,
306313
},
307314
workspace_folders = workspace_folders,
308315
trace = config.get("trace") or "off",

0 commit comments

Comments
 (0)