Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: pkg/analysis_server/lib/src/services/correction/util.dart

Issue 3007783002: Add fixes for two additional lints (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/services/correction/util.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index f3619ba4fd69569ea191af1440a81f156723d0d9..b73b68d2fe3162d14087e727a75ec3bf750fd27d 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -866,7 +866,15 @@ class CorrectionUtils {
}
// end
int endOffset = sourceRange.end;
- int afterEndLineOffset = getLineContentEnd(endOffset);
+ int afterEndLineOffset = endOffset;
+ int lineStart = unit.lineInfo.getOffsetOfLine(
+ unit.lineInfo.getLocation(startLineOffset).lineNumber - 1);
+ if (lineStart == startLineOffset) {
+ // Only consume line ends after the end of the range if there is nothing
+ // else on the line containing the beginning of the range. Otherwise this
+ // will end up incorrectly merging two line.
+ afterEndLineOffset = getLineContentEnd(endOffset);
+ }
// range
return range.startOffsetEndOffset(startLineOffset, afterEndLineOffset);
}

Powered by Google App Engine
This is Rietveld 408576698