Files
neovim-config/lua/taken/plugins/lsp/lspconfig.lua
2024-09-15 19:00:26 +02:00

55 lines
1.7 KiB
Lua

--- @type LazyPluginSpec
return {
"neovim/nvim-lspconfig",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
},
event = { "BufReadPre", "BufNewFile" },
config = function()
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
local defaultLsps = { "html", "cssls", "pyright", "jsonls", "rust_analyzer", "yamlls", "eslint" }
for _, lsp in ipairs(defaultLsps) do
lspconfig[lsp].setup({
capabilities = capabilities,
on_attach = on_attach,
})
end
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,
}