aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/nvim/.config/nvim/lua/tobyvin/plugins/lspconfig.lua
blob: 67a18a830119db64e3ca210b1ef3ab87e8182b42 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
local lsp = require("tobyvin.lsp")
local utils = require("tobyvin.utils")
local M = {}

M.setup = function()
	local status_ok, lspconfig = pcall(require, "lspconfig")
	if not status_ok then
		vim.notify("Failed to load module 'lspconfig'", vim.log.levels.ERROR)
		return
	end

	lspconfig.bashls.setup(lsp.config())

	lspconfig.taplo.setup(lsp.config())

	lspconfig.yamlls.setup(lsp.config({
		settings = {
			yaml = {
				editor = {
					formatOnType = true,
				},
				format = {
					enable = true,
				},
			},
			redhat = {
				telemetry = {
					enabled = false,
				},
			},
		},
	}))

	lspconfig.tsserver.setup(lsp.config())

	lspconfig.pylsp.setup(lsp.config({
		settings = {
			pylsp = {
				plugins = {
					autopep8 = {
						enabled = false,
					},
					yapf = {
						enabled = false,
					},
					pylint = {
						enabled = true,
					},
				},
			},
		},
	}))

	lspconfig.cssls.setup(lsp.config())

	lspconfig.cssmodules_ls.setup(lsp.config())

	lspconfig.stylelint_lsp.setup(lsp.config())

	lspconfig.ccls.setup(lsp.config())

	lspconfig.gopls.setup(lsp.config({
		cmd = { "gopls", "serve" },
		settings = {
			gopls = {
				analyses = {
					unusedparams = true,
				},
				staticcheck = true,
			},
		},
	}))

	lspconfig.texlab.setup(lsp.config({
		settings = {
			texlab = {
				build = {
					args = {
						"-pdf",
						"-interaction=nonstopmode",
						"-synctex=1",
						"-auxdir=../aux",
						"-outdir=../out",
						"-emulate-aux-dir",
						"%f",
					},
					onSave = true,
				},
				chktex = {
					onEdit = true,
					onOpenAndSave = true,
				},
				auxDirectory = "../aux",
			},
		},
		on_attach = function(client, bufnr)
			vim.g.tex_flavor = "latex"
			vim.opt.spell = true
			lsp.on_attach(client, bufnr)
		end,
	}))

	require("lsp_signature").setup({
		bind = true,
		handler_opts = {
			border = "rounded",
		},
	})
end

return M