denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.9k stars 5.22k forks source link

Bug: LSP errors in VSCode opening built-in Typescript/Deno `d.ts` files #24608

Closed csvn closed 1 month ago

csvn commented 1 month ago

I'm having LSP issues in VSCode, where I get a ton of LSP errors when navigating to builtin types in VSCode, e.g. asset:///lib.deno.ns.d.ts, asset:///lib.es5.d.ts etc. The errors shown in VSCode indicate that these asset files cannot be found.

[Error - 9:02:02 PM] Request textDocument/inlayHint failed.
  Message: Unable to find asset or document for: asset://lib.es2015.iterable.d.ts
  Code: -32602 

I'm wondering if this is something that might be unique to my machine, since it's very easy to reproduce. I just need to "Go to definition" for a anything related to "lib" in TS. Is there some way to verify if this works for others or if it's something that's broken in the installation on my machine?

I've attached the output in VSCode for "Deno Language Server" as well as a LSP log when I open a couple of built-in d.ts files. Any help would be appriecated.

Reproduction

Before these steps, I tried to re-install Deno, Deno VSCode extension, clear out cached files, etc. But I can still reproduce these errors easily in existing projects or via the steps below:

  1. Create a new folder and run deno init
  2. Replace contents of main.ts with:
    Deno.open;
    [].map;
  3. "Go to definition" on the open and map methods
  4. Alerts are produced from the "Deno Language Servers" with errors related to d.ts files for these native types

Environment

Windows: 11 Deno: 1.45.2 VSCode: 1.91.1 VSCode extension denoland.vscode-deno: 3.38.0

Details

deno-lsp-log.log

Screenshots ![image](https://github.com/user-attachments/assets/c6552fb2-be7e-40b1-a74a-c9f29ecce115) ![image](https://github.com/user-attachments/assets/34b2499a-cfe1-462e-886d-9b9f3652502a)
Deno Language Server Output ``` Starting Deno language server... version: 1.45.2 (release, x86_64-pc-windows-msvc) executable: C:\Users\c\AppData\Local\Microsoft\WinGet\Packages\DenoLand.Deno_Microsoft.Winget.Source_abcd1234\deno.EXE Connected to "Visual Studio Code" 1.91.1 Refreshing configuration tree... Resolved Deno configuration file: "file:///C:/Users/c/deno-test/deno.json" Server ready. Unable to get document highlights from TypeScript: tsc error: Error: Could not find source file: 'asset:///lib.deno.ns.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getDocumentHighlights (ext:deno_tsc/00_typescript.js:149493:24) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [25, "getDocumentHighlights", ["asset:///lib.deno.ns.d.ts",60408,["asset:///lib.deno.ns.d.ts"]], null, null] [Error - 8:46:14 PM] Request textDocument/documentHighlight failed. Message: Internal error Code: -32603 Failed to request to tsserver tsc error: Error: Could not find source file: 'asset:///lib.deno.ns.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getEncodedSemanticClassifications3 [as getEncodedSemanticClassifications] (ext:deno_tsc/00_typescript.js:149615:77) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [26, "getEncodedSemanticClassifications", ["asset:///lib.deno.ns.d.ts",{"start":0,"length":218556},"2020"], null, null] [Error - 8:46:14 PM] Request textDocument/semanticTokens/full failed. Message: Invalid request Code: -32600 Unable to get inlay hints: tsc error: Error: Could not find source file: 'asset:///lib.deno.ns.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.provideInlayHints2 [as provideInlayHints] (ext:deno_tsc/00_typescript.js:150139:24) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [27, "provideInlayHints", ["asset:///lib.deno.ns.d.ts",{"start":58592,"length":3634},{"quotePreference":"single","includeCompletionsForModuleExports":true,"includeCompletionsForImportStatements":true,"includeCompletionsWithSnippetText":true,"includeAutomaticOptionalChainCompletions":true,"includeCompletionsWithInsertText":true,"includeCompletionsWithClassMemberSnippets":true,"includeCompletionsWithObjectLiteralMethodSnippets":true,"useLabelDetailsInCompletionEntries":true,"allowIncompleteCompletions":true,"importModuleSpecifierPreference":"shortest","importModuleSpecifierEnding":"index","allowTextChangesInNewFiles":false,"providePrefixAndSuffixTextForRename":false,"provideRefactorNotApplicableReason":true,"jsxAttributeCompletionStyle":"auto","includeInlayParameterNameHints":"all","includeInlayParameterNameHintsWhenArgumentMatchesName":false,"includeInlayFunctionParameterTypeHints":true,"includeInlayVariableTypeHints":true,"includeInlayVariableTypeHintsWhenTypeMatchesName":false,"includeInlayPropertyDeclarationTypeHints":true,"includeInlayFunctionLikeReturnTypeHints":true,"includeInlayEnumMemberValueHints":false,"autoImportFileExcludePatterns":[]}], null, null] [Error - 8:46:14 PM] Request textDocument/inlayHint failed. Message: Internal error Code: -32603 Failed to request to tsserver tsc error: Error: Could not find source file: 'asset:///lib.deno.ns.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getEncodedSemanticClassifications3 [as getEncodedSemanticClassifications] (ext:deno_tsc/00_typescript.js:149615:77) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [30, "getEncodedSemanticClassifications", ["asset:///lib.deno.ns.d.ts",{"start":59439,"length":1932},"2020"], null, null] [Error - 8:46:14 PM] Request textDocument/semanticTokens/range failed. Message: Invalid request Code: -32600 Unable to get document highlights from TypeScript: tsc error: Error: Could not find source file: 'asset:///lib.deno.ns.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getDocumentHighlights (ext:deno_tsc/00_typescript.js:149493:24) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [32, "getDocumentHighlights", ["asset:///lib.deno.ns.d.ts",60408,["asset:///lib.deno.ns.d.ts"]], null, null] [Error - 8:46:16 PM] Request textDocument/documentHighlight failed. Message: Internal error Code: -32603 Failed to request to tsserver tsc error: Error: Could not find source file: 'asset:///lib.es5.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getEncodedSemanticClassifications3 [as getEncodedSemanticClassifications] (ext:deno_tsc/00_typescript.js:149615:77) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [42, "getEncodedSemanticClassifications", ["asset:///lib.es5.d.ts",{"start":0,"length":215130},"2020"], null, null] [Error - 8:46:17 PM] Request textDocument/semanticTokens/full failed. Message: Invalid request Code: -32600 Unable to get inlay hints: tsc error: Error: Could not find source file: 'asset:///lib.es5.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.provideInlayHints2 [as provideInlayHints] (ext:deno_tsc/00_typescript.js:150139:24) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [44, "provideInlayHints", ["asset:///lib.es5.d.ts",{"start":61228,"length":8990},{"quotePreference":"single","includeCompletionsForModuleExports":true,"includeCompletionsForImportStatements":true,"includeCompletionsWithSnippetText":true,"includeAutomaticOptionalChainCompletions":true,"includeCompletionsWithInsertText":true,"includeCompletionsWithClassMemberSnippets":true,"includeCompletionsWithObjectLiteralMethodSnippets":true,"useLabelDetailsInCompletionEntries":true,"allowIncompleteCompletions":true,"importModuleSpecifierPreference":"shortest","importModuleSpecifierEnding":"index","allowTextChangesInNewFiles":false,"providePrefixAndSuffixTextForRename":false,"provideRefactorNotApplicableReason":true,"jsxAttributeCompletionStyle":"auto","includeInlayParameterNameHints":"all","includeInlayParameterNameHintsWhenArgumentMatchesName":false,"includeInlayFunctionParameterTypeHints":true,"includeInlayVariableTypeHints":true,"includeInlayVariableTypeHintsWhenTypeMatchesName":false,"includeInlayPropertyDeclarationTypeHints":true,"includeInlayFunctionLikeReturnTypeHints":true,"includeInlayEnumMemberValueHints":false,"autoImportFileExcludePatterns":[]}], null, null] [Error - 8:46:17 PM] Request textDocument/inlayHint failed. Message: Internal error Code: -32603 Failed to request to tsserver tsc error: Error: Could not find source file: 'asset:///lib.es5.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getEncodedSemanticClassifications3 [as getEncodedSemanticClassifications] (ext:deno_tsc/00_typescript.js:149615:77) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [46, "getEncodedSemanticClassifications", ["asset:///lib.es5.d.ts",{"start":63035,"length":5682},"2020"], null, null] [Error - 8:46:17 PM] Request textDocument/semanticTokens/range failed. Message: Invalid request Code: -32600 Unable to get quick info: tsc error: Error: Could not find source file: 'asset:///lib.es5.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getQuickInfoAtPosition (ext:deno_tsc/00_typescript.js:149394:24) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [47, "getQuickInfoAtPosition", ["asset:///lib.es5.d.ts",64662], null, null] [Error - 8:46:18 PM] Request textDocument/hover failed. Message: Internal error Code: -32603 Unable to get quick info: tsc error: Error: Could not find source file: 'asset:///lib.es5.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getQuickInfoAtPosition (ext:deno_tsc/00_typescript.js:149394:24) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [48, "getQuickInfoAtPosition", ["asset:///lib.es5.d.ts",64659], null, null] [Error - 8:46:19 PM] Request textDocument/hover failed. Message: Internal error Code: -32603 Unable to get quick info: tsc error: Error: Could not find source file: 'asset:///lib.es5.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getQuickInfoAtPosition (ext:deno_tsc/00_typescript.js:149394:24) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [49, "getQuickInfoAtPosition", ["asset:///lib.es5.d.ts",64658], null, null] [Error - 8:46:20 PM] Request textDocument/hover failed. Message: Internal error Code: -32603 ```
kaffeeumeins commented 1 month ago

Same here:

macOS: 14.5 (23F79) Deno: 1.45.2 VSCode: 1.91.1 (Universal) VSCode extension denoland.vscode-deno: 3.38.0 Unable to get document highlights from TypeScript: tsc error: Error: Could not find source file: 'asset:///lib.deno.ns.d.ts'. at getValidSourceFile (ext:deno_tsc/00_typescript.js:149077:22) at Object.getDocumentHighlights (ext:deno_tsc/00_typescript.js:149493:24) at serverRequest (ext:deno_tsc/99_main_compiler.js:1305:42) at serverMainLoop (ext:deno_tsc/99_main_compiler.js:1167:9) at eventLoopTick (ext:core/01_core.js:168:7) For request: [43, "getDocumentHighlights", ["asset:///lib.deno.ns.d.ts",23075,["asset:///lib.deno.ns.d.ts"]], null, [[["file:///Users/baldur/Programmieren/deno/workflow02/src/small-ideas/worker_test.ts",0]],4,null]] [Error - 00:50:47] Request textDocument/documentHighlight failed. Message: Internal error Code: -32603