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

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

Issue 1849843002: Rework computing simple strings difference. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/correction/strings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/correction/sort_members.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/sort_members.dart b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
index d5bb1265409d9b23d838802a1e28e82aabe5c562..459236717d81475b026bbbbbb3d938fc80cd1b4a 100644
--- a/pkg/analysis_server/lib/src/services/correction/sort_members.dart
+++ b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
@@ -62,16 +62,9 @@ class MemberSorter {
// prepare edits
List<SourceEdit> edits = <SourceEdit>[];
if (code != initialCode) {
- int prefixLength = findCommonPrefix(initialCode, code);
- int suffixLength = findCommonSuffix(initialCode, code);
- String prefix = code.substring(0, prefixLength);
- String suffix = code.substring(code.length - suffixLength, code.length);
- int commonLength = findCommonOverlap(prefix, suffix);
- suffixLength -= commonLength;
- SourceEdit edit = new SourceEdit(
- prefixLength,
- initialCode.length - suffixLength - prefixLength,
- code.substring(prefixLength, code.length - suffixLength));
+ SimpleDiff diff = computeSimpleDiff(initialCode, code);
+ SourceEdit edit =
+ new SourceEdit(diff.offset, diff.length, diff.replacement);
edits.add(edit);
}
return edits;
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/correction/strings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698