From e0a0123b1869cbb910f28582d345ca0e6287eb55 Mon Sep 17 00:00:00 2001 From: Daniel Mata <100956688+matadaniel@users.noreply.github.com> Date: Wed, 5 Jun 2024 13:28:23 -0500 Subject: [PATCH] fix(svelte): added organize imports and prettier (#3466) * feat(svelte): add key binding for organize imports * fix(svelte): solves sveltejs/language-tools#2008 * feat(svelte): add formatter for svelte --- lua/lazyvim/plugins/extras/lang/svelte.lua | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/svelte.lua b/lua/lazyvim/plugins/extras/lang/svelte.lua index 4319b509..cf824dda 100644 --- a/lua/lazyvim/plugins/extras/lang/svelte.lua +++ b/lua/lazyvim/plugins/extras/lang/svelte.lua @@ -27,7 +27,28 @@ return { "neovim/nvim-lspconfig", opts = { servers = { - svelte = {}, + svelte = { + keys = { + { + "co", + function() + vim.lsp.buf.code_action({ + apply = true, + context = { + only = { "source.organizeImports" }, + diagnostics = {}, + }, + }) + end, + desc = "Organize Imports", + }, + }, + capabilities = { + workspace = { + didChangeWatchedFiles = vim.fn.has("nvim-0.10") == 0 and { dynamicRegistration = true }, + }, + }, + }, }, }, }, @@ -45,4 +66,14 @@ return { }) end, }, + + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + ["svelte"] = { "prettier" }, + }, + }, + }, }