aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/codeqlls/init.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-01-02 17:54:56 +0100
committerGitHub <noreply@github.com>2022-01-02 17:54:56 +0100
commit095ab4eb6a02d5fd3ea4b782a0e868e2c65e4427 (patch)
treef5d97077ad721f916c97d989906cb01f9f7d9e93 /lua/nvim-lsp-installer/servers/codeqlls/init.lua
parentfix(texlab): fix installing on windows (diff)
downloadmason-095ab4eb6a02d5fd3ea4b782a0e868e2c65e4427.tar
mason-095ab4eb6a02d5fd3ea4b782a0e868e2c65e4427.tar.gz
mason-095ab4eb6a02d5fd3ea4b782a0e868e2c65e4427.tar.bz2
mason-095ab4eb6a02d5fd3ea4b782a0e868e2c65e4427.tar.lz
mason-095ab4eb6a02d5fd3ea4b782a0e868e2c65e4427.tar.xz
mason-095ab4eb6a02d5fd3ea4b782a0e868e2c65e4427.tar.zst
mason-095ab4eb6a02d5fd3ea4b782a0e868e2c65e4427.zip
leverage PATH for locating local executables (#283)
1. This is a breaking change for the following servers, which will have to be reinstalled: - ltex - clangd 2. This is a breaking change for users who reach into the default options (for example via server:get_default_options()) to access the `cmd` property. nvim-lsp-installer no longer provides the `cmd` (except in a few instances), but instead provides an amended PATH which allows neovim's LSP client to locate the locally installed executable. To access the `cmd`, simply access it via lspconfig instead, for example like so: local default_config = require("lspconfig.server_configurations.rust_analyzer").default_config print("I can now access the cmd governed by lspconfig:", default_config.cmd) 3. This is a breaking change for 3rd party use cases that makes use of the `executable()` APIs (e.g., `npm.executable(root_dir, "tsserver")`). The recommended usage is to instead to use the canonical name of the command ("tsserver"), while providing an amended PATH, for example: local npm = require("nvim-lsp-installer.installers.npm") local server = server.Server:new { ..., root_dir = root_dir, installer = npm.packages { "tsserver" }, default_options = { cmd = { "tsserver" }, cmd_env = npm.env(root_dir), } }
Diffstat (limited to 'lua/nvim-lsp-installer/servers/codeqlls/init.lua')
-rw-r--r--lua/nvim-lsp-installer/servers/codeqlls/init.lua37
1 files changed, 5 insertions, 32 deletions
diff --git a/lua/nvim-lsp-installer/servers/codeqlls/init.lua b/lua/nvim-lsp-installer/servers/codeqlls/init.lua
index 4e2bc168..64d3a48a 100644
--- a/lua/nvim-lsp-installer/servers/codeqlls/init.lua
+++ b/lua/nvim-lsp-installer/servers/codeqlls/init.lua
@@ -1,30 +1,14 @@
local server = require "nvim-lsp-installer.server"
-local path = require "nvim-lsp-installer.path"
local std = require "nvim-lsp-installer.installers.std"
local Data = require "nvim-lsp-installer.data"
local platform = require "nvim-lsp-installer.platform"
local context = require "nvim-lsp-installer.installers.context"
+local process = require "nvim-lsp-installer.process"
+local path = require "nvim-lsp-installer.path"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- ---@param search_path string|nil
- ---@return string[]
- local function create_cmd(search_path)
- local cmd = {
- path.concat { root_dir, "codeql", platform.is_win and "codeql.cmd" or "codeql" },
- "execute",
- "language-server",
- "--check-errors",
- "ON_CHANGE",
- "-q",
- }
- if search_path then
- table.insert(cmd, search_path)
- end
- return cmd
- end
-
return server.Server:new {
name = name,
root_dir = root_dir,
@@ -43,20 +27,9 @@ return function(name, root_dir)
end),
},
default_options = {
- cmd = create_cmd(),
- on_new_config = function(config)
- if
- type(config.settings.search_path) == "table" and not vim.tbl_isempty(config.settings.search_path)
- then
- local search_path = "--search-path="
- for _, path_entry in ipairs(config.settings.search_path) do
- search_path = search_path .. vim.fn.expand(path_entry) .. ":"
- end
- config.cmd = create_cmd(search_path)
- else
- config.cmd = create_cmd()
- end
- end,
+ cmd_env = {
+ PATH = process.extend_path { path.concat { root_dir, "codeql" } },
+ },
},
}
end