2024-10-16 16:58:03 +02:00
|
|
|
local map = vim.keymap.set
|
2024-10-12 12:01:29 +02:00
|
|
|
local lspconfig = require "lspconfig"
|
|
|
|
|
2024-10-19 14:33:00 +02:00
|
|
|
local servers = { "html", "cssls", "ts_ls", "tailwindcss", "emmet_ls", "pyright", "solargraph" }
|
2024-10-16 16:58:03 +02:00
|
|
|
|
|
|
|
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()
|
2024-10-12 12:01:29 +02:00
|
|
|
|
|
|
|
for _, lsp in ipairs(servers) do
|
|
|
|
lspconfig[lsp].setup {
|
2024-10-16 16:58:03 +02:00
|
|
|
on_attach = on_attach,
|
|
|
|
on_init = on_init,
|
|
|
|
capabilities = capabilities,
|
2024-10-12 12:01:29 +02:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2024-10-13 16:40:57 +02:00
|
|
|
lspconfig.elixirls.setup {
|
2024-10-16 16:58:03 +02:00
|
|
|
capabilities = capabilities,
|
|
|
|
on_attach = on_attach,
|
|
|
|
on_init = on_init,
|
|
|
|
cmd = { "~/.elixir-ls/language_server.sh" },
|
2024-10-13 16:40:57 +02:00
|
|
|
single_file_support = true,
|
|
|
|
settings = {
|
|
|
|
dialyzerEnabled = true,
|
|
|
|
},
|
|
|
|
}
|
2024-10-16 16:58:03 +02:00
|
|
|
|
|
|
|
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,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|