Skip to content

Add import on file drag/dropΒ #50170

Open
Open
@mjbvz

Description

@mjbvz

Suggestion

From microsoft/vscode#5240

πŸ” Search Terms

  • drop
  • dnd
  • import
  • require

⭐ Suggestion

When I drag and drop a file from VS Code's explorer into the top of my TypeScript code, it should insert an import statement

For example if I have the workspace:

index.ts
sub/
    other.ts

And I drop other.ts into index.ts, it should insert:

import $1 from './sub/other'; // here $1 is where the cursor should be after the drop

Other cases

  • I should be able to drag and drop multiple files to create multiple imports

  • Possible: If I drop the file into somewhere else in the file, we should instead insert an import expression

  • The added import path should take into account TypeScript's path resolution logic

  • This also should apply when copy and pasting a file into the editor

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions