monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Bug] Model paths with windows drive letter cause error in Typescript Worker

Open mofux opened this issue 2 years ago • 0 comments

Reproducible in vscode.dev or in VS Code Desktop?

  • [X] Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Code

const uri = monaco.Uri.file('c:\\test.js');
const model = monaco.editor.createModel('console.log("hi")', 'javascript', uri);
monaco.editor.create(document.getElementById('container'), { model });

Reproduction Steps

Run the reproduction code in playground, then hover a keyword, e.g. console and inspect the error in the developer console:

Uncaught Error: Could not find source file: 'file:///c%3A%5Ctest.js'.

Ve@../../../vs/language/typescript/tsWorker.js:256:8493
An@../../../vs/language/typescript/tsWorker.js:256:14561
getQuickInfoAtPosition@../../../vs/language/typescript/tsWorker.js:33956:3428
fmr@https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#javascript:22:33695
_handleMessage@https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#javascript:22:17684
handleMessage@https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#javascript:22:17309
_handleRequestMessage@https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#javascript:22:14120
_handleMessage@https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#javascript:22:13570
handleMessage@https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#javascript:22:13458
onmessage@https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#javascript:22:17401
c/</</</self.onmessage@https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#javascript:12:431

Actual (Problematic) Behavior

The error gets thrown, and the quick info will not show up. Other language features also seem to fail.

Expected Behavior

No response

Additional Context

No response

mofux avatar Sep 01 '22 14:09 mofux