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

More checks for ignored markers #2540

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

mickaelistria
Copy link
Contributor

No description provided.

@@ -170,6 +170,13 @@ private void collectNonJavaProblems(List<Diagnostic> diagnostics, boolean isDiag
}
list.add(marker);
}
list.removeIf(marker -> JavaLanguageServerPlugin.getPreferencesManager().getClientPreferences().excludedMarkerTypes().stream().anyMatch(t -> {
Copy link
Contributor

@rgrunber rgrunber Mar 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed ? At the very bottom of collectNonJavaProblems(..) there is a call to : https://github.com/eclipse/eclipse.jdt.ls/blob/c254d4226145152734100fe8120f71fd58876890/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BaseDiagnosticsHandler.java#L181 . The method handles list filtering via. excludedMarkerTypes, so why do it here when it's going to happen anyways ?

@mickaelistria
Copy link
Contributor Author

I re-evaluated the issue and I agree fixing it on the LS side on the moment doesn't seem the best place. So let's close in favor of improvements on client side. I may reopen one day with a more consolidated use-case explaining why this may be worth including.

@rgrunber
Copy link
Contributor

Fair. I did mention this location in #2524 (review) , so I was at least open to doing it in acceptProblem, but I think when you handled it in the other toDiagnosticsArray, it seemed like you took care of that.

I think down the road using the diagnostic tags is going to be the best solution and filtering by those. I just haven't checked if other clients are really respecting that.

@mickaelistria mickaelistria reopened this Mar 21, 2023
@mickaelistria
Copy link
Contributor Author

I re-reevaluated this issue and I think it is necessary for eclipseide-jdtls, and can also improve the performance of JDT-LS.
The issue is in eclipseide-jdtls:

  1. JDT-LS sends diagnostics
  2. Eclipse IDE creates markers for those diagnostics (those markers are excluded in the server configuration)
    3 JDT-LS notice the change and retriggers WorkspaceDiagnosticsHandler.visit() which itself calls WorkspaceDiagnosticsHandler.triggerValidation() which itself regenerates diagnostics, with a newer timestamp and re-loop to step 1.

@mickaelistria mickaelistria force-pushed the markers-2 branch 2 times, most recently from 2b1be46 to 1901810 Compare March 23, 2023 20:51
@mickaelistria mickaelistria changed the title Skip loading document for excluded markers More checks for ignored markers Mar 24, 2023
Prevents extra work and extra notifications for excluded
markers by quitting the visit ASAP.
@mickaelistria mickaelistria reopened this Mar 31, 2023
Copy link
Contributor

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks fine. Just a question about one check.

@@ -119,6 +121,9 @@ public void resourceChanged(IResourceChangeEvent event) {
*/
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
if (delta.getFlags() == IResourceDelta.MARKERS && Arrays.stream(delta.getMarkerDeltas()).map(IMarkerDelta::getMarker).noneMatch(WorkspaceDiagnosticsHandler::isInteresting)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the check be ((delta.getFlags() & IResourceDelta.MARKERS) == 1) in case there are additional flags embedded ? (it's a bitmask).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so; the goal here is to skip the visit only if it's about an ignored marker change. If the change is combined with another type of change (eg content), it's probably still worth visiting it.

@rgrunber rgrunber added this to the Early April 2023 milestone Apr 11, 2023
@rgrunber rgrunber merged commit 6d94ed2 into eclipse-jdtls:master Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants