languages/svelte: fix svelte-language-server not reloading .js/.ts files on change

This commit is contained in:
rice-cracker-dev 2025-08-21 18:47:09 +07:00
commit 1f65e589bf
2 changed files with 10 additions and 1 deletions

View file

@ -33,6 +33,15 @@
'';
on_attach = mkLuaInline ''
function(client, bufnr)
vim.api.nvim_create_autocmd('BufWritePost', {
pattern = { '*.js', '*.ts' },
group = vim.api.nvim_create_augroup('svelte_js_ts_file_watch', {}),
callback = function(ctx)
-- internal API to sync changes that have not yet been saved to the file system
client:notify('$/onDidChangeTsOrJsFile', { uri = ctx.match })
end,
})
vim.api.nvim_buf_create_user_command(bufnr, 'LspMigrateToSvelte5', function()
client:exec_cmd({
command = 'migrate_to_svelte_5',