Skip to content

Commit 25a4160

Browse files
committed
fix(client): set get_language_id for client
1 parent 3a35313 commit 25a4160

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lua/copilot/client.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ M.merge_server_opts = function(params)
144144
},
145145
root_dir = vim.loop.cwd(),
146146
name = "copilot",
147+
get_language_id = function(_, filetype)
148+
return util.language_for_file_type(filetype)
149+
end,
147150
on_init = function(client)
148151
vim.schedule(function()
149152
---@type copilot_set_editor_info_params

lua/copilot/util.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ local language_normalization_map = {
155155
text = "plaintext",
156156
}
157157

158-
local function language_for_file_type(filetype)
158+
function M.language_for_file_type(filetype)
159159
-- trim filetypes after dot, e.g. `yaml.gotexttmpl` -> `yaml`
160160
local ft = string.gsub(filetype, "%..*", "")
161161
if not ft or ft == "" then
@@ -177,7 +177,6 @@ function M.get_doc()
177177
local params = vim.lsp.util.make_position_params(0, "utf-16") -- copilot server uses utf-16
178178
local doc = {
179179
uri = params.textDocument.uri,
180-
languageId = language_for_file_type(vim.bo.filetype),
181180
version = vim.api.nvim_buf_get_var(0, "changedtick"),
182181
relativePath = relative_path(absolute),
183182
insertSpaces = vim.o.expandtab,
@@ -197,7 +196,6 @@ function M.get_doc_params(overrides)
197196
}, overrides)
198197
params.textDocument = {
199198
uri = params.doc.uri,
200-
languageId = params.doc.languageId,
201199
version = params.doc.version,
202200
relativePath = params.doc.relativePath,
203201
}

0 commit comments

Comments
 (0)