Skip to content

Commit

Permalink
auth provider support (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkuna23 authored Sep 11, 2024
1 parent f9e2c14 commit f165763
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/copilot/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ end

---@alias copilot_editor_info { name: string, version: string }
---@alias copilot_editor_plugin_info { name: string, version: string }
---@alias copilot_auth_provider { url: string }
---@alias copilot_network_proxy { host: string, port: integer, username?: string, password?: string, rejectUnauthorized?: boolean }
---@alias copilot_set_editor_info_params { editorInfo: copilot_editor_info, editorPluginInfo: copilot_editor_plugin_info, editorConfiguration: copilot_editor_configuration, networkProxy?: copilot_network_proxy }
---@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 }

---@param params copilot_set_editor_info_params
---@return any|nil err
Expand Down
4 changes: 4 additions & 0 deletions lua/copilot/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ local function prepare_client_config(overrides)
local set_editor_info_params = util.get_editor_info()
set_editor_info_params.editorConfiguration = util.get_editor_configuration()
set_editor_info_params.networkProxy = util.get_network_proxy()
local provider_url = config.get("auth_provider_url")
set_editor_info_params.authProvider = provider_url and {
url = provider_url,
} or nil
api.set_editor_info(client, set_editor_info_params, function(err)
if err then
vim.notify(string.format("[copilot] setEditorInfo failure: %s", err), vim.log.levels.ERROR)
Expand Down
2 changes: 2 additions & 0 deletions lua/copilot/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ local default_config = {
ft_disable = nil,
---@type table<string, boolean>
filetypes = {},
---@type string|nil
auth_provider_url = nil,
copilot_node_command = "node",
server_opts_overrides = {},
}
Expand Down

0 comments on commit f165763

Please sign in to comment.