diff options
author | ichigo-gyuunyuu <[email protected]> | 2021-07-21 01:03:15 +0530 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-21 00:03:15 +0430 |
commit | 0064b446a02be13dba0f16f084e073b347716710 (patch) | |
tree | 203f9907132b86c37733096bd139cf224b4dd1ad | |
parent | 9e640fa4d99beeec97292a00a51b335960aa2b0f (diff) |
[Feature] Allow for custom path to a language server binary (#1043)
-rw-r--r-- | lua/default-config.lua | 3 | ||||
-rw-r--r-- | lua/lang/clang.lua | 5 | ||||
-rw-r--r-- | lua/lang/clojure.lua | 8 | ||||
-rw-r--r-- | lua/lang/cmake.lua | 5 | ||||
-rw-r--r-- | lua/lang/cs.lua | 9 | ||||
-rw-r--r-- | lua/lang/css.lua | 5 | ||||
-rw-r--r-- | lua/lang/dockerfile.lua | 8 | ||||
-rw-r--r-- | lua/lang/elixir.lua | 5 | ||||
-rw-r--r-- | lua/lang/elm.lua | 19 | ||||
-rw-r--r-- | lua/lang/go.lua | 5 | ||||
-rw-r--r-- | lua/lang/graphql.lua | 11 | ||||
-rw-r--r-- | lua/lang/html.lua | 5 | ||||
-rw-r--r-- | lua/lang/json.lua | 5 | ||||
-rw-r--r-- | lua/lang/julia.lua | 8 | ||||
-rw-r--r-- | lua/lang/kotlin.lua | 8 | ||||
-rw-r--r-- | lua/lang/lua.lua | 8 | ||||
-rw-r--r-- | lua/lang/php.lua | 5 | ||||
-rw-r--r-- | lua/lang/python.lua | 5 | ||||
-rw-r--r-- | lua/lang/ruby.lua | 5 | ||||
-rw-r--r-- | lua/lang/rust.lua | 7 | ||||
-rw-r--r-- | lua/lang/sh.lua | 5 | ||||
-rw-r--r-- | lua/lang/svelte.lua | 8 | ||||
-rw-r--r-- | lua/lang/swift.lua | 5 | ||||
-rw-r--r-- | lua/lang/terraform.lua | 5 | ||||
-rw-r--r-- | lua/lang/tex.lua | 5 | ||||
-rw-r--r-- | lua/lang/vim.lua | 5 | ||||
-rw-r--r-- | lua/lang/vue.lua | 5 | ||||
-rw-r--r-- | lua/lang/yaml.lua | 5 | ||||
-rw-r--r-- | lua/lang/zig.lua | 4 | ||||
-rw-r--r-- | lua/lang/zsh.lua | 9 |
30 files changed, 150 insertions, 45 deletions
diff --git a/lua/default-config.lua b/lua/default-config.lua index 2503aaa2..58d9d5d1 100644 --- a/lua/default-config.lua +++ b/lua/default-config.lua @@ -165,7 +165,9 @@ require("core.which-key").config() require("core.nvimtree").config() require("lang.clang").config() +require("lang.clojure").config() require("lang.cmake").config() +require("lang.cs").config() require("lang.css").config() require("lang.dart").config() require("lang.dockerfile").config() @@ -194,3 +196,4 @@ require("lang.vim").config() require("lang.vue").config() require("lang.yaml").config() require("lang.zig").config() +require("lang.zsh").config() diff --git a/lua/lang/clang.lua b/lua/lang/clang.lua index ae08ea9f..0a568620 100644 --- a/lua/lang/clang.lua +++ b/lua/lang/clang.lua @@ -25,6 +25,9 @@ M.config = function() }, stop_on_entry = false, }, + lsp = { + path = DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd", + }, } end @@ -69,7 +72,7 @@ M.lsp = function() table.insert(clangd_flags, "--header-insertion=" .. O.lang.clang.header_insertion) require("lspconfig").clangd.setup { - cmd = { DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd", unpack(clangd_flags) }, + cmd = { O.lang.clang.lsp.path, unpack(clangd_flags) }, on_attach = require("lsp").common_on_attach, handlers = { ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { diff --git a/lua/lang/clojure.lua b/lua/lang/clojure.lua index 09c24b7a..e973a0e3 100644 --- a/lua/lang/clojure.lua +++ b/lua/lang/clojure.lua @@ -1,7 +1,11 @@ local M = {} M.config = function() - O.lang.erlang = {} + O.lang.erlang = { + lsp = { + path = DATA_PATH .. "/lspinstall/clojure/clojure-lsp", + }, + } end M.format = function() @@ -20,7 +24,7 @@ M.lsp = function() end require("lspconfig").clojure_lsp.setup { - cmd = { DATA_PATH .. "/lspinstall/clojure/clojure-lsp" }, + cmd = { O.lang.erlang.lsp.path }, on_attach = require("lsp").common_on_attach, } end diff --git a/lua/lang/cmake.lua b/lua/lang/cmake.lua index 13d9fe7b..a4d8d045 100644 --- a/lua/lang/cmake.lua +++ b/lua/lang/cmake.lua @@ -6,6 +6,9 @@ M.config = function() exe = "clang-format", args = {}, }, + lsp = { + path = DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server", + }, } end @@ -25,7 +28,7 @@ M.lsp = function() end require("lspconfig").cmake.setup { - cmd = { DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server" }, + cmd = { O.lang.cmake.lsp.path }, on_attach = require("lsp").common_on_attach, filetypes = { "cmake" }, } diff --git a/lua/lang/cs.lua b/lua/lang/cs.lua index 8e34c539..851e226f 100644 --- a/lua/lang/cs.lua +++ b/lua/lang/cs.lua @@ -1,8 +1,11 @@ local M = {} M.config = function() - -- TODO: implement config for language - return "No config available!" + O.lang.csharp = { + lsp = { + path = DATA_PATH .. "/lspinstall/csharp/omnisharp/run", + }, + } end M.format = function() @@ -23,7 +26,7 @@ M.lsp = function() -- C# language server (csharp/OmniSharp) setup require("lspconfig").omnisharp.setup { on_attach = require("lsp").common_on_attach, - cmd = { DATA_PATH .. "/lspinstall/csharp/omnisharp/run", "--languageserver", "--hostPID", tostring(vim.fn.getpid()) }, + cmd = { O.lang.csharp.lsp.path, "--languageserver", "--hostPID", tostring(vim.fn.getpid()) }, } end diff --git a/lua/lang/css.lua b/lua/lang/css.lua index 263523a6..257896f2 100644 --- a/lua/lang/css.lua +++ b/lua/lang/css.lua @@ -7,6 +7,9 @@ M.config = function() exe = "prettier", args = {}, }, + lsp = { + path = DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js", + }, } end @@ -57,7 +60,7 @@ M.lsp = function() require("lspconfig").cssls.setup { cmd = { "node", - DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js", + O.lang.css.lsp.path, "--stdio", }, on_attach = require("lsp").common_on_attach, diff --git a/lua/lang/dockerfile.lua b/lua/lang/dockerfile.lua index 837aab6a..35134f36 100644 --- a/lua/lang/dockerfile.lua +++ b/lua/lang/dockerfile.lua @@ -1,7 +1,11 @@ local M = {} M.config = function() - O.lang.docker = {} + O.lang.docker = { + lsp = { + path = DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", + }, + } end M.format = function() @@ -21,7 +25,7 @@ M.lsp = function() -- npm install -g dockerfile-language-server-nodejs require("lspconfig").dockerls.setup { - cmd = { DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio" }, + cmd = { O.lang.docker.lsp.path, "--stdio" }, on_attach = require("lsp").common_on_attach, root_dir = vim.loop.cwd, } diff --git a/lua/lang/elixir.lua b/lua/lang/elixir.lua index 7473804b..e702e89b 100644 --- a/lua/lang/elixir.lua +++ b/lua/lang/elixir.lua @@ -7,6 +7,9 @@ M.config = function() args = { "format" }, stdin = true, }, + lsp = { + path = DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh", + }, } end @@ -38,7 +41,7 @@ M.lsp = function() end require("lspconfig").elixirls.setup { - cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" }, + cmd = { O.lang.elixir.lsp.path }, on_attach = require("lsp").common_on_attach, } end diff --git a/lua/lang/elm.lua b/lua/lang/elm.lua index 54526e0c..8fc8cebb 100644 --- a/lua/lang/elm.lua +++ b/lua/lang/elm.lua @@ -1,7 +1,16 @@ local M = {} M.config = function() - O.lang.elm = {} + local elm_bin = DATA_PATH .. "/lspinstall/elm/node_modules/.bin" + + O.lang.elm = { + lsp = { + path = elm_bin .. "/elm-language-server", + format = elm_bin .. "/elm-format", + root = elm_bin, + test = elm_bin .. "/elm-test", + }, + } end M.format = function() @@ -20,13 +29,13 @@ M.lsp = function() end require("lspconfig").elmls.setup { - cmd = { DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-language-server" }, + cmd = { O.lang.elm.lsp.path }, on_attach = require("lsp").common_on_attach, init_options = { elmAnalyseTrigger = "change", - elmFormatPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-format", - elmPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm", - elmTestPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-test", + elmFormatPath = O.lang.elm.lsp.format, + elmPath = O.lang.elm.lsp.root, + elmTestPath = O.lang.elm.lsp.test, }, } end diff --git a/lua/lang/go.lua b/lua/lang/go.lua index ee7a4df7..16b55ffb 100644 --- a/lua/lang/go.lua +++ b/lua/lang/go.lua @@ -11,6 +11,9 @@ M.config = function() "golangcilint", "revive", }, + lsp = { + path = DATA_PATH .. "/lspinstall/go/gopls", + }, } end @@ -40,7 +43,7 @@ end M.lsp = function() if not require("lv-utils").check_lsp_client_active "gopls" then require("lspconfig").gopls.setup { - cmd = { DATA_PATH .. "/lspinstall/go/gopls" }, + cmd = { O.lang.go.lsp.path }, settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } }, root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"), init_options = { usePlaceholders = true, completeUnimported = true }, diff --git a/lua/lang/graphql.lua b/lua/lang/graphql.lua index b6abfabd..601541a6 100644 --- a/lua/lang/graphql.lua +++ b/lua/lang/graphql.lua @@ -1,7 +1,11 @@ local M = {} M.config = function() - O.lang.graphql = {} + O.lang.graphql = { + lsp = { + path = "graphql-lsp", + }, + } end M.format = function() @@ -20,7 +24,10 @@ M.lsp = function() end -- npm install -g graphql-language-service-cli - require("lspconfig").graphql.setup { on_attach = require("lsp").common_on_attach } + require("lspconfig").graphql.setup { + cmd = { O.lang.graphql.lsp.path, "server", "-m", "stream" }, + on_attach = require("lsp").common_on_attach, + } end M.dap = function() diff --git a/lua/lang/html.lua b/lua/lang/html.lua index 1c45cd05..b14f6e1a 100644 --- a/lua/lang/html.lua +++ b/lua/lang/html.lua @@ -7,6 +7,9 @@ M.config = function() -- https://docs.errata.ai/vale/scoping#html "vale", }, + lsp = { + path = DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js", + }, } end @@ -30,7 +33,7 @@ M.lsp = function() require("lspconfig").html.setup { cmd = { "node", - DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js", + O.lang.html.lsp.path, "--stdio", }, on_attach = require("lsp").common_on_attach, diff --git a/lua/lang/json.lua b/lua/lang/json.lua index 92ea769e..e46f38cb 100644 --- a/lua/lang/json.lua +++ b/lua/lang/json.lua @@ -12,6 +12,9 @@ M.config = function() args = { "-m", "json.tool" }, stdin = true, }, + lsp = { + path = DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js", + }, } end @@ -46,7 +49,7 @@ M.lsp = function() require("lspconfig").jsonls.setup { cmd = { "node", - DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js", + O.lang.json.lsp.path, "--stdio", }, on_attach = require("lsp").common_on_attach, diff --git a/lua/lang/julia.lua b/lua/lang/julia.lua index acd6d2ad..a1c0241d 100644 --- a/lua/lang/julia.lua +++ b/lua/lang/julia.lua @@ -1,7 +1,11 @@ local M = {} M.config = function() - O.lang.julia = {} + O.lang.julia = { + lsp = { + path = CONFIG_PATH .. "/lua/lsp/julia/run.jl", + }, + } end M.format = function() @@ -30,7 +34,7 @@ M.lsp = function() "--startup-file=no", "--history-file=no", -- vim.fn.expand "~/.config/nvim/lua/lsp/julia/run.jl", - CONFIG_PATH .. "/lua/lsp/julia/run.jl", + O.lang.julia.lsp.path, } require("lspconfig").julials.setup { cmd = cmd, diff --git a/lua/lang/kotlin.lua b/lua/lang/kotlin.lua index 989addc3..3979424f 100644 --- a/lua/lang/kotlin.lua +++ b/lua/lang/kotlin.lua @@ -1,7 +1,11 @@ local M = {} M.config = function() - O.lang.kotlin = {} + O.lang.kotlin = { + lsp = { + path = DATA_PATH .. "/lspinstall/kotlin/server/bin/kotlin-language-server", + }, + } end M.format = function() @@ -29,7 +33,7 @@ M.lsp = function() local util = require "lspconfig/util" - local bin_name = DATA_PATH .. "/lspinstall/kotlin/server/bin/kotlin-language-server" + local bin_name = O.lang.kotlin.lsp.path if vim.fn.has "win32" == 1 then bin_name = bin_name .. ".bat" end diff --git a/lua/lang/lua.lua b/lua/lang/lua.lua index 02b2decf..6b981479 100644 --- a/lua/lang/lua.lua +++ b/lua/lang/lua.lua @@ -13,6 +13,9 @@ M.config = function() stdin = false, }, linters = { "luacheck" }, + lsp = { + path = DATA_PATH .. "/lspinstall/lua/sumneko-lua-language-server", + }, } end @@ -43,11 +46,10 @@ end M.lsp = function() if not require("lv-utils").check_lsp_client_active "sumneko_lua" then -- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone) - local sumneko_root_path = DATA_PATH .. "/lspinstall/lua" - local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server" + local sumneko_main = string.gsub(O.lang.lua.lsp.path, "sumneko-lua-language-server", "main.lua") require("lspconfig").sumneko_lua.setup { - cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" }, + cmd = { O.lang.lua.lsp.path, "-E", sumneko_main }, on_attach = require("lsp").common_on_attach, settings = { Lua = { diff --git a/lua/lang/php.lua b/lua/lang/php.lua index d1e4a729..632c4052 100644 --- a/lua/lang/php.lua +++ b/lua/lang/php.lua @@ -21,6 +21,9 @@ M.config = function() args = { "--standard=PSR12", vim.api.nvim_buf_get_name(0) }, stdin = false, }, + lsp = { + path = DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", + }, } end @@ -53,7 +56,7 @@ M.lsp = function() end require("lspconfig").intelephense.setup { - cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" }, + cmd = { O.lang.php.lsp.path, "--stdio" }, on_attach = require("lsp").common_on_attach, handlers = { ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { diff --git a/lua/lang/python.lua b/lua/lang/python.lua index cbd319b0..b51ea1c4 100644 --- a/lua/lang/python.lua +++ b/lua/lang/python.lua @@ -25,6 +25,9 @@ M.config = function() "pylint", "mypy", }, + lsp = { + path = DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", + }, } end @@ -58,7 +61,7 @@ M.lsp = function() -- npm i -g pyright require("lspconfig").pyright.setup { cmd = { - DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", + O.lang.python.lsp.path, "--stdio", }, on_attach = require("lsp").common_on_attach, diff --git a/lua/lang/ruby.lua b/lua/lang/ruby.lua index 8b3b1a76..1975acfd 100644 --- a/lua/lang/ruby.lua +++ b/lua/lang/ruby.lua @@ -14,6 +14,9 @@ M.config = function() stdin = true, }, linters = { "ruby" }, + lsp = { + path = DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", + }, } end @@ -48,7 +51,7 @@ M.lsp = function() if not require("lv-utils").check_lsp_client_active "solargraph" then -- If you are using rvm, make sure to change below configuration require("lspconfig").solargraph.setup { - cmd = { DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", "stdio" }, + cmd = { O.lang.ruby.lsp.path, "stdio" }, on_attach = require("lsp").common_on_attach, handlers = { ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { diff --git a/lua/lang/rust.lua b/lua/lang/rust.lua index ecdfa69d..e3d4ce47 100644 --- a/lua/lang/rust.lua +++ b/lua/lang/rust.lua @@ -19,6 +19,9 @@ M.config = function() signs = true, underline = true, }, + lsp = { + path = DATA_PATH .. "/lspinstall/rust/rust-analyzer", + }, } end @@ -118,14 +121,14 @@ M.lsp = function() -- these override the defaults set by rust-tools.nvim -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer server = { - cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" }, + cmd = { O.lang.rust.lsp.path }, on_attach = require("lsp").common_on_attach, }, -- rust-analyser options } require("rust-tools").setup(opts) else require("lspconfig").rust_analyzer.setup { - cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" }, + cmd = { O.lang.rust.lsp.path }, on_attach = require("lsp").common_on_attach, filetypes = { "rust" }, root_dir = require("lspconfig.util").root_pattern("Cargo.toml", "rust-project.json"), diff --git a/lua/lang/sh.lua b/lua/lang/sh.lua index 37bd9238..71170e1f 100644 --- a/lua/lang/sh.lua +++ b/lua/lang/sh.lua @@ -16,6 +16,9 @@ M.config = function() stdin = false, }, linters = { "shellcheck" }, + lsp = { + path = DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", + }, } end @@ -47,7 +50,7 @@ M.lsp = function() if not require("lv-utils").check_lsp_client_active "bashls" then -- npm i -g bash-language-server require("lspconfig").bashls.setup { - cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" }, + cmd = { O.lang.sh.lsp.path, "start" }, on_attach = require("lsp").common_on_attach, filetypes = { "sh", "zsh" }, } diff --git a/lua/lang/svelte.lua b/lua/lang/svelte.lua index 220c2c18..ad6dd094 100644 --- a/lua/lang/svelte.lua +++ b/lua/lang/svelte.lua @@ -1,7 +1,11 @@ local M = {} M.config = function() - O.lang.svelte = {} + O.lang.svelte = { + lsp = { + path = DATA_PATH .. "/lspinstall/svelte/node_modules/.bin/svelteserver", + }, + } end M.format = function() @@ -20,7 +24,7 @@ M.lsp = function() end require("lspconfig").svelte.setup { - cmd = { DATA_PATH .. "/lspinstall/svelte/node_modules/.bin/svelteserver", "--stdio" }, + cmd = { O.lang.svelte.lsp.path, "--stdio" }, filetypes = { "svelte" }, root_dir = require("lspconfig.util").root_pattern("package.json", ".git"), on_attach = require("lsp").common_on_attach, diff --git a/lua/lang/swift.lua b/lua/lang/swift.lua index 69254caa..845f9a49 100644 --- a/lua/lang/swift.lua +++ b/lua/lang/swift.lua @@ -7,6 +7,9 @@ M.config = function() args = {}, stdin = true, }, + lsp = { + path = "sourcekit-lsp", + }, } end @@ -38,7 +41,7 @@ M.lsp = function() end require("lspconfig").sourcekit.setup { - cmd = { "xcrun", "sourcekit-lsp" }, + cmd = { "xcrun", O.lang.swift.lsp.path }, on_attach = require("lsp").common_on_attach, filetypes = { "swift" }, } diff --git a/lua/lang/terraform.lua b/lua/lang/terraform.lua index ce78443f..df8ac692 100644 --- a/lua/lang/terraform.lua +++ b/lua/lang/terraform.lua @@ -7,6 +7,9 @@ M.config = function() args = { "fmt" }, stdin = false, }, + lsp = { + path = DATA_PATH .. "/lspinstall/terraform/terraform-ls", + }, } end @@ -40,7 +43,7 @@ M.lsp = function() end require("lspconfig").terraformls.setup { - cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" }, + cmd = { O.lang.terraform.lsp.path, "serve" }, on_attach = require("lsp").common_on_attach, filetypes = { "tf", "terraform", "hcl" }, } diff --git a/lua/lang/tex.lua b/lua/lang/tex.lua index 7fdc8757..a91105ff 100644 --- a/lua/lang/tex.lua +++ b/lua/lang/tex.lua @@ -8,6 +8,9 @@ M.config = function() diagnostics_delay = 300, formatter_line_length = 80, latex_formatter = "latexindent", + lsp = { + path = DATA_PATH .. "/lspinstall/latex/texlab", + }, build = { executable = "latexmk", args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" }, @@ -77,7 +80,7 @@ M.lsp = function() end require("lspconfig").texlab.setup { - cmd = { DATA_PATH .. "/lspinstall/latex/texlab" }, + cmd = { O.lang.latex.lsp.path }, on_attach = require("lsp").common_on_attach, handlers = { ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { diff --git a/lua/lang/vim.lua b/lua/lang/vim.lua index 4386757e..027538ab 100644 --- a/lua/lang/vim.lua +++ b/lua/lang/vim.lua @@ -3,6 +3,9 @@ local M = {} M.config = function() O.lang.vim = { linters = { "vint" }, + lsp = { + path = DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", + }, } end @@ -24,7 +27,7 @@ M.lsp = function() -- npm install -g vim-language-server require("lspconfig").vimls.setup { - cmd = { DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio" }, + cmd = { O.lang.vim.lsp.path, "--stdio" }, on_attach = require("lsp").common_on_attach, } end diff --git a/lua/lang/vue.lua b/lua/lang/vue.lua index 33c6dda7..8725bba2 100644 --- a/lua/lang/vue.lua +++ b/lua/lang/vue.lua @@ -11,6 +11,9 @@ M.config = function() stdin = true, }, auto_import = true, + lsp = { + path = DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", + }, } end @@ -53,7 +56,7 @@ M.lsp = function() -- Vue language server configuration (vetur) require("lspconfig").vuels.setup { - cmd = { DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", "--stdio" }, + cmd = { O.lang.vue.lsp.path, "--stdio" }, on_attach = require("lsp").common_on_attach, } diff --git a/lua/lang/yaml.lua b/lua/lang/yaml.lua index 8d5c01fa..44366ad2 100644 --- a/lua/lang/yaml.lua +++ b/lua/lang/yaml.lua @@ -7,6 +7,9 @@ M.config = function() args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" }, stdin = true, }, + lsp = { + path = DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", + }, } end @@ -38,7 +41,7 @@ M.lsp = function() -- npm install -g yaml-language-server require("lspconfig").yamlls.setup { - cmd = { DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio" }, + cmd = { O.lang.yaml.lsp.path, "--stdio" }, on_attach = require("lsp").common_on_attach, } end diff --git a/lua/lang/zig.lua b/lua/lang/zig.lua index d5b8a83d..06ae9197 100644 --- a/lua/lang/zig.lua +++ b/lua/lang/zig.lua @@ -7,6 +7,9 @@ M.config = function() args = { "fmt" }, stdin = false, }, + lsp = { + path = "zls", + }, } end @@ -41,6 +44,7 @@ M.lsp = function() -- Further custom install zls in -- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS require("lspconfig").zls.setup { + cmd = { O.lang.zig.lsp.path }, root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"), on_attach = require("lsp").common_on_attach, } diff --git a/lua/lang/zsh.lua b/lua/lang/zsh.lua index c81bd96c..44ce35a1 100644 --- a/lua/lang/zsh.lua +++ b/lua/lang/zsh.lua @@ -1,8 +1,11 @@ local M = {} M.config = function() - -- TODO: implement config for language - return "No config available!" + O.lang.zsh = { + lsp = { + path = DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", + }, + } end M.format = function() @@ -35,7 +38,7 @@ M.lsp = function() if not require("lv-utils").check_lsp_client_active "bashls" then -- npm i -g bash-language-server require("lspconfig").bashls.setup { - cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" }, + cmd = { O.lang.zsh.lsp.path, "start" }, on_attach = require("lsp").common_on_attach, filetypes = { "sh", "zsh" }, } |