microsoft / microsoft/monaco-editor
Monaco fail to resolve ts/js modules with reserved (or non-ASCII) URI characters in model name.
Open
@alexdima is already working on this.
Since Dec 13, 2019.
bug
help wanted
typescript
typescript-multifile
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
monaco-editor version: 0.15.6
Browser: Chrome Version 72.0.3626.81 (Official Build) (64-bit)
OS: Ubuntu 16.04
Steps or JS usage snippet reproducing the issue:
- Load Monaco editor
- Set default options
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
allowNonTsExtensions: true,
allowJs: true,
isolatedModules: true,
outDir: "dummy"
});
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
noSemanticValidation: false,
noSyntacticValidation: false
});
- Create three models:
- a model that name contains only unreserved URI characters (e.g.
test.ts). - a model that name contains at least one character that should be URL-encoded: (e.g.
test(1).ts). - a model with script that imports two models above (e.g.
main.ts).
monaco.editor.createModel([
"export let x = 10;"
].join('\n'), "typescript", monaco.Uri.file("test.ts"));
monaco.editor.createModel([
"export let x = 10;"
].join('\n'), "typescript", monaco.Uri.file("test(1).ts"));
monaco.editor.createModel([
"import { x } from './test(1)'",
"import { y } from './test'",
"let z = x + 10 + y;"
].join('\n'), "typescript", monaco.Uri.file("main.ts"));
Expected result
Both dependencies are successfully resolved.
Actual result
The dependency that have a not unreserved URI characters can't be found by Monaco. The type information is not available for the dependency.

If one replaces module name in import statement with encoded one, the module is successfully resolved and all works fine.

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.