Skip to content

Commit

Permalink
Match diagnostics with empty ranges
Browse files Browse the repository at this point in the history
In Eclipse, we set a minimal range of 1 character, even for diagnostics
that have an empty range (just a position); so this fixes ensure such
markers and diagnostics are still matched together upon update, to avoid
re-creating diagnostics.
  • Loading branch information
mickaelistria committed Mar 28, 2023
1 parent a6189f5 commit 4d70d8a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private IMarker getExistingMarkerFor(IDocument document, Diagnostic diagnostic,
for (IMarker marker : remainingMarkers) {
try {
if (LSPEclipseUtils.toOffset(diagnostic.getRange().getStart(), document) == MarkerUtilities.getCharStart(marker)
&& LSPEclipseUtils.toOffset(diagnostic.getRange().getEnd(), document) == MarkerUtilities.getCharEnd(marker)
&& (LSPEclipseUtils.toOffset(diagnostic.getRange().getEnd(), document) == MarkerUtilities.getCharEnd(marker) || Objects.equals(diagnostic.getRange().getStart(), diagnostic.getRange().getEnd()))
&& Objects.equals(marker.getAttribute(IMarker.MESSAGE), diagnostic.getMessage())
&& Objects.equals(marker.getAttribute(LANGUAGE_SERVER_ID), this.languageServerId)) {
return marker;
Expand Down

0 comments on commit 4d70d8a

Please sign in to comment.