diff options
Diffstat (limited to '')
| -rw-r--r-- | config/nvim/lua/lsp.lua | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua index 91f22a1..45b7037 100644 --- a/config/nvim/lua/lsp.lua +++ b/config/nvim/lua/lsp.lua @@ -1,5 +1,3 @@ -local util = require("lspconfig/util") - local function config(_config) local capabilities = vim.lsp.protocol.make_client_capabilities() @@ -37,8 +35,28 @@ vim.lsp.config("templ", { filetypes = { "templ" }, root_markers = { "go.work", "go.mod", ".git" }, }) + +-- Try to find json-lsp (installed via json-lsp or vscode-json-languageserver) +local jsonlsp_bin = vim.fn.executable("json-lsp") == 1 and "json-lsp" + or vim.fn.executable("vscode-json-languageserver") == 1 and "vscode-json-languageserver" + or nil + +if jsonlsp_bin then + vim.lsp.config("jsonls", { + cmd = { jsonlsp_bin, "--stdio" }, + filetypes = { "json", "jsonc" }, + root_markers = { ".git", "package.json", "tsconfig.json" }, + }) +end + vim.lsp.enable("gopls") vim.lsp.enable("templ") +if jsonlsp_bin then + vim.lsp.enable("jsonls") +end +if vim.fn.executable("yaml-language-server") == 1 then + vim.lsp.enable("yamlls") +end -- require('lspconfig').v_analyzer.setup(config({ -- cmd = { "v-analyzer" }, |
