Skip to content

Allow pasting a Java file into the file explorer #3323

Closed
@Artur-

Description

@Artur-

A handy way to get a java file from an external source into the project is to copy the source (not the file) and then paste it in the file tree. This has "always" worked in Eclipse and it would be great to have it working also in VS Code.

When pasting into a Java source folder, the file should be placed in the correct package (not the folder it is pasted in) and named according to a public Java class in the snippet.

So pasting e.g. this

package foo.bar.baz;

public class HelloWorld {
}

into src/main/java in a Maven project should create src/main/java/foo/bar/baz/HelloWorld.java

Environment
  • Operating System: mac
  • JDK version: 21
  • Visual Studio Code version: 1.82.2
  • Java extension version: 1.22.1
Steps To Reproduce
  1. Copy
  2. Paste
Current Result

Nothing happens when you paste a Java snippet into the explorer

Expected Result

As described above

Metadata

Metadata

Assignees

Type

No type

Projects

Status

✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions