From ad11e5d615af8c172ce0dc24fe01942c4e1b667a Mon Sep 17 00:00:00 2001 From: pq Date: Sun, 11 Feb 2018 18:28:27 +0000 Subject: [PATCH] Re-generate Server APIs. Previous change only updated the plugin; this catches up server. Follow-up from: https://github.com/dart-lang/sdk/commit/bea00e5bb346918cb316febf2434c70176edf649 Change-Id: Iae2ec340ffe528d76c53198322d691320f507852 Reviewed-on: https://dart-review.googlesource.com/40501 Commit-Queue: Phil Quitslund Reviewed-by: Brian Wilkerson --- pkg/analysis_server/doc/api.html | 16 ++++++++-- .../support/protocol_matchers.dart | 4 +++ .../java/types/CompletionSuggestion.java | 31 ++++++++++++++++--- .../java/types/CompletionSuggestionKind.java | 5 +++ 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html index 40612c75547..a459c82b9f8 100644 --- a/pkg/analysis_server/doc/api.html +++ b/pkg/analysis_server/doc/api.html @@ -2808,6 +2808,13 @@ a:focus, a:hover { additionally insert a template for the parameters. The information required in order to do so is contained in other fields.

+
displayText: String (optional)
+ +

+ Text to be displayed in, for example, a completion pop-up. This field + is only defined if the displayed text should be different than the + completion. Otherwise it is omitted. +

selectionOffset: int

@@ -2834,7 +2841,7 @@ a:focus, a:hover {

An abbreviated version of the Dartdoc associated with the element - being suggested, This field is omitted if there is no Dartdoc + being suggested. This field is omitted if there is no Dartdoc associated with the element.

docComplete: String (optional)
@@ -2968,7 +2975,12 @@ a:focus, a:hover { suggestions of this kind, the completion is the named argument identifier including a trailing ':' and a space.

-
OPTIONAL_ARGUMENT
PARAMETER
ContextData: object
+
OPTIONAL_ARGUMENT
OVERRIDE
+ +

+ An overriding implementation of a class member is being suggested. +

+
PARAMETER
ContextData: object

Information about an analysis context.

diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart index 7173f6e9897..91b0f0da31e 100644 --- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart +++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart @@ -201,6 +201,7 @@ final Matcher isCompletionId = isString; * "kind": CompletionSuggestionKind * "relevance": int * "completion": String + * "displayText": optional String * "selectionOffset": int * "selectionLength": int * "isDeprecated": bool @@ -231,6 +232,7 @@ final Matcher isCompletionSuggestion = "isDeprecated": isBool, "isPotential": isBool }, optionalFields: { + "displayText": isString, "docSummary": isString, "docComplete": isString, "declaringType": isString, @@ -258,6 +260,7 @@ final Matcher isCompletionSuggestion = * KEYWORD * NAMED_ARGUMENT * OPTIONAL_ARGUMENT + * OVERRIDE * PARAMETER * } */ @@ -270,6 +273,7 @@ final Matcher isCompletionSuggestionKind = "KEYWORD", "NAMED_ARGUMENT", "OPTIONAL_ARGUMENT", + "OVERRIDE", "PARAMETER" ]); diff --git a/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestion.java b/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestion.java index 7a8ebc38d1e..582d655b4d5 100644 --- a/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestion.java +++ b/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestion.java @@ -53,6 +53,12 @@ public class CompletionSuggestion { */ private final String completion; + /** + * Text to be displayed in, for example, a completion pop-up. This field is only defined if the + * displayed text should be different than the completion. Otherwise it is omitted. + */ + private final String displayText; + /** * The offset, relative to the beginning of the completion, of where the selection should be placed * after insertion. @@ -76,7 +82,7 @@ public class CompletionSuggestion { private final boolean isPotential; /** - * An abbreviated version of the Dartdoc associated with the element being suggested, This field is + * An abbreviated version of the Dartdoc associated with the element being suggested. This field is * omitted if there is no Dartdoc associated with the element. */ private final String docSummary; @@ -163,10 +169,11 @@ public class CompletionSuggestion { /** * Constructor for {@link CompletionSuggestion}. */ - public CompletionSuggestion(String kind, int relevance, String completion, int selectionOffset, int selectionLength, boolean isDeprecated, boolean isPotential, String docSummary, String docComplete, String declaringType, String defaultArgumentListString, int[] defaultArgumentListTextRanges, Element element, String returnType, List parameterNames, List parameterTypes, Integer requiredParameterCount, Boolean hasNamedParameters, String parameterName, String parameterType, String importUri) { + public CompletionSuggestion(String kind, int relevance, String completion, String displayText, int selectionOffset, int selectionLength, boolean isDeprecated, boolean isPotential, String docSummary, String docComplete, String declaringType, String defaultArgumentListString, int[] defaultArgumentListTextRanges, Element element, String returnType, List parameterNames, List parameterTypes, Integer requiredParameterCount, Boolean hasNamedParameters, String parameterName, String parameterType, String importUri) { this.kind = kind; this.relevance = relevance; this.completion = completion; + this.displayText = displayText; this.selectionOffset = selectionOffset; this.selectionLength = selectionLength; this.isDeprecated = isDeprecated; @@ -195,6 +202,7 @@ public class CompletionSuggestion { ObjectUtilities.equals(other.kind, kind) && other.relevance == relevance && ObjectUtilities.equals(other.completion, completion) && + ObjectUtilities.equals(other.displayText, displayText) && other.selectionOffset == selectionOffset && other.selectionLength == selectionLength && other.isDeprecated == isDeprecated && @@ -221,6 +229,7 @@ public class CompletionSuggestion { String kind = jsonObject.get("kind").getAsString(); int relevance = jsonObject.get("relevance").getAsInt(); String completion = jsonObject.get("completion").getAsString(); + String displayText = jsonObject.get("displayText") == null ? null : jsonObject.get("displayText").getAsString(); int selectionOffset = jsonObject.get("selectionOffset").getAsInt(); int selectionLength = jsonObject.get("selectionLength").getAsInt(); boolean isDeprecated = jsonObject.get("isDeprecated").getAsBoolean(); @@ -239,7 +248,7 @@ public class CompletionSuggestion { String parameterName = jsonObject.get("parameterName") == null ? null : jsonObject.get("parameterName").getAsString(); String parameterType = jsonObject.get("parameterType") == null ? null : jsonObject.get("parameterType").getAsString(); String importUri = jsonObject.get("importUri") == null ? null : jsonObject.get("importUri").getAsString(); - return new CompletionSuggestion(kind, relevance, completion, selectionOffset, selectionLength, isDeprecated, isPotential, docSummary, docComplete, declaringType, defaultArgumentListString, defaultArgumentListTextRanges, element, returnType, parameterNames, parameterTypes, requiredParameterCount, hasNamedParameters, parameterName, parameterType, importUri); + return new CompletionSuggestion(kind, relevance, completion, displayText, selectionOffset, selectionLength, isDeprecated, isPotential, docSummary, docComplete, declaringType, defaultArgumentListString, defaultArgumentListTextRanges, element, returnType, parameterNames, parameterTypes, requiredParameterCount, hasNamedParameters, parameterName, parameterType, importUri); } public static List fromJsonArray(JsonArray jsonArray) { @@ -289,6 +298,14 @@ public class CompletionSuggestion { return defaultArgumentListTextRanges; } + /** + * Text to be displayed in, for example, a completion pop-up. This field is only defined if the + * displayed text should be different than the completion. Otherwise it is omitted. + */ + public String getDisplayText() { + return displayText; + } + /** * The Dartdoc associated with the element being suggested. This field is omitted if there is no * Dartdoc associated with the element. @@ -298,7 +315,7 @@ public class CompletionSuggestion { } /** - * An abbreviated version of the Dartdoc associated with the element being suggested, This field is + * An abbreviated version of the Dartdoc associated with the element being suggested. This field is * omitted if there is no Dartdoc associated with the element. */ public String getDocSummary() { @@ -426,6 +443,7 @@ public class CompletionSuggestion { builder.append(kind); builder.append(relevance); builder.append(completion); + builder.append(displayText); builder.append(selectionOffset); builder.append(selectionLength); builder.append(isDeprecated); @@ -452,6 +470,9 @@ public class CompletionSuggestion { jsonObject.addProperty("kind", kind); jsonObject.addProperty("relevance", relevance); jsonObject.addProperty("completion", completion); + if (displayText != null) { + jsonObject.addProperty("displayText", displayText); + } jsonObject.addProperty("selectionOffset", selectionOffset); jsonObject.addProperty("selectionLength", selectionLength); jsonObject.addProperty("isDeprecated", isDeprecated); @@ -523,6 +544,8 @@ public class CompletionSuggestion { builder.append(relevance + ", "); builder.append("completion="); builder.append(completion + ", "); + builder.append("displayText="); + builder.append(displayText + ", "); builder.append("selectionOffset="); builder.append(selectionOffset + ", "); builder.append("selectionLength="); diff --git a/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestionKind.java b/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestionKind.java index 32a42dbe112..84048b8f03c 100644 --- a/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestionKind.java +++ b/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestionKind.java @@ -51,6 +51,11 @@ public class CompletionSuggestionKind { public static final String OPTIONAL_ARGUMENT = "OPTIONAL_ARGUMENT"; + /** + * An overriding implementation of a class member is being suggested. + */ + public static final String OVERRIDE = "OVERRIDE"; + public static final String PARAMETER = "PARAMETER"; }