Skip to content

Enable auto imports and add missing import for module/package namesΒ #52527

Open

Description

Suggestion

πŸ” Search Terms

  • auto import
  • quick fix
  • missing import

⭐ Suggestion

Auto imports / add missing imports should be able to add import * as XYZ from 'XYZ' when triggered on the symbol name XYZ in a file. This is useful if you prefer using namespace imports and can also help with discovering/exploring new packages

Right now we have auto imports and an add missing import quick fix for symbols in a module, but I don't see these options for the module itself

πŸ“ƒ Motivating Example

  1. In a new project
  2. npm I @types/vscode
  3. Open new TS file and write vscode.

Right now I don't get an auto import for vscode. I'd expect an import that adds: import * as vscode from 'vscode'; at the top of the file

πŸ’» Use Cases

  • Make it easier to reference a symbol if you prefer using namespaces from the start
  • Helping users explore new packages (just type vscode. to see suggestions in the vscode package)
  • Working with node packages. It'd be nice to be able to type fs. to get an fs import
  • Fixing code that has been copy and pasted between files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureDomain: Auto-importSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions