-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow pasting a Java file into the file explorer #3323
Comments
Agreed. I really like that feature. Especiall that it creates the folder structure defined by the |
This feature is currently in the works. When a java text is pasted in the file explorer using This feature extends to when the language server is not already running, though it works with some delay for the server to get started. When there is no project currently open, the file is placed in a tmp folder in the user's home directory. The following gif also exemplifies the creation of a folder according to the package name if it does not already exist. There is still some work to be done, particularly with packages. The search for a matching package name is very minimal right now. |
@hopehadfield make sure this feature (including overriding the paste shortcut itself) can be disabled via a setting |
Change will end up in the pre-releases. Note that from discussions, we've decided to not enable this feature when no workspace folders are opened. However we could do this if needed. There's still the case of an invisible project where a file isn't open. Pasting has to wait until the language server is ready. I think we should have a client-side check while the language server is starting to avoid delays. |
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
into
src/main/java
in a Maven project should createsrc/main/java/foo/bar/baz/HelloWorld.java
Environment
Steps To Reproduce
Current Result
Nothing happens when you paste a Java snippet into the explorer
Expected Result
As described above
The text was updated successfully, but these errors were encountered: