local function config(_config) local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = vim.tbl_deep_extend("force", capabilities, require("blink.cmp").get_lsp_capabilities({}, false)) capabilities = vim.tbl_deep_extend("force", capabilities, { textDocument = { foldingRange = { dynamicRegistration = false, lineFoldingOnly = true, }, }, }) return vim.tbl_deep_extend("force", { capabilities = capabilities, }, _config or {}) end vim.lsp.config("gopls", { cmd = { "gopls", "serve" }, filetypes = { "go", "go.mod" }, root_markers = {"go.mod", ".git", "go.work"}, settings = { gopls = { analyses = { unusedparams = true, }, staticcheck = true, gofumpt = true, }, }, }) vim.lsp.config("templ", { cmd = { "templ", "lsp" }, 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" }, -- filetypes = { "v", "vv", "vsh" }, -- root_markers = { "v.mod", ".git" }, -- }))