Comments (11)
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.
from typescript-language-server.
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.
from typescript-language-server.
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 1.85.1
, and did S-C-p -> Source Action
. It did not break. But my understanding is that VSCode doesn't use typescript-language-server
, but rather taps into tsserver
directly. Am I wrong? I searched through the tsserver log, but I couldn't find textDocument/codeAction
there (it's over 60k lines long, can't even upload it).
VSCode seems to be using typescript 5.3.2
while emacs/eglot are using 5.3.3
. Don't know if that makes any difference.
VSCode:
Version: 1.85.1
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:47:11.635Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.6.8
from typescript-language-server.
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.
from typescript-language-server.
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.
from typescript-language-server.
I'm missing your dependencies and other project configuration but with that file the InlayHints request fails with:
{
"code": 1,
"message": "<semantic> TypeScript Server Error (5.3.3)\nDebug Failure. Unexpected node.\r\nNode ObjectBindingPattern was unexpected.\nError: Debug Failure. Unexpected node.\r\nNode ObjectBindingPattern was unexpected.\n at visitForDisplayParts (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:165383:17)\n at visitForDisplayParts (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:165188:11)\n at /usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:165391:9\n at Array.forEach (<anonymous>)\n at visitDisplayPartList (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:165387:13)\n at visitForDisplayParts (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:165340:11)\n at typeToInlayHintParts (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:165113:5)\n at visitVariableLikeDeclaration (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:164921:23)\n at visitor (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:164843:7)\n at visitNodes (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:30235:22)\n at forEachChildInVariableDeclarationList (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:30454:12)\n at forEachChild (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:30744:35)\n at visitor (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:164858:12)\n at visitNode2 (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:30227:18)\n at forEachChildInVariableStatement (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:30451:59)\n at forEachChild (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:30744:35)\n at visitor (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:164858:12)\n at visitNodes (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:30235:22)\n at forEachChildInSourceFile (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:30448:12)\n at forEachChild (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:30744:35)\n at visitor (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:164858:12)\n at Object.provideInlayHints (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:164819:3)\n at Object.provideInlayHints2 [as provideInlayHints] (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:145844:34)\n at IpcIOSession.provideInlayHints (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:184197:48)\n at provideInlayHints (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:183356:43)\n at /usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:185375:69\n at IpcIOSession.executeWithRequestId (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:185367:14)\n at IpcIOSession.executeCommand (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:185375:29)\n at IpcIOSession.onMessage (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:185417:51)\n at process.<anonymous> (/usr/local/workspace/github/typescript-language-server/node_modules/typescript/lib/tsserver.js:186999:14)\n at process.emit (node:events:514:28)\n at emit (node:internal/child_process:937:14)\n at process.processTicksAndRejections (node:internal/process/task_queues:83:21)"
}
Not sure how related it is but it's still something for typescript
to handle.
from typescript-language-server.
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.
Yeah, I noticed that too. Anyway it already happened 😝
from typescript-language-server.
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 added typescript version 5.3.3
to VSCode, but that didn't change, it still works. But I don't know how reliable that is, because VSCode sends
{
"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?
from typescript-language-server.
Note that the jsx
files should use javascriptreact
language ID in didOpen notification. Typescript has JSX (and TSX) specific logic in some cases so it needs to know the correct language ID for proper functioning.
from typescript-language-server.
I have reproduced your error by hardcoding the parameters in the textDocument/codeAction
request to the same ones that your editor sends.
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 params.context.diagnostics
property:
{
"jsonrpc": "2.0",
"id": 6,
"method": "textDocument/codeAction",
"params": {
"textDocument": {
"uri": "file:///home/db/.local/share/git/gaia/client/platform/web/src/ui/Component/File/Hotspot.jsx"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 0
}
},
"context": {
"diagnostics": <INCLUDES ALL DIAGNOSTICS HERE>
}
}
}
while the expected behavior is that the editor only includes diagnostics that overlap the params.range
range.
The typescript error Bad error code, 7044 not found in range 592..592
seems to imply that it didn't find the 7044
diagnostic (which is one of those provided in the request) in the current range.
So it looks like an LSP client bug.
from typescript-language-server.
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)[];
from typescript-language-server.
Related Issues (20)
- Use diagnostic range when requesting `getCodeFixes` HOT 4
- checkJs on not respected with declaration files HOT 2
- Completion items have incorrect "kind" HOT 6
- Typescript Server Error when `includeInlayVariableTypeHints = true` and an arrow function is made. HOT 1
- Deprecated property not marked as such HOT 3
- problems with `interface` structure HOT 3
- How to Disable "Move to a new file" action? HOT 2
- typescript server error when using 'inlay hints' (Unexpected node.^M) HOT 1
- Debug Failure. Unexpected node. HOT 5
- env: node: No such file or directory on MacOS HOT 3
- SyntaxError: Unexpected token import HOT 1
- importModuleSpecifierEnding is not respected HOT 1
- Unable to initialize, language server cannot read properties of undefined (reading 'workspace') HOT 1
- Add Semantic Tokens for Template Literal Strings HOT 1
- Ignore typescript type errors in `.js` / `.jsx` files HOT 3
- neovide GUI "env: node: No such file or directory HOT 1
- Is it possible to filter build-in types? HOT 1
- Does not format .tsx files HOT 4
- suggest autocompletion that script in node_module only HOT 5
- Server initialization failed with "command '_typescript.applyWorkspaceEdit' already exists" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript-language-server.