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

Source actions should generate code at cursor location #1346

Closed
anthonyvdotbe opened this issue Mar 27, 2020 · 1 comment · Fixed by #1859
Closed

Source actions should generate code at cursor location #1346

anthonyvdotbe opened this issue Mar 27, 2020 · 1 comment · Fixed by #1859
Assignees

Comments

@anthonyvdotbe
Copy link

If I'm generating code, I want the code to be generated at my current cursor's location

Environment
  • Operating System: Windows 10
  • JDK version: 13.0.1
  • Visual Studio Code version: 1.43.2
  • Java extension version: 0.58.0
Steps To Reproduce
  1. Given the class below, when I generate the getter/setter for the field other, I want them to be inserted where my cursor is, between the field and the hashCode() method
import java.util.Objects;

class Issues {

    private String other;

    <cursor>

    @Override
    public int hashCode() {
        return 0;
    }

    @Override
    public boolean equals(Object obj) {
        return false;
    }

}
Current Result

The methods are generated at the end of the class

Expected Result

The methods are generated at the current cursor location. If the cursor would be in a location where it doesn't make sense, such as in the package declaration or inside a method, it should pick the location nearest to the cursor where it does make sense. The idea is to avoid having to scroll all the way down to find your generated methods.

@testforstephen
Copy link
Collaborator

fair enough.

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