From f823b44dc96f7baa949f84763d5bd8c6e30932f2 Mon Sep 17 00:00:00 2001 From: Lorenzo Bettini Date: Fri, 12 Jan 2024 09:17:27 +0100 Subject: [PATCH 1/3] don't set marker.LOCATION if LINE_NUMBER is set --- .../eclipse/xtext/ui/editor/validation/MarkerCreator.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java index d081271750f..4444b52fa94 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java @@ -42,17 +42,16 @@ protected void setMarkerAttributes(Issue issue, IResource resource, IMarker mark // Do this in one single setAttributes() call, as each set of an attribute is a workspace operation Map attributes = new HashMap<>(16); - String lineNR = ""; if (issue.getLineNumber() != null) { - lineNR = "line: " + issue.getLineNumber() + " "; + attributes.put(IMarker.LINE_NUMBER, issue.getLineNumber()); + } else { + attributes.put(IMarker.LOCATION, resource.getFullPath().toString()); } - attributes.put(IMarker.LOCATION, lineNR + resource.getFullPath().toString()); attributes.put(Issue.CODE_KEY, issue.getCode()); attributes.put(IMarker.SEVERITY, getSeverity(issue)); attributes.put(IMarker.CHAR_START, issue.getOffset()); if(issue.getOffset() != null && issue.getLength() != null) attributes.put(IMarker.CHAR_END, issue.getOffset()+issue.getLength()); - attributes.put(IMarker.LINE_NUMBER, issue.getLineNumber()); attributes.put(Issue.COLUMN_KEY, issue.getColumn()); attributes.put(IMarker.MESSAGE, issue.getMessage()); From b3d8e0a697c3dcea52fd998f1fe35c19f420e9a2 Mon Sep 17 00:00:00 2001 From: Lorenzo Bettini Date: Fri, 12 Jan 2024 15:37:50 +0100 Subject: [PATCH 2/3] don't set marker.LOCATION at all --- .../org/eclipse/xtext/ui/editor/validation/MarkerCreator.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java index 4444b52fa94..d03fa670f5f 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java @@ -44,8 +44,6 @@ protected void setMarkerAttributes(Issue issue, IResource resource, IMarker mark if (issue.getLineNumber() != null) { attributes.put(IMarker.LINE_NUMBER, issue.getLineNumber()); - } else { - attributes.put(IMarker.LOCATION, resource.getFullPath().toString()); } attributes.put(Issue.CODE_KEY, issue.getCode()); attributes.put(IMarker.SEVERITY, getSeverity(issue)); From 66bfdb21e1ff4ca3994b82b8a8b4c8d67ba9f87e Mon Sep 17 00:00:00 2001 From: Lorenzo Bettini Date: Fri, 12 Jan 2024 16:42:56 +0100 Subject: [PATCH 3/3] no need to check for issue.getLineNumber() != null --- .../org/eclipse/xtext/ui/editor/validation/MarkerCreator.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java index d03fa670f5f..3e8e88eba7d 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/validation/MarkerCreator.java @@ -42,14 +42,12 @@ protected void setMarkerAttributes(Issue issue, IResource resource, IMarker mark // Do this in one single setAttributes() call, as each set of an attribute is a workspace operation Map attributes = new HashMap<>(16); - if (issue.getLineNumber() != null) { - attributes.put(IMarker.LINE_NUMBER, issue.getLineNumber()); - } attributes.put(Issue.CODE_KEY, issue.getCode()); attributes.put(IMarker.SEVERITY, getSeverity(issue)); attributes.put(IMarker.CHAR_START, issue.getOffset()); if(issue.getOffset() != null && issue.getLength() != null) attributes.put(IMarker.CHAR_END, issue.getOffset()+issue.getLength()); + attributes.put(IMarker.LINE_NUMBER, issue.getLineNumber()); attributes.put(Issue.COLUMN_KEY, issue.getColumn()); attributes.put(IMarker.MESSAGE, issue.getMessage());