starter/lua/plugins/lsp-config.lua

66 lines
2.2 KiB
Lua

return {
"neovim/nvim-lspconfig",
opts = {
servers = {
tailwindcss = {
filetypes_exclude = { "markdown" },
},
marksman = {},
eslint = {},
emmet_language_server = {
filetypes = {
"css",
"eruby",
"html",
"javascript",
"javascriptreact",
"less",
"sass",
"scss",
"svelte",
"pug",
"typescriptreact",
"vue",
},
-- Read more about this options in the [vscode docs](https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration).
-- **Note:** only the options listed in the table are supported.
init_options = {
--- @type string[]
excludeLanguages = {},
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/preferences/)
preferences = {},
--- @type boolean Defaults to `true`
showAbbreviationSuggestions = true,
--- @type "always" | "never" Defaults to `"always"`
showExpandedAbbreviation = "always",
--- @type boolean Defaults to `false`
showSuggestionsAsSnippets = false,
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/syntax-profiles/)
syntaxProfiles = {},
--- @type table<string, string> [Emmet Docs](https://docs.emmet.io/customization/snippets/#variables)
variables = {},
},
},
},
setup = {
eslint = function()
require("lazyvim.util").lsp.on_attach(function(client)
if client.name == "eslint" then
client.server_capabilities.documentFormattingProvider = true
elseif client.name == "ts_ls" then
client.server_capabilities.documentFormattingProvider = false
end
end)
end,
tailwindcss = function(_, opts)
-- local tw = require("lspconfig.server_configurations.tailwindcss")
-- --- @param ft string
-- opts.filetypes = vim.tbl_filter(function(ft)
-- return not vim.tbl_contains(opts.filetypes_exclude or {}, ft)
-- end, tw.default_config.filetypes)
end,
},
},
}