mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +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
|
- Add global function `nvf_lint` under
|
||||||
`vim.diagnostics.nvim-lint.lint_function`.
|
`vim.diagnostics.nvim-lint.lint_function`.
|
||||||
- Deprecate `vim.scrollOffset` in favor of `vim.options.scrolloff`.
|
- 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):
|
[Sc3l3t0n](https://github.com/Sc3l3t0n):
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,20 @@
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.svelte.setup {
|
lspconfig.svelte.setup {
|
||||||
capabilities = capabilities;
|
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 = ${
|
cmd = ${
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
then expToLua cfg.lsp.package
|
then expToLua cfg.lsp.package
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue