This prevents code-actions from working on editors which expect returned version number to be >= of what was sent to the LS.
tsserver
sends same version back and code-actions work just fine.
https://github.com/neovim/neovim/blob/c1fbc2ddf15b2f44b615f90b2511349ab974cb83/runtime/lua/vim/lsp/util.lua#L265-L272
Here's code from neovim-lsp
that checks version number.
Will edit more information when I find the differences between svelteserver
and tsserver
regarding sending version number.
Edit: For now these don't work:
Code Actions:
1. (svelte) Disable missing-declaration for this line
2. Import 'teenStyle' from module "./helpers"
Probably this line needs to get the correct version https://github.com/sveltejs/language-tools/blob/eac5c7478aebe949bb4337126f38a45b46be8c10/packages/language-server/src/plugins/typescript/features/CodeActionsProvider.ts#L146
For Svelte files this should be doable, for TS / JS files however we should leave it as currently because we simply do not know what to set it to since we don't get the current document versions of those.
For Svelte files this should be doable, for TS / JS files however we should leave it as currently because we simply do not know what to set it to since we don't get the current document versions of those.
Do you mean the situation when we need to apply changes to external js/ts files due to code-action in svelte component?
Can't think of an example right now. :thinking:
It is interesting, I haven't tested what would happen if I use rename in .ts
file. Would that change be reflected in svelte components... :thinking:
Brb. :smile:
Wow... it won't. So it looks like svelte language server should be configured for .ts|.js
files in svelte projects too ?
It does not and making this possible is tracked in #580
Renames in Svelte files that affects JS files are an example of where the language server returns edits for JS/TS files.
For Svelte files this should be doable, for TS / JS files however we should leave it as currently because we simply do not know what to set it to since we don't get the current document versions of those.
In the spec the textDocument
of the TextDocumentEdit
is a OptionalVersionedTextDocumentIdentifier
, so the version can be null
, and it should be null
instead of 0 if the server cannot provide the correct version number.