This patch adds support for opening jdt:// links on "go to definition" requests returned by Java language servers.
Co-authored-by: w0rp <devw0rp@gmail.com>
According to
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocument_codeAction,
the response to textDocument/codeAction is:
(Command | CodeAction)[] | null
and the code only handled the case where it was a CodeAction that either
specified an edit or a command, but didn't handle a direct Command.
Note that the specification also says that both can be specified and
then the edit is applied first, then the command. Furthermore, there
seems to be some hacky code handling arguments directly, which I suspect
is non-standard and only works with a specific LSP server that happens
to pass the edits in the arguments unmodified.
It is easier to explain this fix with an example:
* tsserver and LSPs ask for error information when you want to fix
error. tsserver `ts@getCodeFixes` command needs tsserver error code.
* now let's imagine that user has eslint and tsserver in use. Sometimes
both can report same error in different way.
* Now there is no guarantee which error will come first and if eslint
error comes first then tsserver will not return code fixes as we are
passing wrong error code to it.
This fix will return proper error code based on linter.
* Added tsserver and LSP code action support.
* tsserver refactors support added.
* Handling special case when new text is added after new line symbol.
* ale#code_action#ApplyChanges simplified.
* Initial attempt on LSP Code Actions.
* workspace/executeCommand added.
* Some null checks added.
* Add last column to LSP Code Action message.
* Pass diagnostics to LSP code action.
Previously ApplyChanges code was applied from top-to-bottom that required
extra parameters to track progress and there was bug. I have changed code
to bottom-to-top approach as that does not require those extra parameters
and solved the bug.
Tested with typescript-language-server and it is working.