-
Notifications
You must be signed in to change notification settings - Fork 401
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
Support multiple selection for generate accessors #2136
Support multiple selection for generate accessors #2136
Conversation
c93c94d
to
9a78007
Compare
test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one problem about the insert position:
position.mp4
You can see that the inserted code locates before the cursor instead of after it. Meanwhile, the selection looks wired too. Only select the inserted part should be better, I think.
...se.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/SourceAssistUtility.java
Outdated
Show resolved
Hide resolved
...se.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/SourceAssistUtility.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Shi Chen [email protected]
@jdneo I think I found the bug here. |
Signed-off-by: Shi Chen <[email protected]>
9a78007
to
6d3400d
Compare
now it looks like selectbug.mp4 |
The start position of |
Signed-off-by: Shi Chen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@CsCherrYY , @jdneo . Just a question about this. @jasonhy-wang rightly pointed out that on recent versions, one can no longer activate code action from |
@rgrunber It's a known limitation. In this PR we introduced three cases to get the field names from a given AST node: https://github.com/eclipse/eclipse.jdt.ls/blob/1226891c0f5002cb8b49ab0794f4616a525e2ef0/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/CodeActionUtility.java#L89-L106, the case when the node is a A potential fix is to check the parent of the node, when it's a |
It's a bit of a corner case given how many ways there are to generate the getters/setters, so it's lower priority. The only thing is you'd also have to check the value of Update: I've created an issue to at least track that we're aware of this. |
This PR
VariableDeclarationFragment
, the quick assist will generate the accessor for it only. (See the demo video)Signed-off-by: Shi Chen [email protected]
multiple-acceccor.mp4