mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-05 18:01:32 +00:00
languages/svelte: fix svelte-language-server not reloading types on .ts/.js files change
This commit is contained in:
parent
0383311826
commit
b88d2418e0
2 changed files with 15 additions and 1 deletions
|
@ -319,6 +319,7 @@
|
|||
- Add global function `nvf_lint` under
|
||||
`vim.diagnostics.nvim-lint.lint_function`.
|
||||
- Deprecate `vim.scrollOffset` in favor of `vim.options.scrolloff`.
|
||||
- Fix `svelte-language-server` not reloading TS/JS files on change.
|
||||
|
||||
[Sc3l3t0n](https://github.com/Sc3l3t0n):
|
||||
|
||||
|
|
|
@ -22,7 +22,20 @@
|
|||
lspConfig = ''
|
||||
lspconfig.svelte.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = attach_keymaps,
|
||||
on_attach = function(client, bufnr)
|
||||
-- Workaround to trigger reloading JS/TS files
|
||||
-- See https://github.com/sveltejs/language-tools/issues/2008
|
||||
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,
|
||||
})
|
||||
|
||||
attach_keymaps(client, bufnr)
|
||||
end,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue