-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server crashed when asking for textDocument/codeAction #844
Comments
This looks like a typescript problem and ideally we'd have a reproduction and report it there. If you have vscode then you could try the same file there to verify that. |
Hello, I opened the same JSX file in vscode VSCode seems to be using typescript VSCode:
|
VSCode doesn't use this server but the underlaying code is very similar since this server is based on vscode's code, with LSP layer added. So usually low-level issues like that reproduce the same. You can make VSCode use different version of typescript by clicking on its status field. You would ideally install 5.3.3 in your project and then switch it to use project version. |
And note that you've shared the source code of that file in the log since LSP logs include it when opening the file. So if you don't want to share it, you might want to remove that pastebin. I've downloaded it locally already so I can try to see if I can reproduce with just that file when I have some time. |
I'm missing your dependencies and other project configuration but with that file the InlayHints request fails with:
Not sure how related it is but it's still something for |
Yeah, I noticed that too. Anyway it already happened 😝 |
I added typescript version {
"seq": 19,
"type": "request",
"command": "getApplicableRefactors",
"arguments": {
"file": "/home/db/.local/share/git/gaia/client/platform/web/src/ui/Component/File/Hotspot.jsx",
"startLine": 14,
"startOffset": 27,
"endLine": 14,
"endOffset": 27,
"triggerReason": "implicit",
"includeInteractiveActions": true
}
} which is not the same request I send from eglot. Any other ideas on how to reproduce this? |
Note that the |
I have reproduced your error by hardcoding the parameters in the I believe the reason for that error might be that your editor doesn't quite follow the expected LSP behavior (which I'm not sure if is very precisely specified). Your editor is sending all file diagnostics in the
while the expected behavior is that the editor only includes diagnostics that overlap the The typescript error So it looks like an LSP client bug. |
That is actually precisely specified: export interface [CodeActionContext](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeActionContext) {
/**
* An array of diagnostics known on the client side overlapping the range
* provided to the `textDocument/codeAction` request. They are provided so
* that the server knows which errors are currently presented to the user
* for the given range. There is no guarantee that these accurately reflect
* the error state of the resource. The primary parameter
* to compute code actions is the provided range.
*/
diagnostics: [Diagnostic](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnostic)[]; |
Thanks @rchl for the investigation. I fixed it on my clients side, this was a combination of many factors like a missing complete error reproduction recipe (which I've now described back in the original issue). In certain combinations (invoking certain code actions with the cursor over whitespace, the Eglot client does send too many diagnostics). The server doesn't always error though, and when it does, it's impossible to make out what that long message and JS backtrace means. So, many thanks for having done that crucial part. I think this can be closed. |
Hello,
I'm using
typescript-language-server
version4.1.2
(but I also tried this with4.2.0
) and I'm running into the following error when atextDocument/codeAction
request:I'm using the server on NixOS in Emacs, using the Eglot package. I also reported this error to eglot here. But they suggested this is an error with
typescript-language-server
or eventypescript
itself.Full log of client/server interaction: https://pastebin.com/kwVWdTuf
Using:
typescript-language-server 4.1.2
(but also tested with4.2.0
)typescript 5.3.3
(bundled)node v.18.19.0
I can't share the JSX file I created this error with publicly, but I can send it to someone via email in an effort to help debugging this.
Thanks.
The text was updated successfully, but these errors were encountered: