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

Unified Diff: pkg/analysis_server/test/integration/integration_test_methods.dart

Issue 1258563008: Proposal for the 'edit.organizeDirectives' request. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Tweaks for review comments. Created 5 years, 5 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/test/integration/integration_test_methods.dart
diff --git a/pkg/analysis_server/test/integration/integration_test_methods.dart b/pkg/analysis_server/test/integration/integration_test_methods.dart
index 4da1b0c6807d25e6294eb2adfbd95ed24c447adf..8f3915eb4976b216a25bb9117b5b460c68ee6af1 100644
--- a/pkg/analysis_server/test/integration/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/integration_test_methods.dart
@@ -1390,6 +1390,39 @@ abstract class IntegrationTestMixin {
}
/**
+ * Organizes all of the directives - removes unused imports and sorts
+ * directives of the given Dart file according to the Dart Style Guide.
+ *
+ * If a request is made for a file that does not exist, does not belong to an
+ * analysis root or is not a Dart file, FILE_NOT_ANALYZED will be generated.
+ *
+ * If directives of the Dart file cannot be organized, for example because it
+ * has scan or parse errors, or by other reasons, ORGANIZE_DIRECTIVES_ERROR
+ * will be generated. The message will provide datails about the reason.
+ *
+ * Parameters
+ *
+ * file ( FilePath )
+ *
+ * The Dart file to organize directives in.
+ *
+ * Returns
+ *
+ * edit ( SourceFileEdit )
+ *
+ * The file edit that is to be applied to the given file to effect the
+ * organizing.
+ */
+ Future<EditOrganizeDirectivesResult> sendEditOrganizeDirectives(String file) {
+ var params = new EditOrganizeDirectivesParams(file).toJson();
+ return server.send("edit.organizeDirectives", params)
+ .then((result) {
+ ResponseDecoder decoder = new ResponseDecoder(null);
+ return new EditOrganizeDirectivesResult.fromJson(decoder, 'result', result);
+ });
+ }
+
+ /**
* Create an execution context for the executable file with the given path.
* The context that is created will persist until execution.deleteContext is
* used to delete it. Clients, therefore, are responsible for managing the
« no previous file with comments | « pkg/analysis_server/lib/src/generated_protocol.dart ('k') | pkg/analysis_server/test/integration/protocol_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698