From 8c72f9ac9b90bd468435a0840f031022caf35a63 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Fri, 26 Apr 2024 07:53:01 -0300 Subject: [PATCH] neovim: add svelte support --- programs/neovim/default.nix | 3 +++ programs/neovim/lua/plugins/astrolsp.lua | 24 +++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/programs/neovim/default.nix b/programs/neovim/default.nix index d07bf62..914766a 100644 --- a/programs/neovim/default.nix +++ b/programs/neovim/default.nix @@ -46,6 +46,9 @@ # Vue nodePackages.volar + # Svelte + nodePackages.svelte-language-server + # YAML yaml-language-server ]; diff --git a/programs/neovim/lua/plugins/astrolsp.lua b/programs/neovim/lua/plugins/astrolsp.lua index 8d46b40..c44e4fb 100644 --- a/programs/neovim/lua/plugins/astrolsp.lua +++ b/programs/neovim/lua/plugins/astrolsp.lua @@ -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,