microsoft / microsoft/monaco-editor
Add better support for imports suggestion
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
When imports that are declared via addExtraLib are explicitly wrapped inside declare module then IntelliSense is actually very nice.
Following setup:
monacoEditor.languages.typescript.typescriptDefaults.addExtraLib("declare module 'test/file1' { export interface Test {} }", 'file:///node_modules/@types/test/file1.d.ts')
monacoEditor.languages.typescript.typescriptDefaults.addExtraLib("declare module 'test/file2' { export interface Test {} }", 'file:///node_modules/@types/test/file2.d.ts')
produces very nice auto-completion:


But if type definitions are missing explicit module wrapping as following:
monacoEditor.languages.typescript.typescriptDefaults.addExtraLib('export interface Test {}', 'file:///node_modules/@types/test/file1.d.ts')
monacoEditor.languages.typescript.typescriptDefaults.addExtraLib('export interface Test {}', 'file:///node_modules/@types/test/file2.d.ts')
then IntelliSense is also completely missing:

It would be nice if the latter use case would also produce the same outcome as the first one without needing to explicitly wrap type definitions.
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.
Research direction
Start by reproducing the two addExtraLib examples and comparing IntelliSense behavior for explicitly wrapped versus unwrapped declarations. Trace the import-suggestion handling used by Monaco's TypeScript integration; done means unwrapped type definitions produce the same import suggestions and completion behavior as wrapped definitions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100