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

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

Issue 1938023002: Keep directive annotations while sorting. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/test/edit/sort_members_test.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 459236717d81475b026bbbbbb3d938fc80cd1b4a..7cf8aa51e10fb042f6a5adabcedea93f4b55e2d3 100644
--- a/pkg/analysis_server/lib/src/services/correction/sort_members.dart
+++ b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
@@ -197,11 +197,16 @@ class MemberSorter {
directive.documentationComment.offset,
directive.documentationComment.end);
}
+ String annotationText;
+ if (directive.metadata.beginToken != null) {
+ annotationText = code.substring(directive.metadata.beginToken.offset,
+ directive.metadata.endToken.end);
+ }
int offset = directive.firstTokenAfterCommentAndMetadata.offset;
int length = directive.end - offset;
String text = code.substring(offset, offset + length);
- directives.add(new _DirectiveInfo(
- directive, kind, uriContent, documentationText, text));
+ directives.add(new _DirectiveInfo(directive, kind, uriContent,
+ documentationText, annotationText, text));
}
}
// nothing to do
@@ -245,6 +250,10 @@ class MemberSorter {
sb.write(endOfLine);
}
}
+ if (directive.annotationText != null) {
+ sb.write(directive.annotationText);
+ sb.write(endOfLine);
+ }
sb.write(directive.text);
sb.write(endOfLine);
}
@@ -369,10 +378,11 @@ class _DirectiveInfo implements Comparable<_DirectiveInfo> {
final _DirectivePriority priority;
final String uri;
final String documentationText;
+ final String annotationText;
final String text;
_DirectiveInfo(this.directive, this.priority, this.uri,
- this.documentationText, this.text);
+ this.documentationText, this.annotationText, this.text);
@override
int compareTo(_DirectiveInfo other) {
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/sort_members_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698