Files
neovim-config/lua/taken/plugins/lsp/lspconfig.lua
2024-03-25 00:44:11 +01:00

76 lines
2.2 KiB
Lua

--- @type LazyPluginSpec
return {
"neovim/nvim-lspconfig",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"folke/neodev.nvim",
},
event = { "BufReadPre", "BufNewFile" },
config = function()
local neodev = require("neodev")
local lspconfig = require("lspconfig")
local cmp_nvim_lsp = require("cmp_nvim_lsp")
local on_attach = require("taken.utils.on_attach")
local capabilities = cmp_nvim_lsp.default_capabilities()
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
neodev.setup({
library = {
enabled = true,
runtime = true,
types = true,
plugins = {
"lazy.nvim",
},
},
setup_jsonls = false,
lspconfig = true,
pathStrict = true,
})
local defaultLsps = { "html", "cssls", "pyright", "jsonls" }
for _, lsp in ipairs(defaultLsps) do
lspconfig[lsp].setup({
capabilities = capabilities,
on_attach = on_attach,
})
end
lspconfig["eslint"].setup({
capabilities = capabilities,
on_attach = on_attach,
})
lspconfig["lua_ls"].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
completion = {
callSnippet = "Replace",
},
format = {
enable = false,
},
},
},
})
lspconfig["powershell_es"].setup({
capabilities = capabilities,
on_attach = on_attach,
bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services",
})
end,
}