add svelte to lspconfig

This commit is contained in:
2026-06-11 10:13:21 -07:00
parent 05dfddd04b
commit 5f01172523
2 changed files with 28 additions and 6 deletions
+1 -1
View File
@@ -17,7 +17,7 @@
"gitsigns.nvim": { "branch": "main", "commit": "25050e4ed39e628282831d4cbecb1850454ce915" }, "gitsigns.nvim": { "branch": "main", "commit": "25050e4ed39e628282831d4cbecb1850454ce915" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" }, "lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" },
"mini.icons": { "branch": "main", "commit": "520995f1d75da0e4cc901ee95080b1ff2bc46b94" }, "mini.icons": { "branch": "main", "commit": "284509648db084c5e40a31afa9abb9887c49e04a" },
"neogen": { "branch": "main", "commit": "23e7e9f883d01289ebd90e98025acc860ea26366" }, "neogen": { "branch": "main", "commit": "23e7e9f883d01289ebd90e98025acc860ea26366" },
"nightfox.nvim": { "branch": "main", "commit": "26b61b1f856ec37cae3cb64f5690adb955f246a1" }, "nightfox.nvim": { "branch": "main", "commit": "26b61b1f856ec37cae3cb64f5690adb955f246a1" },
"none-ls-extras.nvim": { "branch": "main", "commit": "27681d797a26f1b4d6119296df42f5204c88a2dc" }, "none-ls-extras.nvim": { "branch": "main", "commit": "27681d797a26f1b4d6119296df42f5204c88a2dc" },
+25 -3
View File
@@ -104,6 +104,31 @@ return {
} }
}) })
vim.lsp.config("svelte", {
settings = {
svelte = {
plugin = {
svelte = {
diagnostics = { enable = true },
format = { enable = true },
},
},
},
},
on_attach = function(client, bufnr)
-- svelte LS needs to be told when .js/.ts files change
-- so it can update component prop types
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = { "*.js", "*.ts" },
group = vim.api.nvim_create_augroup("svelte_ondidchangetsorjsfile", { clear = true }),
callback = function(ctx)
client:notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
end,
})
end,
})
vim.lsp.config("rust_analyzer", { vim.lsp.config("rust_analyzer", {
settings = { settings = {
["rust-analyzer"] = { ["rust-analyzer"] = {
@@ -201,15 +226,12 @@ return {
--capabilities.offsetEncoding = { "utf-16" } --capabilities.offsetEncoding = { "utf-16" }
local eslint_format = require("none-ls.formatting.eslint_d").with({ local eslint_format = require("none-ls.formatting.eslint_d").with({
extra_filetypes = { "svelte" },
}) })
local eslint_diag = require("none-ls.diagnostics.eslint_d").with({ local eslint_diag = require("none-ls.diagnostics.eslint_d").with({
extra_filetypes = { "svelte" },
}) })
local eslint_code_actions = require("none-ls.code_actions.eslint_d").with({ local eslint_code_actions = require("none-ls.code_actions.eslint_d").with({
extra_filetypes = { "svelte" },
}) })
null_ls.setup { null_ls.setup {