Skip to content

Commit f165763

Browse files
authored
auth provider support (zbirenbaum#313)
1 parent f9e2c14 commit f165763

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

lua/copilot/api.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ end
3030

3131
---@alias copilot_editor_info { name: string, version: string }
3232
---@alias copilot_editor_plugin_info { name: string, version: string }
33+
---@alias copilot_auth_provider { url: string }
3334
---@alias copilot_network_proxy { host: string, port: integer, username?: string, password?: string, rejectUnauthorized?: boolean }
34-
---@alias copilot_set_editor_info_params { editorInfo: copilot_editor_info, editorPluginInfo: copilot_editor_plugin_info, editorConfiguration: copilot_editor_configuration, networkProxy?: copilot_network_proxy }
35+
---@alias copilot_set_editor_info_params { editorInfo: copilot_editor_info, editorPluginInfo: copilot_editor_plugin_info, editorConfiguration: copilot_editor_configuration, networkProxy?: copilot_network_proxy, authProvider?: copilot_auth_provider }
3536

3637
---@param params copilot_set_editor_info_params
3738
---@return any|nil err

lua/copilot/client.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ local function prepare_client_config(overrides)
207207
local set_editor_info_params = util.get_editor_info()
208208
set_editor_info_params.editorConfiguration = util.get_editor_configuration()
209209
set_editor_info_params.networkProxy = util.get_network_proxy()
210+
local provider_url = config.get("auth_provider_url")
211+
set_editor_info_params.authProvider = provider_url and {
212+
url = provider_url,
213+
} or nil
210214
api.set_editor_info(client, set_editor_info_params, function(err)
211215
if err then
212216
vim.notify(string.format("[copilot] setEditorInfo failure: %s", err), vim.log.levels.ERROR)

lua/copilot/config.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ local default_config = {
3737
ft_disable = nil,
3838
---@type table<string, boolean>
3939
filetypes = {},
40+
---@type string|nil
41+
auth_provider_url = nil,
4042
copilot_node_command = "node",
4143
server_opts_overrides = {},
4244
}

0 commit comments

Comments
 (0)