From 98892b75ad0bbe37fe2bbf15b0356457d34bd26c Mon Sep 17 00:00:00 2001 From: josean-dev Date: Sun, 17 Sep 2023 02:32:52 -0400 Subject: [PATCH] Added autocmd for svelte lsp to fix problem with ts file changes --- .../nvim/lua/josean/plugins/lsp/lspconfig.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.config/nvim/lua/josean/plugins/lsp/lspconfig.lua b/.config/nvim/lua/josean/plugins/lsp/lspconfig.lua index a819e96..618a0ab 100644 --- a/.config/nvim/lua/josean/plugins/lsp/lspconfig.lua +++ b/.config/nvim/lua/josean/plugins/lsp/lspconfig.lua @@ -78,8 +78,8 @@ return { -- configure typescript server with plugin lspconfig["tsserver"].setup({ - capabilities = capabilities, - on_attach = on_attach, + capabilities = capabilities, + on_attach = on_attach, }) -- configure css server @@ -97,7 +97,18 @@ return { -- configure svelte server lspconfig["svelte"].setup({ capabilities = capabilities, - on_attach = on_attach, + on_attach = function(client, bufnr) + on_attach(client, bufnr) + + vim.api.nvim_create_autocmd("BufWritePost", { + pattern = { "*.js", "*.ts" }, + callback = function(ctx) + if client.name == "svelte" then + client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file }) + end + end, + }) + end, }) -- configure prisma orm server