1
0
mirror of https://github.com/sameer1612/.dotfiles.git synced 2024-11-27 08:20:51 +02:00
sameer1612/.config/nvim/lua/configs/lspconfig.lua
2024-10-19 18:03:00 +05:30

82 lines
1.9 KiB
Lua

local map = vim.keymap.set
local lspconfig = require "lspconfig"
local servers = { "html", "cssls", "ts_ls", "tailwindcss", "emmet_ls", "pyright", "solargraph" }
local on_attach = function()
map("n", "<leader>lr", require "nvchad.lsp.renamer", { desc = "LSP Rename" })
end
local on_init = function(client, _)
if client.supports_method "textDocument/semanticTokens" then
client.server_capabilities.semanticTokensProvider = nil
end
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" },
snippetSupport = true,
preselectSupport = true,
insertReplaceSupport = true,
labelDetailsSupport = true,
deprecatedSupport = true,
commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } },
resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
},
}
dofile(vim.g.base46_cache .. "lsp")
require("nvchad.lsp").diagnostic_config()
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
}
end
lspconfig.elixirls.setup {
capabilities = capabilities,
on_attach = on_attach,
on_init = on_init,
cmd = { "~/.elixir-ls/language_server.sh" },
single_file_support = true,
settings = {
dialyzerEnabled = true,
},
}
lspconfig.lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
on_init = on_init,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
vim.fn.expand "$VIMRUNTIME/lua",
vim.fn.expand "$VIMRUNTIME/lua/vim/lsp",
vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types",
vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy",
"${3rd}/luv/library",
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
}