Skip to content

Commit 061fd4f

Browse files
committed
feat: use allow changing the copilot model used
fixes zbirenbaum#365
1 parent ec9922e commit 061fd4f

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ local function prepare_client_config(overrides)
190190
cmd = {
191191
node,
192192
agent_path,
193+
"--stdio",
193194
},
194195
root_dir = vim.loop.cwd(),
195196
name = "copilot",
@@ -233,6 +234,9 @@ local function prepare_client_config(overrides)
233234
end
234235
end,
235236
handlers = handlers,
237+
init_options = {
238+
copilotIntegrationId = "vscode-chat",
239+
},
236240
}, overrides)
237241
end
238242

lua/copilot/util.lua

Lines changed: 7 additions & 0 deletions
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)