summaryrefslogtreecommitdiff
path: root/lua/plugins/lspconfig.lua
blob: 586a03e2c3a9a3aef23d06dc15e44e77ca92061d (plain)
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
48
49
50
51
52
vim.diagnostic.config({
	virtual_text = true,
	signs = true,
	underline = true,
	severity_sort = true,
})

vim.lsp.config['ccls'] = {
	cmd = { 'ccls' },
	root_markers = { '.ccls-cache', '.ccls' },
	filetypes = { 'c', 'cpp', 'cc', 'h' },
}

vim.lsp.config['rust_analyzer'] = {
	cmd = { 'rust-analyzer' },
	root_markers = { 'Cargo.toml' },
	filetypes = { 'rs' },
}

vim.lsp.config['gopls'] = {
	cmd = { 'gopls' },
	root_markers = { 'go.mod', 'go.work', '.git' },
	filetypes = { 'go' },
}

vim.lsp.config['lua_ls'] = {
	cmd = { 'lua-language-server' },
	root_markers = { '.luarocks', '.git' },
	filetypes = { 'lua' },
	settings = {
		Lua = {
			runtime = {
				version = 'LuaJIT',
				path = vim.split(package.path, ';'),
			},
			diagnostics = {
				globals = { 'vim' },
			},
			workspace = {
				library = vim.api.nvim_get_runtime_file("", true),
			},
			telemetry = {
				enable = false,
			},
		},
	},
}

vim.lsp.enable('ccls')
vim.lsp.enable('rust_analyzer')
vim.lsp.enable('gopls')
vim.lsp.enable('lua_ls')