neovim: add svelte support

This commit is contained in:
Alexandre Cavalheiro 2024-04-26 07:53:01 -03:00
parent 077ce16f56
commit 8c72f9ac9b
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
2 changed files with 20 additions and 7 deletions

View file

@ -46,6 +46,9 @@
# Vue
nodePackages.volar
# Svelte
nodePackages.svelte-language-server
# YAML
yaml-language-server
];

View file

@ -10,16 +10,16 @@ return {
opts = {
-- Configuration table of features provided by AstroLSP
features = {
autoformat = true, -- enable or disable auto formatting on start
codelens = true, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start
autoformat = true, -- enable or disable auto formatting on start
codelens = true, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting
},
-- customize lsp formatting options
formatting = {
-- control auto formatting on save
format_on_save = {
enabled = true, -- enable or disable format on save globally
enabled = true, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only
-- "go",
"javascript",
@ -56,6 +56,7 @@ return {
"marksman",
"nil_ls",
"rust_analyzer",
"svelte",
"taplo",
"tsserver",
"volar",
@ -91,19 +92,28 @@ return {
event = { "CursorHold", "CursorHoldI" },
-- the rest of the autocmd options (:h nvim_create_autocmd)
desc = "Document Highlighting",
callback = function() vim.lsp.buf.document_highlight() end,
callback = function()
vim.lsp.buf.document_highlight()
end,
},
{
event = { "CursorMoved", "CursorMovedI", "BufLeave" },
desc = "Document Highlighting Clear",
callback = function() vim.lsp.buf.clear_references() end,
callback = function()
vim.lsp.buf.clear_references()
end,
},
},
},
-- mappings to be set up on attaching of a language server
mappings = {
n = {
gl = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" },
gl = {
function()
vim.diagnostic.open_float()
end,
desc = "Hover diagnostics",
},
-- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean
-- gD = {
-- function() vim.lsp.buf.declaration() end,