From 8a1dcdae68d8b211305bd537c3d098258429b7e8 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Mon, 8 Jul 2019 22:03:24 +0000 Subject: [PATCH] Graduate 'flutter' domain from experimental, remove unused methods and fields. We could also remove FlutterCorrections, because right now we don't use it, but we will restore it soon as we get new Flutter domain methods. R=brianwilkerson@google.com, devoncarew@google.com Change-Id: I084fe5acbe5d854673c7247d734aeca1f8d721af Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108364 Reviewed-by: Brian Wilkerson Commit-Queue: Konstantin Shcheglov --- pkg/analysis_server/doc/api.html | 234 +++++++++- .../lib/protocol/protocol_constants.dart | 11 - .../lib/protocol/protocol_generated.dart | 442 +----------------- .../lib/src/flutter/flutter_correction.dart | 37 -- .../lib/src/flutter/flutter_domain.dart | 40 -- .../src/flutter/flutter_notifications.dart | 1 - .../src/flutter/flutter_outline_computer.dart | 180 +------ .../support/integration_test_methods.dart | 41 -- .../support/protocol_matchers.dart | 43 +- .../src/flutter/flutter_correction_test.dart | 120 +---- .../flutter_outline_computer_test.dart | 270 ----------- .../spec/generated/java/AnalysisServer.java | 11 - .../generated/java/types/FlutterOutline.java | 148 +----- pkg/analysis_server/tool/spec/spec_input.html | 98 +--- .../lib/src/protocol/protocol_constants.dart | 11 - .../lib/src/protocol/protocol_generated.dart | 442 +----------------- 16 files changed, 279 insertions(+), 1850 deletions(-) diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html index 2635ca1c9987..8f7433aad91f 100644 --- a/pkg/analysis_server/doc/api.html +++ b/pkg/analysis_server/doc/api.html @@ -288,6 +288,9 @@

Domains

  • diagnostic.getServerPort
  • +

    Flutter

    +

    Command-line Arguments

    The command-line arguments that can be passed to the server. @@ -2811,7 +2814,90 @@

    returns:

    port: int
    - +

    flutter domain

    +

    + The analysis domain contains API’s related to Flutter support. +

    + + +

    Requests

    flutter.setSubscriptions
    request: {
    +  "id": String
    +  "method": "flutter.setSubscriptions"
    +  "params": {
    +    "subscriptions": Map<FlutterService, List<FilePath>>
    +  }
    +}

    response: {
    +  "id": String
    +  "error": optional RequestError
    +}
    +

    + Subscribe for services that are specific to individual files. + All previous subscriptions are replaced by the current set of + subscriptions. If a given service is not included as a key in the map + then no files will be subscribed to the service, exactly as if the + service had been included in the map with an explicit empty list of + files. +

    +

    + Note that this request determines the set of requested + subscriptions. The actual set of subscriptions at any given + time is the intersection of this set with the set of files + currently subject to analysis. The files currently subject + to analysis are the set of files contained within an actual + analysis root but not excluded, plus all of the files + transitively reachable from those files via import, export + and part directives. (See analysis.setAnalysisRoots for an + explanation of how the actual analysis roots are + determined.) When the actual analysis roots change, the + actual set of subscriptions is automatically updated, but + the set of requested subscriptions is unchanged. +

    +

    + If a requested subscription is a directory it is ignored, + but remains in the set of requested subscriptions so that if + it later becomes a file it can be included in the set of + actual subscriptions. +

    +

    + It is an error if any of the keys in the map are not valid + services. If there is an error, then the existing + subscriptions will remain unchanged. +

    + +

    parameters:

    subscriptions: Map<FlutterService, List<FilePath>>
    + +

    + A table mapping services to a list of the files being + subscribed to the service. +

    +

    Notifications

    flutter.outline
    notification: {
    +  "event": "flutter.outline"
    +  "params": {
    +    "file": FilePath
    +    "outline": FlutterOutline
    +  }
    +}
    +

    + Reports the Flutter outline associated with a single file. +

    +

    + This notification is not subscribed to by default. Clients + can subscribe by including the value "OUTLINE" in + the list of services passed in an flutter.setSubscriptions + request. +

    + +

    parameters:

    file: FilePath
    + +

    + The file with which the outline is associated. +

    +
    outline: FlutterOutline
    + +

    + The outline associated with the file. +

    +

    Types

    @@ -3699,7 +3785,149 @@

    Types

    not absolute or is not normalized, then an error of type INVALID_FILE_PATH_FORMAT will be generated.

    -
    FoldingKind: String
    +
    FlutterOutline: object
    +

    + An node in the Flutter specific outline structure of a file. +

    + +
    kind: FlutterOutlineKind
    + +

    The kind of the node.

    +
    offset: int
    + +

    + The offset of the first character of the element. This is different + than the offset in the Element, which is the offset of the name of the + element. It can be used, for example, to map locations in the file + back to an outline. +

    +
    length: int
    + +

    + The length of the element. +

    +
    codeOffset: int
    + +

    + The offset of the first character of the element code, which is + neither documentation, nor annotation. +

    +
    codeLength: int
    + +

    + The length of the element code. +

    +
    label: String (optional)
    + +

    + The text label of the node children of the node. + It is provided for any FlutterOutlineKind.GENERIC node, + where better information is not available. +

    +
    dartElement: Element (optional)
    + +

    + If this node is a Dart element, the description of it; omitted + otherwise. +

    +
    attributes: List<FlutterOutlineAttribute> (optional)
    + +

    + Additional attributes for this node, which might be interesting + to display on the client. These attributes are usually arguments + for the instance creation or the invocation that created the widget. +

    +
    className: String (optional)
    + +

    + If the node creates a new class instance, or a reference to an + instance, this field has the name of the class. +

    +
    parentAssociationLabel: String (optional)
    + +

    + A short text description how this node is associated with the parent + node. For example "appBar" or "body" in Scaffold. +

    +
    variableName: String (optional)
    + +

    + If FlutterOutlineKind.VARIABLE, the name of the variable. +

    +
    children: List<FlutterOutline> (optional)
    + +

    + The children of the node. The field will be omitted if the node has no + children. +

    +
    FlutterOutlineAttribute: object
    +

    + An attribute for a FlutterOutline. +

    + +
    name: String
    + +

    + The name of the attribute. +

    +
    label: String
    + +

    + The label of the attribute value, usually the Dart code. + It might be quite long, the client should abbreviate as needed. +

    +
    literalValueBoolean: bool (optional)
    + +

    + The boolean literal value of the attribute. + This field is absent if the value is not a boolean literal. +

    +
    literalValueInteger: int (optional)
    + +

    + The integer literal value of the attribute. + This field is absent if the value is not an integer literal. +

    +
    literalValueString: String (optional)
    + +

    + The string literal value of the attribute. + This field is absent if the value is not a string literal. +

    +
    FlutterOutlineKind: String
    +

    + An enumeration of the kinds of FlutterOutline elements. The list of kinds + might be expanded with time, clients must be able to handle new kinds + in some general way. +

    + +
    DART_ELEMENT
    + +

    A dart element declaration.

    +
    GENERIC
    + +

    A generic Flutter element, without additional information.

    +
    NEW_INSTANCE
    + +

    A new instance creation.

    +
    INVOCATION
    + +

    An invocation of a method, a top-level function, a function + expression, etc.

    +
    VARIABLE
    + +

    A reference to a local variable, or a field.

    +
    PLACEHOLDER
    + +

    The parent node has a required Widget. The node works as a + placeholder child to drop a new Widget to.

    +
    FlutterService: String
    +

    + An enumeration of the services provided by the flutter domain that + are related to a specific list of files. +

    + +
    OUTLINE
    FoldingKind: String

    An enumeration of the kinds of folding regions.

    @@ -5536,7 +5764,7 @@

    Errors

    TODO: TBD

    Index

    -

    Domains

    server ()

    analysis ()

    completion ()

    search ()

    edit ()

    execution ()

    diagnostic ()

    Types ()

    Refactorings ()

    +

    Domains

    server ()

    analysis ()

    completion ()

    search ()

    edit ()

    execution ()

    diagnostic ()

    flutter ()

    Requests
    Notifications

    Types ()

    Refactorings ()

    \ No newline at end of file diff --git a/pkg/analysis_server/lib/protocol/protocol_constants.dart b/pkg/analysis_server/lib/protocol/protocol_constants.dart index 2d93ddb70632..519bccd9abef 100644 --- a/pkg/analysis_server/lib/protocol/protocol_constants.dart +++ b/pkg/analysis_server/lib/protocol/protocol_constants.dart @@ -276,20 +276,9 @@ const String EXECUTION_RESPONSE_MAP_URI_FILE = 'file'; const String EXECUTION_RESPONSE_MAP_URI_URI = 'uri'; const String FLUTTER_NOTIFICATION_OUTLINE = 'flutter.outline'; const String FLUTTER_NOTIFICATION_OUTLINE_FILE = 'file'; -const String FLUTTER_NOTIFICATION_OUTLINE_INSTRUMENTED_CODE = - 'instrumentedCode'; const String FLUTTER_NOTIFICATION_OUTLINE_OUTLINE = 'outline'; -const String FLUTTER_REQUEST_GET_CHANGE_ADD_FOR_DESIGN_TIME_CONSTRUCTOR = - 'flutter.getChangeAddForDesignTimeConstructor'; -const String FLUTTER_REQUEST_GET_CHANGE_ADD_FOR_DESIGN_TIME_CONSTRUCTOR_FILE = - 'file'; -const String FLUTTER_REQUEST_GET_CHANGE_ADD_FOR_DESIGN_TIME_CONSTRUCTOR_OFFSET = - 'offset'; const String FLUTTER_REQUEST_SET_SUBSCRIPTIONS = 'flutter.setSubscriptions'; const String FLUTTER_REQUEST_SET_SUBSCRIPTIONS_SUBSCRIPTIONS = 'subscriptions'; -const String - FLUTTER_RESPONSE_GET_CHANGE_ADD_FOR_DESIGN_TIME_CONSTRUCTOR_CHANGE = - 'change'; const String KYTHE_REQUEST_GET_KYTHE_ENTRIES = 'kythe.getKytheEntries'; const String KYTHE_REQUEST_GET_KYTHE_ENTRIES_FILE = 'file'; const String KYTHE_RESPONSE_GET_KYTHE_ENTRIES_ENTRIES = 'entries'; diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart index 45a219f53f8c..c76a9bb0bdd7 100644 --- a/pkg/analysis_server/lib/protocol/protocol_generated.dart +++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart @@ -14443,210 +14443,6 @@ class FileKind implements Enum { String toJson() => name; } -/** - * flutter.getChangeAddForDesignTimeConstructor params - * - * { - * "file": FilePath - * "offset": int - * } - * - * Clients may not extend, implement or mix-in this class. - */ -class FlutterGetChangeAddForDesignTimeConstructorParams - implements RequestParams { - String _file; - - int _offset; - - /** - * The file containing the code of the class. - */ - String get file => _file; - - /** - * The file containing the code of the class. - */ - void set file(String value) { - assert(value != null); - this._file = value; - } - - /** - * The offset of the class in the code. - */ - int get offset => _offset; - - /** - * The offset of the class in the code. - */ - void set offset(int value) { - assert(value != null); - this._offset = value; - } - - FlutterGetChangeAddForDesignTimeConstructorParams(String file, int offset) { - this.file = file; - this.offset = offset; - } - - factory FlutterGetChangeAddForDesignTimeConstructorParams.fromJson( - JsonDecoder jsonDecoder, String jsonPath, Object json) { - if (json == null) { - json = {}; - } - if (json is Map) { - String file; - if (json.containsKey("file")) { - file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); - } else { - throw jsonDecoder.mismatch(jsonPath, "file"); - } - int offset; - if (json.containsKey("offset")) { - offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); - } else { - throw jsonDecoder.mismatch(jsonPath, "offset"); - } - return new FlutterGetChangeAddForDesignTimeConstructorParams( - file, offset); - } else { - throw jsonDecoder.mismatch(jsonPath, - "flutter.getChangeAddForDesignTimeConstructor params", json); - } - } - - factory FlutterGetChangeAddForDesignTimeConstructorParams.fromRequest( - Request request) { - return new FlutterGetChangeAddForDesignTimeConstructorParams.fromJson( - new RequestDecoder(request), "params", request.params); - } - - @override - Map toJson() { - Map result = {}; - result["file"] = file; - result["offset"] = offset; - return result; - } - - @override - Request toRequest(String id) { - return new Request( - id, "flutter.getChangeAddForDesignTimeConstructor", toJson()); - } - - @override - String toString() => json.encode(toJson()); - - @override - bool operator ==(other) { - if (other is FlutterGetChangeAddForDesignTimeConstructorParams) { - return file == other.file && offset == other.offset; - } - return false; - } - - @override - int get hashCode { - int hash = 0; - hash = JenkinsSmiHash.combine(hash, file.hashCode); - hash = JenkinsSmiHash.combine(hash, offset.hashCode); - return JenkinsSmiHash.finish(hash); - } -} - -/** - * flutter.getChangeAddForDesignTimeConstructor result - * - * { - * "change": SourceChange - * } - * - * Clients may not extend, implement or mix-in this class. - */ -class FlutterGetChangeAddForDesignTimeConstructorResult - implements ResponseResult { - SourceChange _change; - - /** - * The change that adds the forDesignTime() constructor. If the change cannot - * be produced, an error is returned. - */ - SourceChange get change => _change; - - /** - * The change that adds the forDesignTime() constructor. If the change cannot - * be produced, an error is returned. - */ - void set change(SourceChange value) { - assert(value != null); - this._change = value; - } - - FlutterGetChangeAddForDesignTimeConstructorResult(SourceChange change) { - this.change = change; - } - - factory FlutterGetChangeAddForDesignTimeConstructorResult.fromJson( - JsonDecoder jsonDecoder, String jsonPath, Object json) { - if (json == null) { - json = {}; - } - if (json is Map) { - SourceChange change; - if (json.containsKey("change")) { - change = new SourceChange.fromJson( - jsonDecoder, jsonPath + ".change", json["change"]); - } else { - throw jsonDecoder.mismatch(jsonPath, "change"); - } - return new FlutterGetChangeAddForDesignTimeConstructorResult(change); - } else { - throw jsonDecoder.mismatch(jsonPath, - "flutter.getChangeAddForDesignTimeConstructor result", json); - } - } - - factory FlutterGetChangeAddForDesignTimeConstructorResult.fromResponse( - Response response) { - return new FlutterGetChangeAddForDesignTimeConstructorResult.fromJson( - new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), - "result", - response.result); - } - - @override - Map toJson() { - Map result = {}; - result["change"] = change.toJson(); - return result; - } - - @override - Response toResponse(String id) { - return new Response(id, result: toJson()); - } - - @override - String toString() => json.encode(toJson()); - - @override - bool operator ==(other) { - if (other is FlutterGetChangeAddForDesignTimeConstructorResult) { - return change == other.change; - } - return false; - } - - @override - int get hashCode { - int hash = 0; - hash = JenkinsSmiHash.combine(hash, change.hashCode); - return JenkinsSmiHash.finish(hash); - } -} - /** * FlutterOutline * @@ -14663,12 +14459,6 @@ class FlutterGetChangeAddForDesignTimeConstructorResult * "parentAssociationLabel": optional String * "variableName": optional String * "children": optional List - * "id": optional int - * "isWidgetClass": optional bool - * "renderConstructor": optional String - * "stateClassName": optional String - * "stateOffset": optional int - * "stateLength": optional int * } * * Clients may not extend, implement or mix-in this class. @@ -14698,18 +14488,6 @@ class FlutterOutline implements HasToJson { List _children; - int _id; - - bool _isWidgetClass; - - String _renderConstructor; - - String _stateClassName; - - int _stateOffset; - - int _stateLength; - /** * The kind of the node. */ @@ -14881,102 +14659,6 @@ class FlutterOutline implements HasToJson { this._children = value; } - /** - * If the node is a widget, and it is instrumented, the unique identifier of - * this widget, that can be used to associate rendering information with this - * node. - */ - int get id => _id; - - /** - * If the node is a widget, and it is instrumented, the unique identifier of - * this widget, that can be used to associate rendering information with this - * node. - */ - void set id(int value) { - this._id = value; - } - - /** - * True if the node is a widget class, so it can potentially be rendered, - * even if it does not yet have the rendering constructor. This field is - * omitted if the node is not a widget class. - */ - bool get isWidgetClass => _isWidgetClass; - - /** - * True if the node is a widget class, so it can potentially be rendered, - * even if it does not yet have the rendering constructor. This field is - * omitted if the node is not a widget class. - */ - void set isWidgetClass(bool value) { - this._isWidgetClass = value; - } - - /** - * If the node is a widget class that can be rendered for IDE, the name of - * the constructor that should be used to instantiate the widget. Empty - * string for default constructor. Absent if the node is not a widget class - * that can be rendered. - */ - String get renderConstructor => _renderConstructor; - - /** - * If the node is a widget class that can be rendered for IDE, the name of - * the constructor that should be used to instantiate the widget. Empty - * string for default constructor. Absent if the node is not a widget class - * that can be rendered. - */ - void set renderConstructor(String value) { - this._renderConstructor = value; - } - - /** - * If the node is a StatefulWidget, and its state class is defined in the - * same file, the name of the state class. - */ - String get stateClassName => _stateClassName; - - /** - * If the node is a StatefulWidget, and its state class is defined in the - * same file, the name of the state class. - */ - void set stateClassName(String value) { - this._stateClassName = value; - } - - /** - * If the node is a StatefulWidget that can be rendered, and its state class - * is defined in the same file, the offset of the state class code in the - * file. - */ - int get stateOffset => _stateOffset; - - /** - * If the node is a StatefulWidget that can be rendered, and its state class - * is defined in the same file, the offset of the state class code in the - * file. - */ - void set stateOffset(int value) { - this._stateOffset = value; - } - - /** - * If the node is a StatefulWidget that can be rendered, and its state class - * is defined in the same file, the length of the state class code in the - * file. - */ - int get stateLength => _stateLength; - - /** - * If the node is a StatefulWidget that can be rendered, and its state class - * is defined in the same file, the length of the state class code in the - * file. - */ - void set stateLength(int value) { - this._stateLength = value; - } - FlutterOutline(FlutterOutlineKind kind, int offset, int length, int codeOffset, int codeLength, {String label, @@ -14985,13 +14667,7 @@ class FlutterOutline implements HasToJson { String className, String parentAssociationLabel, String variableName, - List children, - int id, - bool isWidgetClass, - String renderConstructor, - String stateClassName, - int stateOffset, - int stateLength}) { + List children}) { this.kind = kind; this.offset = offset; this.length = length; @@ -15004,12 +14680,6 @@ class FlutterOutline implements HasToJson { this.parentAssociationLabel = parentAssociationLabel; this.variableName = variableName; this.children = children; - this.id = id; - this.isWidgetClass = isWidgetClass; - this.renderConstructor = renderConstructor; - this.stateClassName = stateClassName; - this.stateOffset = stateOffset; - this.stateLength = stateLength; } factory FlutterOutline.fromJson( @@ -15093,35 +14763,6 @@ class FlutterOutline implements HasToJson { (String jsonPath, Object json) => new FlutterOutline.fromJson(jsonDecoder, jsonPath, json)); } - int id; - if (json.containsKey("id")) { - id = jsonDecoder.decodeInt(jsonPath + ".id", json["id"]); - } - bool isWidgetClass; - if (json.containsKey("isWidgetClass")) { - isWidgetClass = jsonDecoder.decodeBool( - jsonPath + ".isWidgetClass", json["isWidgetClass"]); - } - String renderConstructor; - if (json.containsKey("renderConstructor")) { - renderConstructor = jsonDecoder.decodeString( - jsonPath + ".renderConstructor", json["renderConstructor"]); - } - String stateClassName; - if (json.containsKey("stateClassName")) { - stateClassName = jsonDecoder.decodeString( - jsonPath + ".stateClassName", json["stateClassName"]); - } - int stateOffset; - if (json.containsKey("stateOffset")) { - stateOffset = jsonDecoder.decodeInt( - jsonPath + ".stateOffset", json["stateOffset"]); - } - int stateLength; - if (json.containsKey("stateLength")) { - stateLength = jsonDecoder.decodeInt( - jsonPath + ".stateLength", json["stateLength"]); - } return new FlutterOutline(kind, offset, length, codeOffset, codeLength, label: label, dartElement: dartElement, @@ -15129,13 +14770,7 @@ class FlutterOutline implements HasToJson { className: className, parentAssociationLabel: parentAssociationLabel, variableName: variableName, - children: children, - id: id, - isWidgetClass: isWidgetClass, - renderConstructor: renderConstructor, - stateClassName: stateClassName, - stateOffset: stateOffset, - stateLength: stateLength); + children: children); } else { throw jsonDecoder.mismatch(jsonPath, "FlutterOutline", json); } @@ -15173,24 +14808,6 @@ class FlutterOutline implements HasToJson { result["children"] = children.map((FlutterOutline value) => value.toJson()).toList(); } - if (id != null) { - result["id"] = id; - } - if (isWidgetClass != null) { - result["isWidgetClass"] = isWidgetClass; - } - if (renderConstructor != null) { - result["renderConstructor"] = renderConstructor; - } - if (stateClassName != null) { - result["stateClassName"] = stateClassName; - } - if (stateOffset != null) { - result["stateOffset"] = stateOffset; - } - if (stateLength != null) { - result["stateLength"] = stateLength; - } return result; } @@ -15216,13 +14833,7 @@ class FlutterOutline implements HasToJson { parentAssociationLabel == other.parentAssociationLabel && variableName == other.variableName && listEqual(children, other.children, - (FlutterOutline a, FlutterOutline b) => a == b) && - id == other.id && - isWidgetClass == other.isWidgetClass && - renderConstructor == other.renderConstructor && - stateClassName == other.stateClassName && - stateOffset == other.stateOffset && - stateLength == other.stateLength; + (FlutterOutline a, FlutterOutline b) => a == b); } return false; } @@ -15242,12 +14853,6 @@ class FlutterOutline implements HasToJson { hash = JenkinsSmiHash.combine(hash, parentAssociationLabel.hashCode); hash = JenkinsSmiHash.combine(hash, variableName.hashCode); hash = JenkinsSmiHash.combine(hash, children.hashCode); - hash = JenkinsSmiHash.combine(hash, id.hashCode); - hash = JenkinsSmiHash.combine(hash, isWidgetClass.hashCode); - hash = JenkinsSmiHash.combine(hash, renderConstructor.hashCode); - hash = JenkinsSmiHash.combine(hash, stateClassName.hashCode); - hash = JenkinsSmiHash.combine(hash, stateOffset.hashCode); - hash = JenkinsSmiHash.combine(hash, stateLength.hashCode); return JenkinsSmiHash.finish(hash); } } @@ -15555,7 +15160,6 @@ class FlutterOutlineKind implements Enum { * { * "file": FilePath * "outline": FlutterOutline - * "instrumentedCode": optional String * } * * Clients may not extend, implement or mix-in this class. @@ -15565,8 +15169,6 @@ class FlutterOutlineParams implements HasToJson { FlutterOutline _outline; - String _instrumentedCode; - /** * The file with which the outline is associated. */ @@ -15593,29 +15195,9 @@ class FlutterOutlineParams implements HasToJson { this._outline = value; } - /** - * If the file has Flutter widgets that can be rendered, this field has the - * instrumented content of the file, that allows associating widgets with - * corresponding outline nodes. If there are no widgets to render, this field - * is absent. - */ - String get instrumentedCode => _instrumentedCode; - - /** - * If the file has Flutter widgets that can be rendered, this field has the - * instrumented content of the file, that allows associating widgets with - * corresponding outline nodes. If there are no widgets to render, this field - * is absent. - */ - void set instrumentedCode(String value) { - this._instrumentedCode = value; - } - - FlutterOutlineParams(String file, FlutterOutline outline, - {String instrumentedCode}) { + FlutterOutlineParams(String file, FlutterOutline outline) { this.file = file; this.outline = outline; - this.instrumentedCode = instrumentedCode; } factory FlutterOutlineParams.fromJson( @@ -15637,13 +15219,7 @@ class FlutterOutlineParams implements HasToJson { } else { throw jsonDecoder.mismatch(jsonPath, "outline"); } - String instrumentedCode; - if (json.containsKey("instrumentedCode")) { - instrumentedCode = jsonDecoder.decodeString( - jsonPath + ".instrumentedCode", json["instrumentedCode"]); - } - return new FlutterOutlineParams(file, outline, - instrumentedCode: instrumentedCode); + return new FlutterOutlineParams(file, outline); } else { throw jsonDecoder.mismatch(jsonPath, "flutter.outline params", json); } @@ -15659,9 +15235,6 @@ class FlutterOutlineParams implements HasToJson { Map result = {}; result["file"] = file; result["outline"] = outline.toJson(); - if (instrumentedCode != null) { - result["instrumentedCode"] = instrumentedCode; - } return result; } @@ -15675,9 +15248,7 @@ class FlutterOutlineParams implements HasToJson { @override bool operator ==(other) { if (other is FlutterOutlineParams) { - return file == other.file && - outline == other.outline && - instrumentedCode == other.instrumentedCode; + return file == other.file && outline == other.outline; } return false; } @@ -15687,7 +15258,6 @@ class FlutterOutlineParams implements HasToJson { int hash = 0; hash = JenkinsSmiHash.combine(hash, file.hashCode); hash = JenkinsSmiHash.combine(hash, outline.hashCode); - hash = JenkinsSmiHash.combine(hash, instrumentedCode.hashCode); return JenkinsSmiHash.finish(hash); } } diff --git a/pkg/analysis_server/lib/src/flutter/flutter_correction.dart b/pkg/analysis_server/lib/src/flutter/flutter_correction.dart index 3f92193262a2..d6239cdf7667 100644 --- a/pkg/analysis_server/lib/src/flutter/flutter_correction.dart +++ b/pkg/analysis_server/lib/src/flutter/flutter_correction.dart @@ -2,14 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; - import 'package:analysis_server/src/services/correction/util.dart'; import 'package:analyzer/dart/analysis/results.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/src/dart/ast/utilities.dart'; -import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element; -import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart'; import 'package:meta/meta.dart'; class FlutterCorrections { @@ -39,37 +35,4 @@ class FlutterCorrections { * Returns the EOL to use for this [CompilationUnit]. */ String get eol => utils.endOfLine; - - Future addForDesignTimeConstructor() async { - // TODO(brianwilkerson) Determine whether this await is necessary. - await null; - final node = this.node; - if (node is ClassDeclaration) { - var className = node.name.name; - var location = utils.prepareNewConstructorLocation(node); - var changeBuilder = new DartChangeBuilder(resolveResult.session); - await changeBuilder.addFileEdit(resolveResult.path, (builder) { - builder.addInsertion(location.offset, (builder) { - builder.write(location.prefix); - - // If there are no constructors, we need to add also default. - bool hasConstructors = - node.members.any((m) => m is ConstructorDeclaration); - if (!hasConstructors) { - builder.writeln('$className();'); - builder.writeln(); - builder.write(' '); - } - - builder.writeln('factory $className.forDesignTime() {'); - builder.writeln(' // TODO: add arguments'); - builder.writeln(' return new $className();'); - builder.write(' }'); - builder.write(location.suffix); - }); - }); - return changeBuilder.sourceChange; - } - return null; - } } diff --git a/pkg/analysis_server/lib/src/flutter/flutter_domain.dart b/pkg/analysis_server/lib/src/flutter/flutter_domain.dart index 27d526886e6a..9a20fa250434 100644 --- a/pkg/analysis_server/lib/src/flutter/flutter_domain.dart +++ b/pkg/analysis_server/lib/src/flutter/flutter_domain.dart @@ -2,15 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; - import 'package:analysis_server/protocol/protocol_constants.dart'; import 'package:analysis_server/src/analysis_server.dart'; import 'package:analysis_server/src/domain_abstract.dart'; -import 'package:analysis_server/src/flutter/flutter_correction.dart'; import 'package:analysis_server/src/protocol/protocol_internal.dart'; import 'package:analysis_server/src/protocol_server.dart'; -import 'package:analyzer/dart/analysis/results.dart'; /** * A [RequestHandler] that handles requests in the `flutter` domain. @@ -21,46 +17,10 @@ class FlutterDomainHandler extends AbstractRequestHandler { */ FlutterDomainHandler(AnalysisServer server) : super(server); - /** - * Implement the 'flutter.getChangeAddForDesignTimeConstructor' request. - */ - Future getChangeAddForDesignTimeConstructor(Request request) async { - // TODO(brianwilkerson) Determine whether this await is necessary. - await null; - var params = - new FlutterGetChangeAddForDesignTimeConstructorParams.fromRequest( - request); - String file = params.file; - int offset = params.offset; - - ResolvedUnitResult result = await server.getResolvedUnit(file); - if (result != null) { - var corrections = new FlutterCorrections( - resolveResult: result, - selectionOffset: offset, - selectionLength: 0, - ); - SourceChange change = await corrections.addForDesignTimeConstructor(); - if (change != null) { - server.sendResponse( - new FlutterGetChangeAddForDesignTimeConstructorResult(change) - .toResponse(request.id)); - return; - } - } - server.sendResponse( - new Response.invalidParameter(request, 'file', 'No change')); - } - @override Response handleRequest(Request request) { try { String requestName = request.method; - if (requestName == - FLUTTER_REQUEST_GET_CHANGE_ADD_FOR_DESIGN_TIME_CONSTRUCTOR) { - getChangeAddForDesignTimeConstructor(request); - return Response.DELAYED_RESPONSE; - } if (requestName == FLUTTER_REQUEST_SET_SUBSCRIPTIONS) { return setSubscriptions(request); } diff --git a/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart b/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart index 3cc2d2e612dd..b216613b0fd1 100644 --- a/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart +++ b/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart @@ -16,7 +16,6 @@ void sendFlutterNotificationOutline( var params = new protocol.FlutterOutlineParams( resolvedUnit.path, outline, - instrumentedCode: computer.instrumentedCode, ); server.sendNotification(params.toNotification()); }); diff --git a/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart b/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart index 6330e822765d..3c8c0b1c3302 100644 --- a/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart +++ b/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart @@ -4,44 +4,20 @@ import 'package:analysis_server/src/computer/computer_outline.dart'; import 'package:analysis_server/src/protocol_server.dart' as protocol; -import 'package:analysis_server/src/protocol_server.dart'; import 'package:analysis_server/src/utilities/flutter.dart'; import 'package:analyzer/dart/analysis/results.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/visitor.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; -import 'package:analyzer/src/generated/source.dart'; /// Computer for Flutter specific outlines. class FlutterOutlineComputer { - static const CONSTRUCTOR_NAME = 'forDesignTime'; - - /// Code to append to the instrumented library code. - static const RENDER_APPEND = r''' - -final flutterDesignerWidgets = {}; - -T _registerWidgetInstance(int id, T widget) { - flutterDesignerWidgets[id] = widget; - return widget; -} -'''; - final ResolvedUnitResult resolvedUnit; Flutter flutter; final List _depthFirstOrder = []; - int nextWidgetId = 0; - - /// This map is filled with information about widget classes that can be - /// rendered. Its keys are class name offsets. - final Map widgets = {}; - - final List instrumentationEdits = []; - String instrumentedCode; - FlutterOutlineComputer(this.resolvedUnit); protocol.FlutterOutline compute() { @@ -52,13 +28,6 @@ T _registerWidgetInstance(int id, T widget) { flutter = Flutter.of(resolvedUnit); - // Find widget classes. - // IDEA plugin only supports rendering widgets in libraries. - var unitElement = resolvedUnit.unit.declaredElement; - if (unitElement.source == unitElement.librarySource) { - _findWidgets(); - } - // Convert Dart outlines into Flutter outlines. var flutterDartOutline = _convert(dartOutline); @@ -78,17 +47,6 @@ T _registerWidgetInstance(int id, T widget) { } } - // Compute instrumented code. - if (widgets.values.any((w) => w.hasDesignTimeConstructor)) { - _rewriteRelativeDirectives(); - instrumentationEdits.sort((a, b) => b.offset - a.offset); - instrumentedCode = SourceEdit.applySequence( - resolvedUnit.content, - instrumentationEdits, - ); - instrumentedCode += RENDER_APPEND; - } - return flutterDartOutline; } @@ -137,14 +95,6 @@ T _registerWidgetInstance(int id, T widget) { } } - int _addInstrumentationEdits(Expression expression) { - int id = nextWidgetId++; - instrumentationEdits.add(new protocol.SourceEdit( - expression.offset, 0, '_registerWidgetInstance($id, ')); - instrumentationEdits.add(new protocol.SourceEdit(expression.end, 0, ')')); - return id; - } - protocol.FlutterOutline _convert(protocol.Outline dartOutline) { protocol.FlutterOutline flutterOutline = new protocol.FlutterOutline( protocol.FlutterOutlineKind.DART_ELEMENT, @@ -157,20 +107,6 @@ T _registerWidgetInstance(int id, T widget) { flutterOutline.children = dartOutline.children.map(_convert).toList(); } - // Fill rendering information for widget classes. - if (dartOutline.element.kind == protocol.ElementKind.CLASS) { - var widget = widgets[dartOutline.element.location.offset]; - if (widget != null) { - flutterOutline.isWidgetClass = true; - if (widget.hasDesignTimeConstructor) { - flutterOutline.renderConstructor = CONSTRUCTOR_NAME; - } - flutterOutline.stateClassName = widget.state?.name?.name; - flutterOutline.stateOffset = widget.state?.offset; - flutterOutline.stateLength = widget.state?.length; - } - } - _depthFirstOrder.add(flutterOutline); return flutterOutline; } @@ -187,8 +123,6 @@ T _registerWidgetInstance(int id, T widget) { String className = type.element.displayName; if (node is InstanceCreationExpression) { - int id = _addInstrumentationEdits(node); - var attributes = []; var children = []; for (var argument in node.argumentList.arguments) { @@ -256,8 +190,7 @@ T _registerWidgetInstance(int id, T widget) { node.length, className: className, attributes: attributes, - children: children, - id: id); + children: children); } // A generic Widget typed expression. @@ -275,91 +208,14 @@ T _registerWidgetInstance(int id, T widget) { label = _getShortLabel(node); } - int id = _addInstrumentationEdits(node); return new protocol.FlutterOutline( kind, node.offset, node.length, node.offset, node.length, - className: className, - variableName: variableName, - label: label, - id: id); + className: className, variableName: variableName, label: label); } return null; } - /// Return the `State` declaration for the given `StatefulWidget` declaration. - /// Return `null` if cannot be found. - ClassDeclaration _findState(ClassDeclaration widget) { - MethodDeclaration createStateMethod = widget.members.firstWhere( - (method) => - method is MethodDeclaration && - method.name.name == 'createState' && - method.body != null, - orElse: () => null); - if (createStateMethod == null) { - return null; - } - - DartType stateType; - { - FunctionBody buildBody = createStateMethod.body; - if (buildBody is ExpressionFunctionBody) { - stateType = buildBody.expression.staticType; - } else if (buildBody is BlockFunctionBody) { - List statements = buildBody.block.statements; - if (statements.isNotEmpty) { - Statement lastStatement = statements.last; - if (lastStatement is ReturnStatement) { - stateType = lastStatement.expression?.staticType; - } - } - } - } - if (stateType == null) { - return null; - } - - ClassElement stateElement; - if (stateType is InterfaceType && flutter.isState(stateType.element)) { - stateElement = stateType.element; - } else { - return null; - } - - for (var stateNode in resolvedUnit.unit.declarations) { - if (stateNode is ClassDeclaration && - stateNode.declaredElement == stateElement) { - return stateNode; - } - } - - return null; - } - - /// Fill [widgets] with information about classes that can be rendered. - void _findWidgets() { - for (var widget in resolvedUnit.unit.declarations) { - if (widget is ClassDeclaration) { - int nameOffset = widget.name.offset; - - var designTimeConstructor = widget.getConstructor(CONSTRUCTOR_NAME); - bool hasDesignTimeConstructor = designTimeConstructor != null; - - InterfaceType superType = widget.declaredElement.supertype; - if (flutter.isExactlyStatelessWidgetType(superType)) { - widgets[nameOffset] = - new _WidgetClass(nameOffset, hasDesignTimeConstructor); - } else if (flutter.isExactlyStatefulWidgetType(superType)) { - ClassDeclaration state = _findState(widget); - if (state != null) { - widgets[nameOffset] = - new _WidgetClass(nameOffset, hasDesignTimeConstructor, state); - } - } - } - } - } - String _getShortLabel(AstNode node) { if (node is MethodInvocation) { var buffer = new StringBuffer(); @@ -381,25 +237,6 @@ T _registerWidgetInstance(int id, T widget) { } return node.toString(); } - - /// The instrumented code is put into a temporary directory for Dart VM to - /// run. So, any relative URIs must be changed to corresponding absolute URIs. - void _rewriteRelativeDirectives() { - for (var directive in resolvedUnit.unit.directives) { - if (directive is UriBasedDirective) { - String uriContent = directive.uriContent; - Source source = directive.uriSource; - if (uriContent != null && source != null) { - try { - if (!Uri.parse(uriContent).isAbsolute) { - instrumentationEdits.add(new SourceEdit(directive.uri.offset, - directive.uri.length, "'${source.uri}'")); - } - } on FormatException {} - } - } - } - } } class _FlutterOutlineBuilder extends GeneralizingAstVisitor { @@ -418,16 +255,3 @@ class _FlutterOutlineBuilder extends GeneralizingAstVisitor { } } } - -/// Information about a Widget class that can be rendered. -class _WidgetClass { - final int nameOffset; - - /// Is `true` if has `forDesignTime` constructor, so can be rendered. - final bool hasDesignTimeConstructor; - - /// If a `StatefulWidget` with the `State` in the same file. - final ClassDeclaration state; - - _WidgetClass(this.nameOffset, this.hasDesignTimeConstructor, [this.state]); -} diff --git a/pkg/analysis_server/test/integration/support/integration_test_methods.dart b/pkg/analysis_server/test/integration/support/integration_test_methods.dart index cd4df3ded277..4d3d4d202a26 100644 --- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart +++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart @@ -2580,40 +2580,6 @@ abstract class IntegrationTestMixin { return new KytheGetKytheEntriesResult.fromJson(decoder, 'result', result); } - /** - * Return the change that adds the forDesignTime() constructor for the widget - * class at the given offset. - * - * Parameters - * - * file: FilePath - * - * The file containing the code of the class. - * - * offset: int - * - * The offset of the class in the code. - * - * Returns - * - * change: SourceChange - * - * The change that adds the forDesignTime() constructor. If the change - * cannot be produced, an error is returned. - */ - Future - sendFlutterGetChangeAddForDesignTimeConstructor( - String file, int offset) async { - var params = - new FlutterGetChangeAddForDesignTimeConstructorParams(file, offset) - .toJson(); - var result = await server.send( - "flutter.getChangeAddForDesignTimeConstructor", params); - ResponseDecoder decoder = new ResponseDecoder(null); - return new FlutterGetChangeAddForDesignTimeConstructorResult.fromJson( - decoder, 'result', result); - } - /** * Subscribe for services that are specific to individual files. All previous * subscriptions are replaced by the current set of subscriptions. If a given @@ -2670,13 +2636,6 @@ abstract class IntegrationTestMixin { * outline: FlutterOutline * * The outline associated with the file. - * - * instrumentedCode: String (optional) - * - * If the file has Flutter widgets that can be rendered, this field has the - * instrumented content of the file, that allows associating widgets with - * corresponding outline nodes. If there are no widgets to render, this - * field is absent. */ Stream onFlutterOutline; diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart index 2dc3198fc4ce..cd6a1078b3ff 100644 --- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart +++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart @@ -617,12 +617,6 @@ final Matcher isFilePath = isString; * "parentAssociationLabel": optional String * "variableName": optional String * "children": optional List - * "id": optional int - * "isWidgetClass": optional bool - * "renderConstructor": optional String - * "stateClassName": optional String - * "stateOffset": optional int - * "stateLength": optional int * } */ final Matcher isFlutterOutline = @@ -639,13 +633,7 @@ final Matcher isFlutterOutline = "className": isString, "parentAssociationLabel": isString, "variableName": isString, - "children": isListOf(isFlutterOutline), - "id": isInt, - "isWidgetClass": isBool, - "renderConstructor": isString, - "stateClassName": isString, - "stateOffset": isInt, - "stateLength": isInt + "children": isListOf(isFlutterOutline) })); /** @@ -3026,44 +3014,17 @@ final Matcher isExtractWidgetFeedback = new LazyMatcher( final Matcher isExtractWidgetOptions = new LazyMatcher( () => new MatchesJsonObject("extractWidget options", {"name": isString})); -/** - * flutter.getChangeAddForDesignTimeConstructor params - * - * { - * "file": FilePath - * "offset": int - * } - */ -final Matcher isFlutterGetChangeAddForDesignTimeConstructorParams = - new LazyMatcher(() => new MatchesJsonObject( - "flutter.getChangeAddForDesignTimeConstructor params", - {"file": isFilePath, "offset": isInt})); - -/** - * flutter.getChangeAddForDesignTimeConstructor result - * - * { - * "change": SourceChange - * } - */ -final Matcher isFlutterGetChangeAddForDesignTimeConstructorResult = - new LazyMatcher(() => new MatchesJsonObject( - "flutter.getChangeAddForDesignTimeConstructor result", - {"change": isSourceChange})); - /** * flutter.outline params * * { * "file": FilePath * "outline": FlutterOutline - * "instrumentedCode": optional String * } */ final Matcher isFlutterOutlineParams = new LazyMatcher(() => new MatchesJsonObject("flutter.outline params", - {"file": isFilePath, "outline": isFlutterOutline}, - optionalFields: {"instrumentedCode": isString})); + {"file": isFilePath, "outline": isFlutterOutline})); /** * flutter.setSubscriptions params diff --git a/pkg/analysis_server/test/src/flutter/flutter_correction_test.dart b/pkg/analysis_server/test/src/flutter/flutter_correction_test.dart index 1039fe9abe5d..8f97f5635461 100644 --- a/pkg/analysis_server/test/src/flutter/flutter_correction_test.dart +++ b/pkg/analysis_server/test/src/flutter/flutter_correction_test.dart @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. import 'package:analysis_server/src/flutter/flutter_correction.dart'; -import 'package:analysis_server/src/protocol_server.dart'; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart'; @@ -33,101 +32,26 @@ class FlutterCorrectionTest extends AbstractSingleUnitTest { addFlutterPackage(); } - test_addForDesignTimeConstructor_BAD_notClass() async { - await resolveTestUnit('var v = 42;'); - offset = findOffset('v ='); - _createCorrections(); - - SourceChange change = await corrections.addForDesignTimeConstructor(); - expect(change, isNull); - } - - test_addForDesignTimeConstructor_OK_hasConstructor() async { - await resolveTestUnit(''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatelessWidget { - MyWidget(String text); - - Widget build(BuildContext context) { - return new Container(); - } -} -'''); - offset = findOffset('class MyWidget'); - _createCorrections(); - - SourceChange change = await corrections.addForDesignTimeConstructor(); - _assertChange(change, r''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatelessWidget { - MyWidget(String text); - - factory MyWidget.forDesignTime() { - // TODO: add arguments - return new MyWidget(); - } - - Widget build(BuildContext context) { - return new Container(); - } -} -'''); - } - - test_addForDesignTimeConstructor_OK_noConstructor() async { - await resolveTestUnit(''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatelessWidget { - Widget build(BuildContext context) { - return new Container(); - } -} -'''); - offset = findOffset('class MyWidget'); - _createCorrections(); - - SourceChange change = await corrections.addForDesignTimeConstructor(); - _assertChange(change, r''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatelessWidget { - MyWidget(); - - factory MyWidget.forDesignTime() { - // TODO: add arguments - return new MyWidget(); - } - - Widget build(BuildContext context) { - return new Container(); - } -} -'''); - } - - void _assertChange(SourceChange change, String expectedCode) { - expect(change, isNotNull); - - List files = change.edits; - expect(files, hasLength(1)); - expect(files[0].file, testFile); - - List fileEdits = files[0].edits; - String resultCode = SourceEdit.applySequence(testCode, fileEdits); - if (resultCode != expectedCode) { - print(resultCode); - } - expect(resultCode, expectedCode); - } - - void _createCorrections() { - corrections = new FlutterCorrections( - resolveResult: testAnalysisResult, - selectionOffset: offset, - selectionLength: length, - ); - } +// void _assertChange(SourceChange change, String expectedCode) { +// expect(change, isNotNull); +// +// List files = change.edits; +// expect(files, hasLength(1)); +// expect(files[0].file, testFile); +// +// List fileEdits = files[0].edits; +// String resultCode = SourceEdit.applySequence(testCode, fileEdits); +// if (resultCode != expectedCode) { +// print(resultCode); +// } +// expect(resultCode, expectedCode); +// } +// +// void _createCorrections() { +// corrections = new FlutterCorrections( +// resolveResult: testAnalysisResult, +// selectionOffset: offset, +// selectionLength: length, +// ); +// } } diff --git a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart index 2ab09bd580d8..3cb036f87b71 100644 --- a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart +++ b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart @@ -420,276 +420,6 @@ class MyWidget extends StatelessWidget { '''); } - test_render_BAD_noDesignTimeConstructor() async { - FlutterOutline unitOutline = await _computeOutline(''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatelessWidget { - @override - Widget build(BuildContext context) { - return new Row(); - } -} -'''); - var myWidget = unitOutline.children[0]; - expect(myWidget.isWidgetClass, isTrue); - expect(myWidget.renderConstructor, isNull); - expect(myWidget.stateClassName, isNull); - expect(myWidget.stateOffset, isNull); - expect(myWidget.stateLength, isNull); - - expect(computer.instrumentedCode, isNull); - } - - test_render_BAD_notWidget() async { - FlutterOutline unitOutline = await _computeOutline(''' -class C {} -'''); - var myWidget = unitOutline.children[0]; - expect(myWidget.isWidgetClass, isNull); - expect(myWidget.renderConstructor, isNull); - expect(myWidget.stateClassName, isNull); - expect(myWidget.stateOffset, isNull); - expect(myWidget.stateLength, isNull); - - expect(computer.instrumentedCode, isNull); - } - - test_render_BAD_part() async { - // Use test.dart as a part of a library. - // Add the library to the driver so that it is analyzed before the part. - var libPath = newFile('/home/test/lib/test_lib.dart', content: r''' -part 'test.dart'; -import 'package:flutter/widgets.dart'; -''').path; - driver.addFile(libPath); - - FlutterOutline unitOutline = await _computeOutline(''' -part of 'test_lib.dart'; - -class MyWidget extends StatelessWidget { - MyWidget.forDesignTime(); - - @override - Widget build(BuildContext context) { - return new Row(); - } -} -'''); - - // Analysis is successful, no errors. - expect(resolveResult.errors, isEmpty); - - // No instrumentation, because not a library. - expect(computer.instrumentedCode, isNull); - - // There is forDesignTime() constructor, but we don't handle parts. - var myWidget = unitOutline.children[0]; - expect(myWidget.isWidgetClass, isNull); - expect(myWidget.renderConstructor, isNull); - } - - test_render_instrumentedCode_registerWidgets() async { - await _computeOutline(''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatelessWidget { - MyWidget.forDesignTime(); - - @override - Widget build(BuildContext context) { - return new Row( - children: [ - new Text('aaa'), - new Text('bbb'), - ], - ); - } -} -'''); - expect( - computer.instrumentedCode, - r''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatelessWidget { - MyWidget.forDesignTime(); - - @override - Widget build(BuildContext context) { - return _registerWidgetInstance(0, new Row( - children: [ - _registerWidgetInstance(1, new Text('aaa')), - _registerWidgetInstance(2, new Text('bbb')), - ], - )); - } -} -''' + - FlutterOutlineComputer.RENDER_APPEND); - } - - test_render_instrumentedCode_rewriteUri_file() async { - newFile('/home/test/lib/my_lib.dart'); - - await _computeOutline(''' -import 'package:flutter/widgets.dart'; -import 'my_lib.dart'; - -class MyWidget extends StatelessWidget { - MyWidget.forDesignTime(); - - @override - Widget build(BuildContext context) { - return new Container(); - } -} -'''); - expect( - computer.instrumentedCode, - ''' -import 'package:flutter/widgets.dart'; -import 'package:test/my_lib.dart'; - -class MyWidget extends StatelessWidget { - MyWidget.forDesignTime(); - - @override - Widget build(BuildContext context) { - return _registerWidgetInstance(0, new Container()); - } -} -''' + - FlutterOutlineComputer.RENDER_APPEND); - } - - test_render_instrumentedCode_rewriteUri_package() async { - newFile('/home/test/lib/my_lib.dart'); - - await _computeOutline(''' -import 'package:flutter/widgets.dart'; -import 'my_lib.dart'; - -class MyWidget extends StatelessWidget { - MyWidget.forDesignTime(); - - @override - Widget build(BuildContext context) { - return new Container(); - } -} -'''); - expect( - computer.instrumentedCode, - ''' -import 'package:flutter/widgets.dart'; -import 'package:test/my_lib.dart'; - -class MyWidget extends StatelessWidget { - MyWidget.forDesignTime(); - - @override - Widget build(BuildContext context) { - return _registerWidgetInstance(0, new Container()); - } -} -''' + - FlutterOutlineComputer.RENDER_APPEND); - } - - test_render_stateful_createState_blockBody() async { - FlutterOutline unitOutline = await _computeOutline(''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatefulWidget { - MyWidget.forDesignTime(); - - @override - MyWidgetState createState() { - return new MyWidgetState(); - } -} - -class MyWidgetState extends State { - @override - Widget build(BuildContext context) { - return new Container(), - } -} -'''); - var myWidget = unitOutline.children[0]; - expect(myWidget.renderConstructor, 'forDesignTime'); - expect(myWidget.stateClassName, 'MyWidgetState'); - expect(myWidget.stateOffset, 192); - expect(myWidget.stateLength, 130); - } - - test_render_stateful_createState_expressionBody() async { - FlutterOutline unitOutline = await _computeOutline(''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatefulWidget { - MyWidget.forDesignTime(); - - @override - MyWidgetState createState() => new MyWidgetState(); -} - -class MyWidgetState extends State { - @override - Widget build(BuildContext context) { - return new Container(), - } -} -'''); - var myWidget = unitOutline.children[0]; - expect(myWidget.isWidgetClass, isTrue); - expect(myWidget.renderConstructor, 'forDesignTime'); - expect(myWidget.stateClassName, 'MyWidgetState'); - expect(myWidget.stateOffset, 178); - expect(myWidget.stateLength, 130); - } - - test_render_stateless() async { - FlutterOutline unitOutline = await _computeOutline(''' -import 'package:flutter/widgets.dart'; - -class MyWidget extends StatelessWidget { - MyWidget.forDesignTime(); - - @override - Widget build(BuildContext context) { - return new Row( - children: [ - new Text('aaa'), - new Text('bbb'), - ], - ); - } -} -'''); - var myWidget = unitOutline.children[0]; - expect(myWidget.isWidgetClass, isTrue); - expect(myWidget.renderConstructor, 'forDesignTime'); - expect(myWidget.stateClassName, isNull); - expect(myWidget.stateOffset, isNull); - expect(myWidget.stateLength, isNull); - - var build = myWidget.children[1]; - - var row = build.children[0]; - expect(row.className, 'Row'); - expect(row.id, 0); - - var textA = row.children[0]; - expect(textA.className, 'Text'); - expect(textA.id, 1); - - var textB = row.children[1]; - expect(textB.className, 'Text'); - expect(textB.id, 2); - } - test_variableName() async { FlutterOutline unitOutline = await _computeOutline(''' import 'package:flutter/widgets.dart'; diff --git a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java index 7249cad3984c..157f6d7aaa01 100644 --- a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java +++ b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java @@ -778,17 +778,6 @@ public interface AnalysisServer { */ public void execution_setSubscriptions(List subscriptions); - /** - * {@code flutter.getChangeAddForDesignTimeConstructor} - * - * Return the change that adds the forDesignTime() constructor for the widget class at the given - * offset. - * - * @param file The file containing the code of the class. - * @param offset The offset of the class in the code. - */ - public void flutter_getChangeAddForDesignTimeConstructor(String file, int offset, GetChangeAddForDesignTimeConstructorConsumer consumer); - /** * {@code flutter.setSubscriptions} * diff --git a/pkg/analysis_server/tool/spec/generated/java/types/FlutterOutline.java b/pkg/analysis_server/tool/spec/generated/java/types/FlutterOutline.java index 52029e0d0d52..b711d11fbd32 100644 --- a/pkg/analysis_server/tool/spec/generated/java/types/FlutterOutline.java +++ b/pkg/analysis_server/tool/spec/generated/java/types/FlutterOutline.java @@ -103,47 +103,10 @@ public class FlutterOutline { */ private final List children; - /** - * If the node is a widget, and it is instrumented, the unique identifier of this widget, that can - * be used to associate rendering information with this node. - */ - private final Integer id; - - /** - * True if the node is a widget class, so it can potentially be rendered, even if it does not yet - * have the rendering constructor. This field is omitted if the node is not a widget class. - */ - private final Boolean isWidgetClass; - - /** - * If the node is a widget class that can be rendered for IDE, the name of the constructor that - * should be used to instantiate the widget. Empty string for default constructor. Absent if the - * node is not a widget class that can be rendered. - */ - private final String renderConstructor; - - /** - * If the node is a StatefulWidget, and its state class is defined in the same file, the name of - * the state class. - */ - private final String stateClassName; - - /** - * If the node is a StatefulWidget that can be rendered, and its state class is defined in the same - * file, the offset of the state class code in the file. - */ - private final Integer stateOffset; - - /** - * If the node is a StatefulWidget that can be rendered, and its state class is defined in the same - * file, the length of the state class code in the file. - */ - private final Integer stateLength; - /** * Constructor for {@link FlutterOutline}. */ - public FlutterOutline(String kind, int offset, int length, int codeOffset, int codeLength, String label, Element dartElement, List attributes, String className, String parentAssociationLabel, String variableName, List children, Integer id, Boolean isWidgetClass, String renderConstructor, String stateClassName, Integer stateOffset, Integer stateLength) { + public FlutterOutline(String kind, int offset, int length, int codeOffset, int codeLength, String label, Element dartElement, List attributes, String className, String parentAssociationLabel, String variableName, List children) { this.kind = kind; this.offset = offset; this.length = length; @@ -156,12 +119,6 @@ public FlutterOutline(String kind, int offset, int length, int codeOffset, int c this.parentAssociationLabel = parentAssociationLabel; this.variableName = variableName; this.children = children; - this.id = id; - this.isWidgetClass = isWidgetClass; - this.renderConstructor = renderConstructor; - this.stateClassName = stateClassName; - this.stateOffset = stateOffset; - this.stateLength = stateLength; } @Override @@ -180,13 +137,7 @@ public boolean equals(Object obj) { ObjectUtilities.equals(other.className, className) && ObjectUtilities.equals(other.parentAssociationLabel, parentAssociationLabel) && ObjectUtilities.equals(other.variableName, variableName) && - ObjectUtilities.equals(other.children, children) && - ObjectUtilities.equals(other.id, id) && - ObjectUtilities.equals(other.isWidgetClass, isWidgetClass) && - ObjectUtilities.equals(other.renderConstructor, renderConstructor) && - ObjectUtilities.equals(other.stateClassName, stateClassName) && - ObjectUtilities.equals(other.stateOffset, stateOffset) && - ObjectUtilities.equals(other.stateLength, stateLength); + ObjectUtilities.equals(other.children, children); } return false; } @@ -204,13 +155,7 @@ public static FlutterOutline fromJson(JsonObject jsonObject) { String parentAssociationLabel = jsonObject.get("parentAssociationLabel") == null ? null : jsonObject.get("parentAssociationLabel").getAsString(); String variableName = jsonObject.get("variableName") == null ? null : jsonObject.get("variableName").getAsString(); List children = jsonObject.get("children") == null ? null : FlutterOutline.fromJsonArray(jsonObject.get("children").getAsJsonArray()); - Integer id = jsonObject.get("id") == null ? null : jsonObject.get("id").getAsInt(); - Boolean isWidgetClass = jsonObject.get("isWidgetClass") == null ? null : jsonObject.get("isWidgetClass").getAsBoolean(); - String renderConstructor = jsonObject.get("renderConstructor") == null ? null : jsonObject.get("renderConstructor").getAsString(); - String stateClassName = jsonObject.get("stateClassName") == null ? null : jsonObject.get("stateClassName").getAsString(); - Integer stateOffset = jsonObject.get("stateOffset") == null ? null : jsonObject.get("stateOffset").getAsInt(); - Integer stateLength = jsonObject.get("stateLength") == null ? null : jsonObject.get("stateLength").getAsInt(); - return new FlutterOutline(kind, offset, length, codeOffset, codeLength, label, dartElement, attributes, className, parentAssociationLabel, variableName, children, id, isWidgetClass, renderConstructor, stateClassName, stateOffset, stateLength); + return new FlutterOutline(kind, offset, length, codeOffset, codeLength, label, dartElement, attributes, className, parentAssociationLabel, variableName, children); } public static List fromJsonArray(JsonArray jsonArray) { @@ -271,22 +216,6 @@ public Element getDartElement() { return dartElement; } - /** - * If the node is a widget, and it is instrumented, the unique identifier of this widget, that can - * be used to associate rendering information with this node. - */ - public Integer getId() { - return id; - } - - /** - * True if the node is a widget class, so it can potentially be rendered, even if it does not yet - * have the rendering constructor. This field is omitted if the node is not a widget class. - */ - public Boolean getIsWidgetClass() { - return isWidgetClass; - } - /** * The kind of the node. */ @@ -326,39 +255,6 @@ public String getParentAssociationLabel() { return parentAssociationLabel; } - /** - * If the node is a widget class that can be rendered for IDE, the name of the constructor that - * should be used to instantiate the widget. Empty string for default constructor. Absent if the - * node is not a widget class that can be rendered. - */ - public String getRenderConstructor() { - return renderConstructor; - } - - /** - * If the node is a StatefulWidget, and its state class is defined in the same file, the name of - * the state class. - */ - public String getStateClassName() { - return stateClassName; - } - - /** - * If the node is a StatefulWidget that can be rendered, and its state class is defined in the same - * file, the length of the state class code in the file. - */ - public Integer getStateLength() { - return stateLength; - } - - /** - * If the node is a StatefulWidget that can be rendered, and its state class is defined in the same - * file, the offset of the state class code in the file. - */ - public Integer getStateOffset() { - return stateOffset; - } - /** * If FlutterOutlineKind.VARIABLE, the name of the variable. */ @@ -381,12 +277,6 @@ public int hashCode() { builder.append(parentAssociationLabel); builder.append(variableName); builder.append(children); - builder.append(id); - builder.append(isWidgetClass); - builder.append(renderConstructor); - builder.append(stateClassName); - builder.append(stateOffset); - builder.append(stateLength); return builder.toHashCode(); } @@ -426,24 +316,6 @@ public JsonObject toJson() { } jsonObject.add("children", jsonArrayChildren); } - if (id != null) { - jsonObject.addProperty("id", id); - } - if (isWidgetClass != null) { - jsonObject.addProperty("isWidgetClass", isWidgetClass); - } - if (renderConstructor != null) { - jsonObject.addProperty("renderConstructor", renderConstructor); - } - if (stateClassName != null) { - jsonObject.addProperty("stateClassName", stateClassName); - } - if (stateOffset != null) { - jsonObject.addProperty("stateOffset", stateOffset); - } - if (stateLength != null) { - jsonObject.addProperty("stateLength", stateLength); - } return jsonObject; } @@ -474,19 +346,7 @@ public String toString() { builder.append("variableName="); builder.append(variableName + ", "); builder.append("children="); - builder.append(StringUtils.join(children, ", ") + ", "); - builder.append("id="); - builder.append(id + ", "); - builder.append("isWidgetClass="); - builder.append(isWidgetClass + ", "); - builder.append("renderConstructor="); - builder.append(renderConstructor + ", "); - builder.append("stateClassName="); - builder.append(stateClassName + ", "); - builder.append("stateOffset="); - builder.append(stateOffset + ", "); - builder.append("stateLength="); - builder.append(stateLength); + builder.append(StringUtils.join(children, ", ")); builder.append("]"); return builder.toString(); } diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html index 14ed66479d08..6163f025a984 100644 --- a/pkg/analysis_server/tool/spec/spec_input.html +++ b/pkg/analysis_server/tool/spec/spec_input.html @@ -3141,39 +3141,10 @@

    Options

    - +

    The analysis domain contains API’s related to Flutter support.

    - -

    - Return the change that adds the forDesignTime() constructor for the - widget class at the given offset. -

    - - - FilePath -

    - The file containing the code of the class. -

    -
    - - int -

    - The offset of the class in the code. -

    -
    -
    - - - SourceChange -

    - The change that adds the forDesignTime() constructor. - If the change cannot be produced, an error is returned. -

    -
    -
    -

    Subscribe for services that are specific to individual files. @@ -3227,7 +3198,7 @@

    Options

    - +

    Reports the Flutter outline associated with a single file.

    @@ -3250,15 +3221,6 @@

    Options

    The outline associated with the file.

    - - String -

    - If the file has Flutter widgets that can be rendered, this field - has the instrumented content of the file, that allows associating - widgets with corresponding outline nodes. If there are no widgets - to render, this field is absent. -

    -
    @@ -4080,7 +4042,7 @@

    Types

    PART - +

    An enumeration of the services provided by the flutter domain that are related to a specific list of files. @@ -4089,7 +4051,7 @@

    Types

    OUTLINE
    - +

    An node in the Flutter specific outline structure of a file.

    @@ -4180,57 +4142,9 @@

    Types

    children.

    - - int -

    - If the node is a widget, and it is instrumented, the unique identifier - of this widget, that can be used to associate rendering information - with this node. -

    -
    - - bool -

    - True if the node is a widget class, so it can potentially be - rendered, even if it does not yet have the rendering constructor. - This field is omitted if the node is not a widget class. -

    -
    - - String -

    - If the node is a widget class that can be rendered for IDE, the name - of the constructor that should be used to instantiate the widget. - Empty string for default constructor. Absent if the node is not a - widget class that can be rendered. -

    -
    - - String -

    - If the node is a StatefulWidget, and its state class is defined in - the same file, the name of the state class. -

    -
    - - int -

    - If the node is a StatefulWidget that can be rendered, and its state - class is defined in the same file, the offset of the state class code - in the file. -

    -
    - - int -

    - If the node is a StatefulWidget that can be rendered, and its state - class is defined in the same file, the length of the state class code - in the file. -

    -
    - +

    An attribute for a FlutterOutline.

    @@ -4271,7 +4185,7 @@

    Types

    - +

    An enumeration of the kinds of FlutterOutline elements. The list of kinds might be expanded with time, clients must be able to handle new kinds diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart index 2d93ddb70632..519bccd9abef 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart @@ -276,20 +276,9 @@ const String EXECUTION_RESPONSE_MAP_URI_FILE = 'file'; const String EXECUTION_RESPONSE_MAP_URI_URI = 'uri'; const String FLUTTER_NOTIFICATION_OUTLINE = 'flutter.outline'; const String FLUTTER_NOTIFICATION_OUTLINE_FILE = 'file'; -const String FLUTTER_NOTIFICATION_OUTLINE_INSTRUMENTED_CODE = - 'instrumentedCode'; const String FLUTTER_NOTIFICATION_OUTLINE_OUTLINE = 'outline'; -const String FLUTTER_REQUEST_GET_CHANGE_ADD_FOR_DESIGN_TIME_CONSTRUCTOR = - 'flutter.getChangeAddForDesignTimeConstructor'; -const String FLUTTER_REQUEST_GET_CHANGE_ADD_FOR_DESIGN_TIME_CONSTRUCTOR_FILE = - 'file'; -const String FLUTTER_REQUEST_GET_CHANGE_ADD_FOR_DESIGN_TIME_CONSTRUCTOR_OFFSET = - 'offset'; const String FLUTTER_REQUEST_SET_SUBSCRIPTIONS = 'flutter.setSubscriptions'; const String FLUTTER_REQUEST_SET_SUBSCRIPTIONS_SUBSCRIPTIONS = 'subscriptions'; -const String - FLUTTER_RESPONSE_GET_CHANGE_ADD_FOR_DESIGN_TIME_CONSTRUCTOR_CHANGE = - 'change'; const String KYTHE_REQUEST_GET_KYTHE_ENTRIES = 'kythe.getKytheEntries'; const String KYTHE_REQUEST_GET_KYTHE_ENTRIES_FILE = 'file'; const String KYTHE_RESPONSE_GET_KYTHE_ENTRIES_ENTRIES = 'entries'; diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart index 23f73038c655..3e58f7f570de 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart @@ -14443,210 +14443,6 @@ class FileKind implements Enum { String toJson() => name; } -/** - * flutter.getChangeAddForDesignTimeConstructor params - * - * { - * "file": FilePath - * "offset": int - * } - * - * Clients may not extend, implement or mix-in this class. - */ -class FlutterGetChangeAddForDesignTimeConstructorParams - implements RequestParams { - String _file; - - int _offset; - - /** - * The file containing the code of the class. - */ - String get file => _file; - - /** - * The file containing the code of the class. - */ - void set file(String value) { - assert(value != null); - this._file = value; - } - - /** - * The offset of the class in the code. - */ - int get offset => _offset; - - /** - * The offset of the class in the code. - */ - void set offset(int value) { - assert(value != null); - this._offset = value; - } - - FlutterGetChangeAddForDesignTimeConstructorParams(String file, int offset) { - this.file = file; - this.offset = offset; - } - - factory FlutterGetChangeAddForDesignTimeConstructorParams.fromJson( - JsonDecoder jsonDecoder, String jsonPath, Object json) { - if (json == null) { - json = {}; - } - if (json is Map) { - String file; - if (json.containsKey("file")) { - file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); - } else { - throw jsonDecoder.mismatch(jsonPath, "file"); - } - int offset; - if (json.containsKey("offset")) { - offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); - } else { - throw jsonDecoder.mismatch(jsonPath, "offset"); - } - return new FlutterGetChangeAddForDesignTimeConstructorParams( - file, offset); - } else { - throw jsonDecoder.mismatch(jsonPath, - "flutter.getChangeAddForDesignTimeConstructor params", json); - } - } - - factory FlutterGetChangeAddForDesignTimeConstructorParams.fromRequest( - Request request) { - return new FlutterGetChangeAddForDesignTimeConstructorParams.fromJson( - new RequestDecoder(request), "params", request.params); - } - - @override - Map toJson() { - Map result = {}; - result["file"] = file; - result["offset"] = offset; - return result; - } - - @override - Request toRequest(String id) { - return new Request( - id, "flutter.getChangeAddForDesignTimeConstructor", toJson()); - } - - @override - String toString() => json.encode(toJson()); - - @override - bool operator ==(other) { - if (other is FlutterGetChangeAddForDesignTimeConstructorParams) { - return file == other.file && offset == other.offset; - } - return false; - } - - @override - int get hashCode { - int hash = 0; - hash = JenkinsSmiHash.combine(hash, file.hashCode); - hash = JenkinsSmiHash.combine(hash, offset.hashCode); - return JenkinsSmiHash.finish(hash); - } -} - -/** - * flutter.getChangeAddForDesignTimeConstructor result - * - * { - * "change": SourceChange - * } - * - * Clients may not extend, implement or mix-in this class. - */ -class FlutterGetChangeAddForDesignTimeConstructorResult - implements ResponseResult { - SourceChange _change; - - /** - * The change that adds the forDesignTime() constructor. If the change cannot - * be produced, an error is returned. - */ - SourceChange get change => _change; - - /** - * The change that adds the forDesignTime() constructor. If the change cannot - * be produced, an error is returned. - */ - void set change(SourceChange value) { - assert(value != null); - this._change = value; - } - - FlutterGetChangeAddForDesignTimeConstructorResult(SourceChange change) { - this.change = change; - } - - factory FlutterGetChangeAddForDesignTimeConstructorResult.fromJson( - JsonDecoder jsonDecoder, String jsonPath, Object json) { - if (json == null) { - json = {}; - } - if (json is Map) { - SourceChange change; - if (json.containsKey("change")) { - change = new SourceChange.fromJson( - jsonDecoder, jsonPath + ".change", json["change"]); - } else { - throw jsonDecoder.mismatch(jsonPath, "change"); - } - return new FlutterGetChangeAddForDesignTimeConstructorResult(change); - } else { - throw jsonDecoder.mismatch(jsonPath, - "flutter.getChangeAddForDesignTimeConstructor result", json); - } - } - - factory FlutterGetChangeAddForDesignTimeConstructorResult.fromResponse( - Response response) { - return new FlutterGetChangeAddForDesignTimeConstructorResult.fromJson( - new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), - "result", - response.result); - } - - @override - Map toJson() { - Map result = {}; - result["change"] = change.toJson(); - return result; - } - - @override - Response toResponse(String id) { - return new Response(id, result: toJson()); - } - - @override - String toString() => json.encode(toJson()); - - @override - bool operator ==(other) { - if (other is FlutterGetChangeAddForDesignTimeConstructorResult) { - return change == other.change; - } - return false; - } - - @override - int get hashCode { - int hash = 0; - hash = JenkinsSmiHash.combine(hash, change.hashCode); - return JenkinsSmiHash.finish(hash); - } -} - /** * FlutterOutline * @@ -14663,12 +14459,6 @@ class FlutterGetChangeAddForDesignTimeConstructorResult * "parentAssociationLabel": optional String * "variableName": optional String * "children": optional List - * "id": optional int - * "isWidgetClass": optional bool - * "renderConstructor": optional String - * "stateClassName": optional String - * "stateOffset": optional int - * "stateLength": optional int * } * * Clients may not extend, implement or mix-in this class. @@ -14698,18 +14488,6 @@ class FlutterOutline implements HasToJson { List _children; - int _id; - - bool _isWidgetClass; - - String _renderConstructor; - - String _stateClassName; - - int _stateOffset; - - int _stateLength; - /** * The kind of the node. */ @@ -14881,102 +14659,6 @@ class FlutterOutline implements HasToJson { this._children = value; } - /** - * If the node is a widget, and it is instrumented, the unique identifier of - * this widget, that can be used to associate rendering information with this - * node. - */ - int get id => _id; - - /** - * If the node is a widget, and it is instrumented, the unique identifier of - * this widget, that can be used to associate rendering information with this - * node. - */ - void set id(int value) { - this._id = value; - } - - /** - * True if the node is a widget class, so it can potentially be rendered, - * even if it does not yet have the rendering constructor. This field is - * omitted if the node is not a widget class. - */ - bool get isWidgetClass => _isWidgetClass; - - /** - * True if the node is a widget class, so it can potentially be rendered, - * even if it does not yet have the rendering constructor. This field is - * omitted if the node is not a widget class. - */ - void set isWidgetClass(bool value) { - this._isWidgetClass = value; - } - - /** - * If the node is a widget class that can be rendered for IDE, the name of - * the constructor that should be used to instantiate the widget. Empty - * string for default constructor. Absent if the node is not a widget class - * that can be rendered. - */ - String get renderConstructor => _renderConstructor; - - /** - * If the node is a widget class that can be rendered for IDE, the name of - * the constructor that should be used to instantiate the widget. Empty - * string for default constructor. Absent if the node is not a widget class - * that can be rendered. - */ - void set renderConstructor(String value) { - this._renderConstructor = value; - } - - /** - * If the node is a StatefulWidget, and its state class is defined in the - * same file, the name of the state class. - */ - String get stateClassName => _stateClassName; - - /** - * If the node is a StatefulWidget, and its state class is defined in the - * same file, the name of the state class. - */ - void set stateClassName(String value) { - this._stateClassName = value; - } - - /** - * If the node is a StatefulWidget that can be rendered, and its state class - * is defined in the same file, the offset of the state class code in the - * file. - */ - int get stateOffset => _stateOffset; - - /** - * If the node is a StatefulWidget that can be rendered, and its state class - * is defined in the same file, the offset of the state class code in the - * file. - */ - void set stateOffset(int value) { - this._stateOffset = value; - } - - /** - * If the node is a StatefulWidget that can be rendered, and its state class - * is defined in the same file, the length of the state class code in the - * file. - */ - int get stateLength => _stateLength; - - /** - * If the node is a StatefulWidget that can be rendered, and its state class - * is defined in the same file, the length of the state class code in the - * file. - */ - void set stateLength(int value) { - this._stateLength = value; - } - FlutterOutline(FlutterOutlineKind kind, int offset, int length, int codeOffset, int codeLength, {String label, @@ -14985,13 +14667,7 @@ class FlutterOutline implements HasToJson { String className, String parentAssociationLabel, String variableName, - List children, - int id, - bool isWidgetClass, - String renderConstructor, - String stateClassName, - int stateOffset, - int stateLength}) { + List children}) { this.kind = kind; this.offset = offset; this.length = length; @@ -15004,12 +14680,6 @@ class FlutterOutline implements HasToJson { this.parentAssociationLabel = parentAssociationLabel; this.variableName = variableName; this.children = children; - this.id = id; - this.isWidgetClass = isWidgetClass; - this.renderConstructor = renderConstructor; - this.stateClassName = stateClassName; - this.stateOffset = stateOffset; - this.stateLength = stateLength; } factory FlutterOutline.fromJson( @@ -15093,35 +14763,6 @@ class FlutterOutline implements HasToJson { (String jsonPath, Object json) => new FlutterOutline.fromJson(jsonDecoder, jsonPath, json)); } - int id; - if (json.containsKey("id")) { - id = jsonDecoder.decodeInt(jsonPath + ".id", json["id"]); - } - bool isWidgetClass; - if (json.containsKey("isWidgetClass")) { - isWidgetClass = jsonDecoder.decodeBool( - jsonPath + ".isWidgetClass", json["isWidgetClass"]); - } - String renderConstructor; - if (json.containsKey("renderConstructor")) { - renderConstructor = jsonDecoder.decodeString( - jsonPath + ".renderConstructor", json["renderConstructor"]); - } - String stateClassName; - if (json.containsKey("stateClassName")) { - stateClassName = jsonDecoder.decodeString( - jsonPath + ".stateClassName", json["stateClassName"]); - } - int stateOffset; - if (json.containsKey("stateOffset")) { - stateOffset = jsonDecoder.decodeInt( - jsonPath + ".stateOffset", json["stateOffset"]); - } - int stateLength; - if (json.containsKey("stateLength")) { - stateLength = jsonDecoder.decodeInt( - jsonPath + ".stateLength", json["stateLength"]); - } return new FlutterOutline(kind, offset, length, codeOffset, codeLength, label: label, dartElement: dartElement, @@ -15129,13 +14770,7 @@ class FlutterOutline implements HasToJson { className: className, parentAssociationLabel: parentAssociationLabel, variableName: variableName, - children: children, - id: id, - isWidgetClass: isWidgetClass, - renderConstructor: renderConstructor, - stateClassName: stateClassName, - stateOffset: stateOffset, - stateLength: stateLength); + children: children); } else { throw jsonDecoder.mismatch(jsonPath, "FlutterOutline", json); } @@ -15173,24 +14808,6 @@ class FlutterOutline implements HasToJson { result["children"] = children.map((FlutterOutline value) => value.toJson()).toList(); } - if (id != null) { - result["id"] = id; - } - if (isWidgetClass != null) { - result["isWidgetClass"] = isWidgetClass; - } - if (renderConstructor != null) { - result["renderConstructor"] = renderConstructor; - } - if (stateClassName != null) { - result["stateClassName"] = stateClassName; - } - if (stateOffset != null) { - result["stateOffset"] = stateOffset; - } - if (stateLength != null) { - result["stateLength"] = stateLength; - } return result; } @@ -15216,13 +14833,7 @@ class FlutterOutline implements HasToJson { parentAssociationLabel == other.parentAssociationLabel && variableName == other.variableName && listEqual(children, other.children, - (FlutterOutline a, FlutterOutline b) => a == b) && - id == other.id && - isWidgetClass == other.isWidgetClass && - renderConstructor == other.renderConstructor && - stateClassName == other.stateClassName && - stateOffset == other.stateOffset && - stateLength == other.stateLength; + (FlutterOutline a, FlutterOutline b) => a == b); } return false; } @@ -15242,12 +14853,6 @@ class FlutterOutline implements HasToJson { hash = JenkinsSmiHash.combine(hash, parentAssociationLabel.hashCode); hash = JenkinsSmiHash.combine(hash, variableName.hashCode); hash = JenkinsSmiHash.combine(hash, children.hashCode); - hash = JenkinsSmiHash.combine(hash, id.hashCode); - hash = JenkinsSmiHash.combine(hash, isWidgetClass.hashCode); - hash = JenkinsSmiHash.combine(hash, renderConstructor.hashCode); - hash = JenkinsSmiHash.combine(hash, stateClassName.hashCode); - hash = JenkinsSmiHash.combine(hash, stateOffset.hashCode); - hash = JenkinsSmiHash.combine(hash, stateLength.hashCode); return JenkinsSmiHash.finish(hash); } } @@ -15555,7 +15160,6 @@ class FlutterOutlineKind implements Enum { * { * "file": FilePath * "outline": FlutterOutline - * "instrumentedCode": optional String * } * * Clients may not extend, implement or mix-in this class. @@ -15565,8 +15169,6 @@ class FlutterOutlineParams implements HasToJson { FlutterOutline _outline; - String _instrumentedCode; - /** * The file with which the outline is associated. */ @@ -15593,29 +15195,9 @@ class FlutterOutlineParams implements HasToJson { this._outline = value; } - /** - * If the file has Flutter widgets that can be rendered, this field has the - * instrumented content of the file, that allows associating widgets with - * corresponding outline nodes. If there are no widgets to render, this field - * is absent. - */ - String get instrumentedCode => _instrumentedCode; - - /** - * If the file has Flutter widgets that can be rendered, this field has the - * instrumented content of the file, that allows associating widgets with - * corresponding outline nodes. If there are no widgets to render, this field - * is absent. - */ - void set instrumentedCode(String value) { - this._instrumentedCode = value; - } - - FlutterOutlineParams(String file, FlutterOutline outline, - {String instrumentedCode}) { + FlutterOutlineParams(String file, FlutterOutline outline) { this.file = file; this.outline = outline; - this.instrumentedCode = instrumentedCode; } factory FlutterOutlineParams.fromJson( @@ -15637,13 +15219,7 @@ class FlutterOutlineParams implements HasToJson { } else { throw jsonDecoder.mismatch(jsonPath, "outline"); } - String instrumentedCode; - if (json.containsKey("instrumentedCode")) { - instrumentedCode = jsonDecoder.decodeString( - jsonPath + ".instrumentedCode", json["instrumentedCode"]); - } - return new FlutterOutlineParams(file, outline, - instrumentedCode: instrumentedCode); + return new FlutterOutlineParams(file, outline); } else { throw jsonDecoder.mismatch(jsonPath, "flutter.outline params", json); } @@ -15659,9 +15235,6 @@ class FlutterOutlineParams implements HasToJson { Map result = {}; result["file"] = file; result["outline"] = outline.toJson(); - if (instrumentedCode != null) { - result["instrumentedCode"] = instrumentedCode; - } return result; } @@ -15675,9 +15248,7 @@ class FlutterOutlineParams implements HasToJson { @override bool operator ==(other) { if (other is FlutterOutlineParams) { - return file == other.file && - outline == other.outline && - instrumentedCode == other.instrumentedCode; + return file == other.file && outline == other.outline; } return false; } @@ -15687,7 +15258,6 @@ class FlutterOutlineParams implements HasToJson { int hash = 0; hash = JenkinsSmiHash.combine(hash, file.hashCode); hash = JenkinsSmiHash.combine(hash, outline.hashCode); - hash = JenkinsSmiHash.combine(hash, instrumentedCode.hashCode); return JenkinsSmiHash.finish(hash); } }