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

Ignore MP code action request for non-MP diagnostics #471

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.lsp4j.CodeAction;
import org.eclipse.lsp4j.CodeLens;
import org.eclipse.lsp4j.CompletionList;
import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4j.Hover;
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.PublishDiagnosticsParams;
Expand Down Expand Up @@ -151,6 +152,20 @@ public CompletableFuture<List<CodeAction>> getJavaCodeAction(MicroProfileJavaCod
return CompletableFutures.computeAsync((cancelChecker) -> {
IProgressMonitor monitor = getProgressMonitor(cancelChecker);
try {

// If all the diagnostics have non-microprofile source let's just ignore this.
boolean found = false;
List<Diagnostic> diagnostics = javaParams.getContext().getDiagnostics();
for (Diagnostic d : diagnostics) {
if (d.getSource().startsWith("microprofile")) {
found = true;
scottkurz marked this conversation as resolved.
Show resolved Hide resolved
break;
}
}
if (!found) {
return Collections.emptyList();
}

return (List<CodeAction>) PropertiesManagerForJava.getInstance().codeAction(javaParams, JDTUtilsLSImpl.getInstance(),
monitor);
} catch (JavaModelException e) {
Expand Down
Loading