Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This allows this plugin to work with codeium enterprise #36

Merged
merged 4 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ a different plugin manager, please refer to its documentation for installation i

Now you can use `Alt-f` in insert mode to accept codeium suggestions.

Enterprise users: you should receive portal and API URLs for Codeium from your company.
Once you get them, add them to your config. This way `:NeoCodeium auth` will authenticate you on the right portal. For example,

````lua
{
"monkoose/neocodeium",
event = "VeryLazy",
opts = {
server = {
api_url = 'https://codeium.company.net/_route/api_server',
portal_url = 'https://codeium.company.net',
},
}
}

**Note:** To obtain an API token, you’ll need to run `:NeoCodeium auth`.
On Windows WSL `wslview` `(sudo apt install wslu)` should be installed to properly open the browser.

Expand Down
5 changes: 1 addition & 4 deletions lua/neocodeium/binary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ end
---@param callback fun()
function Bin:download(callback)
local base_url = "https://github.com/Exafunction/codeium/releases/download"
if options.server.portal_url then
base_url = options.server.portal_url:gsub("/$", "")
end
---@type url
local url = string.format(
"%s/language-server-v%s/language_server_%s.gz",
Expand All @@ -93,7 +90,7 @@ function Bin:download(callback)
)
end

---Expands langauge server binary from compressed file.
---Expands language server binary from compressed file.
---Returns `true` on success and `false` on failure.
---@return boolean
function Bin:expand()
Expand Down
11 changes: 10 additions & 1 deletion lua/neocodeium/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,20 @@ function Server:start()

local args = {
"--api_server_url",
api_url and api_url .. " --enterprise_mode" or "https://server.codeium.com",
api_url or "https://server.codeium.com",
"--manager_dir",
manager_dir,
}

if options.server.api_url and options.server.api_url ~= "" then
table.insert(args, "--enterprise_mode")
end

if options.server.portal_url and options.server.portal_url ~= "" then
table.insert(args, "--portal_url")
table.insert(args, options.server.portal_url)
end

if self.chat_enabled then
table.insert(args, "--enable_local_search")
table.insert(args, "--enable_index_service")
Expand Down