Description
Describe the bug
When using the TypeScript Native Preview extension in VS Code, hovering over Effect.succeed
or Effect.fail
functions imported from the effect
library triggers an InternalError
related to textDocument/hover
.
The full error message displayed is:
Finishing updateGraph: Project: d:/Documentos/hello-effect/tsconfig.json version: 3 in 38.7761ms
panic handling request textDocument/hover Unhandled case in Node.Text: *ast.JSDocLink goroutine 4392 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:26 +0x5e
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1.1()
github.com/microsoft/typescript-go/internal/lsp/server.go:359 +0x5d
panic({0x74ee20?, 0xc007afe7f0?})
runtime/panic.go:792 +0x132
github.com/microsoft/typescript-go/internal/ast.(*Node).Text(0xc007183cc0?)
github.com/microsoft/typescript-go/internal/ast/ast.go:313 +0x34d
github.com/microsoft/typescript-go/internal/ls.writeComments(0xc0077c7d70, {0xc0053cad40, 0x3, 0xa570d8?})
github.com/microsoft/typescript-go/internal/ls/hover.go:401 +0x99
github.com/microsoft/typescript-go/internal/ls.formatQuickInfoAndJSDoc({0xc00812fe60, 0x90}, 0xc004873470)
github.com/microsoft/typescript-go/internal/ls/hover.go:298 +0x77e
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideHover(0xc007a8d620, {0xa60dd0, 0xc007186000}, {0xc004cf0800?, 0x610a1c?}, {0x4fcb080?, 0xc0?})
github.com/microsoft/typescript-go/internal/ls/hover.go:36 +0x125
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleHover(0xc0000bedc0, {0xa60dd0, 0xc007186000}, 0xc007f73b00)
github.com/microsoft/typescript-go/internal/lsp/server.go:650 +0xcd
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0x8?, {0xa60dd0?, 0xc007186000?}, 0xc007d43220?)
github.com/microsoft/typescript-go/internal/lsp/server.go:484 +0x19e
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()
github.com/microsoft/typescript-go/internal/lsp/server.go:372 +0x75
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 9
github.com/microsoft/typescript-go/internal/lsp/server.go:390 +0x4d2
Request textDocument/hover failed.
Message: InternalError: panic handling request textDocument/hover: Unhandled case in Node.Text: *ast.JSDocLink
Code: -32603
This suggests an issue with how the language server handles specific AST nodes, possibly related to JSDoc links or complex type definitions within the effect
library's type declarations, when processing hover requests.
To Reproduce
Steps to reproduce the behavior:
-
Ensure the TypeScript Native Preview extension is enabled in VS Code.
-
Open an empty directory in VS Code.
-
Initialize a new npm project:
npm init -y
-
Install TypeScript:
npm install --save-dev typescript
-
Initialize a TypeScript configuration file:
npm tsc --init
-
Create a new TypeScript file (e.g.,
test.ts
). -
Install the
effect
library:npm install effect
-
Paste the following code into
test.ts
:import { Effect } from "effect"; interface User { readonly id: number; readonly name: string; } const getUser = (userId: number): Effect.Effect<User, Error> => { const userDatabase: Record<number, User> = { 1: { id: 1, name: "John Doe" }, 2: { id: 2, name: "Jane Smith" }, }; const user = userDatabase[userId]; if (user) { return Effect.succeed(user); // <--- Hover here } else { return Effect.fail(new Error("User not found")); // <--- Or hover here } }; const exampleUserEffect = getUser(1);
-
Hover your mouse cursor over
Effect.succeed
orEffect.fail
within thegetUser
function.
Expected behavior
When hovering over Effect.succeed
or Effect.fail
, a standard hover tooltip should appear, displaying the type signature and JSDoc documentation for the respective function, without any errors.
Actual behavior
An error notification pops up in VS Code with the message:
Environment
- VS Code Insiders Version: 1.102.0-insider
- TypeScript Native Preview Extension Version: 0.20250630.1
- Operating System: Windows 11
- Node.js Version: 22.14.0
effect
library version: 3.16.10