aboutsummaryrefslogblamecommitdiff
path: root/.config/nvim/lua/plugins/nvim-lspconfig.lua
blob: 267ecf6e30e97d1135d6373a3b0b1d7e58f0e563 (plain) (tree)


































































































































                                                                                            
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",
	},
}