aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/nvim-lspconfig.lua
blob: 267ecf6e30e97d1135d6373a3b0b1d7e58f0e563 (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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
local config = function()
	require("neoconf").setup({})
	local cmp_nvim_lsp = require("cmp_nvim_lsp")
	local lspconfig = require("lspconfig")

	local capabilities = cmp_nvim_lsp.default_capabilities()

	-- lua
	-- lspconfig.lua_ls.setup({
	-- 	capabilities = capabilities,
	-- 	on_attach = on_attach,
	-- 	settings = { -- custom settings for lua
	-- 		Lua = {
	-- 			-- make the language server recognize "vim" global
	-- 			diagnostics = {
	-- 				globals = { "vim" },
	-- 			},
	-- 			workspace = {
	-- 				-- make language server aware of runtime files
	-- 				library = {
	-- 					[vim.fn.expand("$VIMRUNTIME/lua")] = true,
	-- 					[vim.fn.stdpath("config") .. "/lua"] = true,
	-- 				},
	-- 			},
	-- 		},
	-- 	},
	-- })

	-- python
	lspconfig.pyright.setup({
		capabilities = capabilities,
		on_attach = on_attach,
		settings = {
			pyright = {
				disableOrganizeImports = false,
				analysis = {
					useLibraryCodeForTypes = true,
					autoSearchPaths = true,
					diagnosticMode = "workspace",
					autoImportCompletions = true,
				},
			},
		},
	})

	-- bash
	lspconfig.bashls.setup({
		capabilities = capabilities,
		on_attach = on_attach,
		filetypes = { "sh" },
	})

	-- docker
	lspconfig.dockerls.setup({
		capabilities = capabilities,
		on_attach = on_attach,
	})

	-- local luacheck = require("efmls-configs.linters.luacheck")
	-- local stylua = require("efmls-configs.formatters.stylua")
	-- local flake8 = require("efmls-configs.linters.flake8")
	-- local black = require("efmls-configs.formatters.black")
	-- local eslint_d = require("efmls-configs.linters.eslint_d")
	-- local prettierd = require("efmls-configs.formatters.prettier_d")
	-- local fixjson = require("efmls-configs.formatters.fixjson")
	-- local shellcheck = require("efmls-configs.linters.shellcheck")
	-- local shfmt = require("efmls-configs.formatters.shfmt")
	-- local alex = require("efmls-configs.linters.alex")
	-- local hadolint = require("efmls-configs.linters.hadolint")
	-- local solhint = require("efmls-configs.linters.solhint")

	-- configure efm server
-- 	lspconfig.efm.setup({
-- 		filetypes = {
-- 			"lua",
-- 			"python",
-- 			"json",
-- 			"jsonc",
-- 			"sh",
-- 			"javascript",
-- 			"javascriptreact",
-- 			"typescript",
-- 			"typescriptreact",
-- 			"svelte",
-- 			"vue",
-- 			"markdown",
-- 			"docker",
-- 			"solidity",
-- 		},
-- 		init_options = {
-- 			documentFormatting = true,
-- 			documentRangeFormatting = true,
-- 			hover = true,
-- 			documentSymbol = true,
-- 			codeAction = true,
-- 			completion = true,
-- 		},
-- 		settings = {
-- 			languages = {
-- 				lua = { luacheck, stylua },
-- 				python = { flake8, black },
-- 				typescript = { eslint_d, prettierd },
-- 				json = { eslint_d, fixjson },
-- 				jsonc = { eslint_d, fixjson },
-- 				sh = { shellcheck, shfmt },
-- 				javascript = { eslint_d, prettierd },
-- 				javascriptreact = { eslint_d, prettierd },
-- 				typescriptreact = { eslint_d, prettierd },
-- 				svelte = { eslint_d, prettierd },
-- 				vue = { eslint_d, prettierd },
-- 				markdown = { alex, prettierd },
-- 				docker = { hadolint, prettierd },
-- 				solidity = { solhint },
-- 			},
-- 		},
-- 	})
end

return {
	"neovim/nvim-lspconfig",
	config = config,
	lazy = false,
	dependencies = {
		"windwp/nvim-autopairs",
		"williamboman/mason.nvim",
		-- "creativenull/efmls-configs-nvim",
		"hrsh7th/nvim-cmp",
		"hrsh7th/cmp-buffer",
		"hrsh7th/cmp-nvim-lsp",
	},
}