aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/codeqlls/init.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-11-08 01:08:42 +0100
committerGitHub <noreply@github.com>2021-11-08 01:08:42 +0100
commit58a0af471bef1edab6b804ca05cafe4a95f16a19 (patch)
tree1ff9c6d10c2acc035359a7ca36cfb15e09953a63 /lua/nvim-lsp-installer/servers/codeqlls/init.lua
parentremove deprecated g:lsp_installer_log_level variable (diff)
downloadmason-58a0af471bef1edab6b804ca05cafe4a95f16a19.tar
mason-58a0af471bef1edab6b804ca05cafe4a95f16a19.tar.gz
mason-58a0af471bef1edab6b804ca05cafe4a95f16a19.tar.bz2
mason-58a0af471bef1edab6b804ca05cafe4a95f16a19.tar.lz
mason-58a0af471bef1edab6b804ca05cafe4a95f16a19.tar.xz
mason-58a0af471bef1edab6b804ca05cafe4a95f16a19.tar.zst
mason-58a0af471bef1edab6b804ca05cafe4a95f16a19.zip
add codeqlls (#246)
Diffstat (limited to 'lua/nvim-lsp-installer/servers/codeqlls/init.lua')
-rw-r--r--lua/nvim-lsp-installer/servers/codeqlls/init.lua62
1 files changed, 62 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/servers/codeqlls/init.lua b/lua/nvim-lsp-installer/servers/codeqlls/init.lua
new file mode 100644
index 00000000..4e2bc168
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/codeqlls/init.lua
@@ -0,0 +1,62 @@
+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 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,
+ languages = { "codeql" },
+ installer = {
+ context.use_github_release_file(
+ "github/codeql-cli-binaries",
+ coalesce(
+ when(platform.is_mac, "codeql-osx64.zip"),
+ when(platform.is_unix, "codeql-linux64.zip"),
+ when(platform.is_win, "codeql-win64.zip")
+ )
+ ),
+ context.capture(function(ctx)
+ return std.unzip_remote(ctx.github_release_file)
+ 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,
+ },
+ }
+end