Skip to content

Commit 71eeb95

Browse files
authored
feat: allow changing the Copilot model used (#373)
fixes #365
1 parent acb0545 commit 71eeb95

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ require('copilot').setup({
8787
["."] = false,
8888
},
8989
copilot_node_command = 'node', -- Node.js version must be > 18.x
90+
copilot_model = "", -- Current LSP default is gpt-35-turbo, supports gpt-4o-copilot
9091
server_opts_overrides = {},
9192
})
9293
```

lua/copilot/client.lua

+3
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ local function prepare_client_config(overrides)
234234
end
235235
end,
236236
handlers = handlers,
237+
init_options = {
238+
copilotIntegrationId = "vscode-chat",
239+
},
237240
}, overrides)
238241
end
239242

lua/copilot/config.lua

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ local default_config = {
4141
auth_provider_url = nil,
4242
copilot_node_command = "node",
4343
server_opts_overrides = {},
44+
---@type string|nil
45+
copilot_model = nil,
4446
}
4547

4648
local mod = {

lua/copilot/util.lua

+7
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,20 @@ function M.get_editor_configuration()
203203
filetypes = vim.tbl_deep_extend("keep", filetypes, internal_filetypes)
204204
end
205205

206+
local copilot_model = conf.copilot_model ~= "" and conf.copilot_model or ""
207+
206208
---@type string[]
207209
local disabled_filetypes = vim.tbl_filter(function(ft)
208210
return filetypes[ft] == false
209211
end, vim.tbl_keys(filetypes))
210212
table.sort(disabled_filetypes)
211213

212214
return {
215+
github = {
216+
copilot = {
217+
selectedCompletionModel = copilot_model,
218+
},
219+
},
213220
enableAutoCompletions = not not (conf.panel.enabled or conf.suggestion.enabled),
214221
disabledLanguages = vim.tbl_map(function(ft)
215222
return { languageId = ft }

0 commit comments

Comments
 (0)