diff --git a/README.md b/README.md index c2f2ff6f..a5cc1e4a 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ require('copilot').setup({ ["."] = false, }, copilot_node_command = 'node', -- Node.js version must be > 18.x + copilot_model = "", -- Current LSP default is gpt-35-turbo, supports gpt-4o-copilot server_opts_overrides = {}, }) ``` diff --git a/lua/copilot/client.lua b/lua/copilot/client.lua index c4f8bfbd..b1c040e7 100644 --- a/lua/copilot/client.lua +++ b/lua/copilot/client.lua @@ -234,6 +234,9 @@ local function prepare_client_config(overrides) end end, handlers = handlers, + init_options = { + copilotIntegrationId = "vscode-chat", + }, }, overrides) end diff --git a/lua/copilot/config.lua b/lua/copilot/config.lua index b3dff145..d4bff79e 100644 --- a/lua/copilot/config.lua +++ b/lua/copilot/config.lua @@ -41,6 +41,8 @@ local default_config = { auth_provider_url = nil, copilot_node_command = "node", server_opts_overrides = {}, + ---@type string|nil + copilot_model = nil, } local mod = { diff --git a/lua/copilot/util.lua b/lua/copilot/util.lua index 733b8d28..36f62817 100644 --- a/lua/copilot/util.lua +++ b/lua/copilot/util.lua @@ -203,6 +203,8 @@ function M.get_editor_configuration() filetypes = vim.tbl_deep_extend("keep", filetypes, internal_filetypes) end + local copilot_model = conf.copilot_model ~= "" and conf.copilot_model or "" + ---@type string[] local disabled_filetypes = vim.tbl_filter(function(ft) return filetypes[ft] == false @@ -210,6 +212,11 @@ function M.get_editor_configuration() table.sort(disabled_filetypes) return { + github = { + copilot = { + selectedCompletionModel = copilot_model, + }, + }, enableAutoCompletions = not not (conf.panel.enabled or conf.suggestion.enabled), disabledLanguages = vim.tbl_map(function(ft) return { languageId = ft }