Skip to content
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

Generate the code repeatedly in new java file #2939

Closed
v-yuyul opened this issue Feb 16, 2023 · 3 comments · Fixed by #2944
Closed

Generate the code repeatedly in new java file #2939

v-yuyul opened this issue Feb 16, 2023 · 3 comments · Fixed by #2944

Comments

@v-yuyul
Copy link

v-yuyul commented Feb 16, 2023

Environment
  • Operating System: Mac
  • JDK version: 17.0.6
  • Visual Studio Code version: 1.75.1
  • Java extension version: 1.15.0
Steps To Reproduce
  1. Open a java project, like https://github.com/redhat-developer/vscode-java/tree/master/test/resources/projects/eclipse/simple-app
  2. Type the code File f = new File("demo.txt"); in a main method > Code Actions > Select Create class xxx, or Create interface xxx, or Create enum xxx

double-showing-code

Current Result

Show the code repeatedly in the new java file.

Expected Result

Only show the code one time

@fbricon
Copy link
Collaborator

fbricon commented Feb 16, 2023

The bug already exists in 1.14

@fbricon
Copy link
Collaborator

fbricon commented Feb 16, 2023

Probably relates to #2938

@testforstephen
Copy link
Collaborator

It seems all file creation related refactorings probably have this issue.

For example, it can also be reproduced with "extract interface". The reason is that the client file event listener will inject duplicated snippet when the file is created by a WorkspaceEdit.

#2938 is a different bug, where the server side searching code generated duplicated results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants