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:

  1. Import one of the other symbols
  2. Scroll to the top of the file
  3. Find the import
  4. Change the import
  5. Go back
  6. Change the symbol I entered in step 1

Image

AsyncEmitter and EmitterOptions shows up:

https://github.com/microsoft/vscode/blob/85de2f21c63608e8bbc5c2347fe927b00c8300bf/src/vs/base/common/event.ts#L1184

https://github.com/microsoft/vscode/blob/85de2f21c63608e8bbc5c2347fe927b00c8300bf/src/vs/base/common/event.ts#L695

But not Emitter:

https://github.com/microsoft/vscode/blob/85de2f21c63608e8bbc5c2347fe927b00c8300bf/src/vs/base/common/event.ts#L897


Image

Image

DisposableStore and DisposableMap shows up:

https://github.com/microsoft/vscode/blob/85de2f21c63608e8bbc5c2347fe927b00c8300bf/src/vs/base/common/lifecycle.ts#L210

https://github.com/microsoft/vscode/blob/85de2f21c63608e8bbc5c2347fe927b00c8300bf/src/vs/base/common/lifecycle.ts#L503

But not Disposable:

Image

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 16 (15 by maintainers)

Commits related to this issue

Most upvoted comments

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.ts pattern is normalized to /**/src/vs/workbench/workbench.web.main.ts in the client, and the regex pattern for that is /^((\/.+?)?\/src\/vs\/workbench\/workbench\.web\.main\.ts)($|\/)/i which doesn’t match the drive letter in the start c:/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 Event and Disposable. Opened https://github.com/microsoft/vscode/pull/193477 to add this as a workspace setting

Similarly, Event is never automatically imported for me.