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 # Vue
nodePackages.volar nodePackages.volar
# Svelte
nodePackages.svelte-language-server
# YAML # YAML
yaml-language-server yaml-language-server
]; ];

View file

@ -10,16 +10,16 @@ return {
opts = { opts = {
-- Configuration table of features provided by AstroLSP -- Configuration table of features provided by AstroLSP
features = { features = {
autoformat = true, -- enable or disable auto formatting on start autoformat = true, -- enable or disable auto formatting on start
codelens = true, -- enable/disable codelens refresh on start codelens = true, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting semantic_tokens = true, -- enable/disable semantic token highlighting
}, },
-- customize lsp formatting options -- customize lsp formatting options
formatting = { formatting = {
-- control auto formatting on save -- control auto formatting on save
format_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 allow_filetypes = { -- enable format on save for specified filetypes only
-- "go", -- "go",
"javascript", "javascript",
@ -56,6 +56,7 @@ return {
"marksman", "marksman",
"nil_ls", "nil_ls",
"rust_analyzer", "rust_analyzer",
"svelte",
"taplo", "taplo",
"tsserver", "tsserver",
"volar", "volar",
@ -91,19 +92,28 @@ return {
event = { "CursorHold", "CursorHoldI" }, event = { "CursorHold", "CursorHoldI" },
-- the rest of the autocmd options (:h nvim_create_autocmd) -- the rest of the autocmd options (:h nvim_create_autocmd)
desc = "Document Highlighting", desc = "Document Highlighting",
callback = function() vim.lsp.buf.document_highlight() end, callback = function()
vim.lsp.buf.document_highlight()
end,
}, },
{ {
event = { "CursorMoved", "CursorMovedI", "BufLeave" }, event = { "CursorMoved", "CursorMovedI", "BufLeave" },
desc = "Document Highlighting Clear", 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 to be set up on attaching of a language server
mappings = { mappings = {
n = { 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 -- 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 = { -- gD = {
-- function() vim.lsp.buf.declaration() end, -- function() vim.lsp.buf.declaration() end,