-
Notifications
You must be signed in to change notification settings - Fork 29
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 CodeAction resolve for Java code actions #299
Support CodeAction resolve for Java code actions #299
Conversation
...c/main/java/org/eclipse/lsp4mp/jdt/core/java/codeaction/InsertAnnotationMissingQuickFix.java
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,78 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2019 Red Hat Inc. and others. |
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.
2022
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.
This isn't new, I just copied it over from microprofile.ls
...ipse.lsp4mp.jdt.core/src/main/java/org/eclipse/lsp4mp/jdt/core/PropertiesManagerForJava.java
Show resolved
Hide resolved
.../src/main/java/org/eclipse/lsp4mp/jdt/core/java/codeaction/JavaCodeActionResolveContext.java
Show resolved
Hide resolved
.../src/main/java/org/eclipse/lsp4mp/jdt/core/java/codeaction/JavaCodeActionResolveContext.java
Show resolved
Hide resolved
...main/java/org/eclipse/lsp4mp/jdt/internal/config/java/NoValueAssignedToPropertyQuickFix.java
Show resolved
Hide resolved
...re/src/main/java/org/eclipse/lsp4mp/jdt/internal/core/java/codeaction/CodeActionHandler.java
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,78 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2019 Red Hat Inc. and others. |
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.
2022
...mp.ls/src/main/java/org/eclipse/lsp4mp/ls/api/MicroProfileJavaCodeActionResolveProvider.java
Show resolved
Hide resolved
...mp.ls/src/main/java/org/eclipse/lsp4mp/ls/api/MicroProfileJavaCodeActionResolveProvider.java
Show resolved
Hide resolved
...eclipse.lsp4mp.ls/src/main/java/org/eclipse/lsp4mp/services/java/JavaCodeActionResolver.java
Outdated
Show resolved
Hide resolved
...eclipse.lsp4mp.ls/src/main/java/org/eclipse/lsp4mp/services/java/JavaCodeActionResolver.java
Outdated
Show resolved
Hide resolved
....lsp4mp.ls/src/main/java/org/eclipse/lsp4mp/settings/MicroProfileCodeActionCapabilities.java
Outdated
Show resolved
Hide resolved
....lsp4mp.ls/src/main/java/org/eclipse/lsp4mp/settings/MicroProfileCodeActionCapabilities.java
Outdated
Show resolved
Hide resolved
The code looks promising, I need to play with your PR. |
7dd7c29
to
e9a9243
Compare
The tests should pass now, but I would like to clean up the code (Eclipse has been formatting strange ever since I installed and uninstalled the editorconfig extension) |
1cf916f
to
bf9c0da
Compare
bf9c0da
to
1605fbe
Compare
Resolve workspace edits only when the code action is applied for all code actions for Java files that modify source files. This should increase the performance of editing Java files with lsp4mp active, since the edits of all the code actions don't need to be computed. I also adjusted the title of the "Add @operation annotation" code action to include the class that the code action will apply to. Closes eclipse#171 Signed-off-by: David Thompson <davthomp@redhat.com>
1605fbe
to
3e60ef1
Compare
@datho7561 when I see the codeAction trace:
the diagnostic range and the code action range are the same. I wonder if spec allows to returns a coe action without range and in this usecase you could use the diagnostic range, what do you think? |
Map<String, Object> extendedData = new HashMap<>(); | ||
extendedData.put(ANNOTATION_KEY, annotations); | ||
codeAction.setData(new CodeActionResolveData(context.getUri(), getParticipantId(), | ||
context.getParams().getRange(), extendedData, |
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.
I think you dont need this range since you can use the diagnostic range, no? I think this range can be usefull when your code action have several diagnostic, so perhaps you can keep this range in the data, but when there is just one diagnostic you could use the diagnostic range and not fill the code action range.
I put the CodeAction range into the CodeAction |
It works like a charm @datho7561, great job! |
Resolve workspace edits only when the code action is applied for all code actions for Java files that modify source files. This should increase the performance of editing Java files with lsp4mp active, since the edits of all the code actions don't need to be computed.
I also adjusted the title of the "Add @operation annotation" code action to include the class that the code action will apply to.
Closes #171