summaryrefslogtreecommitdiff
path: root/config/nvim/lua/lsp.lua
blob: 91f22a1bb6f98d9352e8c89117a3e85ab2dd137e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
local util = require("lspconfig/util")

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" },
})
vim.lsp.enable("gopls")
vim.lsp.enable("templ")

-- require('lspconfig').v_analyzer.setup(config({
-- 	cmd = { "v-analyzer" },
-- 	filetypes = { "v", "vv", "vsh" },
-- 	root_markers = { "v.mod", ".git" },
-- }))