Skip to content

Commit e3768e3

Browse files
committed
feat: support for binary file accessible by PATH
Fixes #457
1 parent d712de3 commit e3768e3

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ require("copilot").setup {
413413
414414
`type` can be either `"nodejs"` or `"binary"`. The binary version will be downloaded if used.
415415

416-
`custom_server_filepath` is used to specify the path of either the path (filename included) of the `js` file if using `"nodejs"` or the path to the binary if using `"binary"`.
416+
`custom_server_filepath` is used to specify the server path (filename included) of either the `js` file if using `"nodejs"` or to the binary if using `"binary"`.
417+
The filename on its own can also be set if accessible through your PATH.
417418
When using `"binary"`, the download process will be disabled and the binary will be used directly.
418419
example:
419420

lua/copilot/config/server.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---@class (exact) ServerConfig
22
---@field type string<'nodejs', 'binary'> Type of the server
3-
---@field custom_server_filepath? string|nil Path to the custom server file
3+
---@field custom_server_filepath? string|nil Path to the custom server file, can be absolute, relative or a file name (for PATH)
44

55
local server = {
66
---@type ServerConfig
@@ -10,6 +10,7 @@ local server = {
1010
},
1111
}
1212

13+
-- TODO: add support for relative paths
1314
---@param config ServerConfig
1415
function server.validate(config)
1516
vim.validate("type", config.type, function(server_type)

lua/copilot/lsp/binary.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ end
348348
---@param custom_server_path? string
349349
function M.setup(custom_server_path)
350350
if custom_server_path then
351-
if vim.fn.filereadable(custom_server_path) == 0 then
351+
if vim.fn.filereadable(custom_server_path) == 0 and vim.fn.executable(custom_server_path) == 0 then
352352
logger.error("copilot-language-server not found at " .. custom_server_path)
353353
return M
354354
end

0 commit comments

Comments
 (0)