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

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

Issue 2784673003: Add getStatementCompletion to the API spec (Closed)
Patch Set: Add experimental attribute Created 3 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
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 a76fef90fa67dc53bedbb12612ed2b61e59535b1..76a67f89709f6f9f7319ae0b5e7cac2eb894f764 100644
--- a/pkg/analysis_server/test/integration/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/integration_test_methods.dart
@@ -1445,6 +1445,45 @@ abstract class IntegrationTestMixin {
}
/**
+ * Get the changes required to convert the partial statement at the given
+ * location into a syntactically valid statement. If the current statement is
+ * already valid the change will insert a newline plus appropriate
+ * indentation at the end of the line containing the offset. If a change that
+ * makes the statement valid cannot be determined (perhaps because it has not
+ * yet been implemented) the statement will be considered already valid and
+ * the appropriate change returned.
+ *
+ * Parameters
+ *
+ * file (FilePath)
+ *
+ * The file containing the statement to be completed.
+ *
+ * offset (int)
+ *
+ * The offset used to identify the statement to be completed.
+ *
+ * Returns
+ *
+ * change (SourceChange)
+ *
+ * The change to be applied in order to complete the statement.
+ *
+ * whitespaceOnly (bool)
+ *
+ * Will be true if the change contains nothing but whitespace characters,
+ * or is empty.
+ */
+ Future<EditGetStatementCompletionResult> sendEditGetStatementCompletion(
+ String file, int offset) async {
+ var params = new EditGetStatementCompletionParams(file, offset).toJson();
+ var result = await server.send("edit.getStatementCompletion", params);
+ ResponseDecoder decoder = new ResponseDecoder(null);
+ return new EditGetStatementCompletionResult.fromJson(
+ decoder, 'result', result);
+ }
+
+ /**
* Sort all of the directives, unit and class members of the given Dart file.
*
* If a request is made for a file that does not exist, does not belong to an

Powered by Google App Engine
This is Rietveld 408576698