neovim-dots/lua/plugins/lsp.lua
2024-05-12 15:19:50 -07:00

113 lines
3.5 KiB
Lua

return {
{
"pmizio/typescript-tools.nvim",
dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
opts = {},
},
{
"elixir-tools/elixir-tools.nvim",
version = "*",
event = { "BufReadPre", "BufNewFile" },
config = function()
local elixir = require("elixir")
local elixirls = require("elixir.elixirls")
elixir.setup({
nextls = { enable = true },
credo = {},
elixirls = {
enable = true,
settings = elixirls.settings({
dialyzerEnabled = false,
enableTestLenses = false,
}),
on_attach = function(client, bufnr)
vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
end,
},
})
end,
dependencies = {
"nvim-lua/plenary.nvim",
},
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
tailwindcss = {
-- exclude a filetype from the default_config
filetypes_exclude = { "markdown" },
-- add additional filetypes to the default_config
filetypes_include = {
"pcss",
},
-- to fully override the default_config, change the below
-- filetypes = {}
},
tsserver = {
handlers = {
["textDocument/publishDiagnostics"] = function(...) end,
},
},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
checkOnSave = {
command = "clippy",
},
},
},
},
cssls = {
filetypes = { "css", "scss", "less", "pcss" },
},
clangd = {
cmd = { "clangd", "--offset-encoding=utf-16" },
},
},
diagnostics = {
underline = true,
update_in_insert = false,
virtual_text = {
spacing = 4,
source = "if_many",
-- prefix = "●",
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
prefix = "icons",
},
severity_sort = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = LazyVim.config.icons.diagnostics.Error,
[vim.diagnostic.severity.WARN] = LazyVim.config.icons.diagnostics.Warn,
[vim.diagnostic.severity.HINT] = LazyVim.config.icons.diagnostics.Hint,
[vim.diagnostic.severity.INFO] = LazyVim.config.icons.diagnostics.Info,
},
},
},
setup = {
tailwindcss = function(_, opts)
local tw = require("lspconfig.server_configurations.tailwindcss")
opts.filetypes = opts.filetypes or {}
-- Add default filetypes
vim.list_extend(opts.filetypes, tw.default_config.filetypes)
-- Remove excluded filetypes
--- @param ft string
opts.filetypes = vim.tbl_filter(function(ft)
return not vim.tbl_contains(opts.filetypes_exclude or {}, ft)
end, opts.filetypes)
-- Add additional filetypes
vim.list_extend(opts.filetypes, opts.filetypes_include or {})
end,
},
},
},
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
}