TypeScript: Auto import does not import Disposable or Emitter from VS Code's codebase
Related to https://github.com/microsoft/vscode/issues/116375
This issue has been around for years, I think I’ve mentioned it in DMs but not sure if there’s an issue. Regardless, here’s a detailed description of it. I’m assuming this is an upstream issue but please keep this issue open to track as it’s a papercut.
This does impact my productivity; instead of auto import just working like it’s supposed to, I instead have to:
- Import one of the other symbols
- Scroll to the top of the file
- Find the import
- Change the import
- Go back
- Change the symbol I entered in step 1
AsyncEmitter and EmitterOptions shows up:
But not Emitter:
DisposableStore and DisposableMap shows up:
But not Disposable:
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 16 (15 by maintainers)
Commits related to this issue
- Add typescript.preferences.autoImportFileExcludePatterns to repo For https://github.com/microsoft/TypeScript/issues/55781 — committed to mjbvz/vscode by mjbvz 9 months ago
- Add typescript.preferences.autoImportFileExcludePatterns to repo (#193477) For https://github.com/microsoft/TypeScript/issues/55781 — committed to microsoft/vscode by mjbvz 9 months ago
Just came back from a break and noticed this was fixed, thanks so much!
The Windows problem should be related to the drive letter. The
src/vs/workbench/workbench.web.main.tspattern is normalized to/**/src/vs/workbench/workbench.web.main.tsin the client, and the regex pattern for that is/^((\/.+?)?\/src\/vs\/workbench\/workbench\.web\.main\.ts)($|\/)/iwhich doesn’t match the drive letter in the startc:/path/to/vscode/src/vs/workbench/workbench.web.main.ts.#56415 also uses Windows, so it should be related.
Adding that setting seems to fix
EventandDisposable. Opened https://github.com/microsoft/vscode/pull/193477 to add this as a workspace settingSimilarly,
Eventis never automatically imported for me.