Remove support for the deprecated dartfix tool
Change-Id: I848334cab0dbebe121198bc91ade3a8f68c5f7b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index 3aa4e18..f63580d 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -2121,8 +2121,6 @@
-
-
<h3>Requests</h3><dl><dt class="request"><a name="request_edit.format">edit.format</a></dt><dd><div class="box"><pre>request: {
"id": String
"method": "edit.format"
@@ -3084,8 +3082,6 @@
-
-
<dl><dt class="typeDefinition"><a name="type_AddContentOverlay">AddContentOverlay: object</a></dt><dd>
<p>
A directive to begin overlaying the contents of a file. The supplied
@@ -5370,12 +5366,6 @@
An "edit.sortMembers" request specified a Dart file that has
scan or parse errors.
</p>
- </dd><dt class="value">UNKNOWN_FIX</dt><dd>
-
- <p>
- A dartfix request was received containing the name of a fix
- which does not match the name of any known fixes.
- </p>
</dd><dt class="value">UNKNOWN_REQUEST</dt><dd>
<p>
diff --git a/pkg/analysis_server/lib/protocol/protocol_constants.dart b/pkg/analysis_server/lib/protocol/protocol_constants.dart
index c06dbe8..84b3a5c 100644
--- a/pkg/analysis_server/lib/protocol/protocol_constants.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_constants.dart
@@ -163,14 +163,6 @@
const String EDIT_REQUEST_BULK_FIXES = 'edit.bulkFixes';
const String EDIT_REQUEST_BULK_FIXES_INCLUDED = 'included';
const String EDIT_REQUEST_BULK_FIXES_IN_TEST_MODE = 'inTestMode';
-const String EDIT_REQUEST_DARTFIX = 'edit.dartfix';
-const String EDIT_REQUEST_DARTFIX_EXCLUDED_FIXES = 'excludedFixes';
-const String EDIT_REQUEST_DARTFIX_INCLUDED = 'included';
-const String EDIT_REQUEST_DARTFIX_INCLUDED_FIXES = 'includedFixes';
-const String EDIT_REQUEST_DARTFIX_INCLUDE_PEDANTIC_FIXES =
- 'includePedanticFixes';
-const String EDIT_REQUEST_DARTFIX_OUTPUT_DIR = 'outputDir';
-const String EDIT_REQUEST_DARTFIX_PORT = 'port';
const String EDIT_REQUEST_FORMAT = 'edit.format';
const String EDIT_REQUEST_FORMAT_FILE = 'file';
const String EDIT_REQUEST_FORMAT_LINE_LENGTH = 'lineLength';
@@ -185,7 +177,6 @@
const String EDIT_REQUEST_GET_AVAILABLE_REFACTORINGS_FILE = 'file';
const String EDIT_REQUEST_GET_AVAILABLE_REFACTORINGS_LENGTH = 'length';
const String EDIT_REQUEST_GET_AVAILABLE_REFACTORINGS_OFFSET = 'offset';
-const String EDIT_REQUEST_GET_DARTFIX_INFO = 'edit.getDartfixInfo';
const String EDIT_REQUEST_GET_FIXES = 'edit.getFixes';
const String EDIT_REQUEST_GET_FIXES_FILE = 'file';
const String EDIT_REQUEST_GET_FIXES_OFFSET = 'offset';
@@ -221,19 +212,11 @@
const String EDIT_REQUEST_SORT_MEMBERS_FILE = 'file';
const String EDIT_RESPONSE_BULK_FIXES_DETAILS = 'details';
const String EDIT_RESPONSE_BULK_FIXES_EDITS = 'edits';
-const String EDIT_RESPONSE_DARTFIX_DETAILS = 'details';
-const String EDIT_RESPONSE_DARTFIX_EDITS = 'edits';
-const String EDIT_RESPONSE_DARTFIX_HAS_ERRORS = 'hasErrors';
-const String EDIT_RESPONSE_DARTFIX_OTHER_SUGGESTIONS = 'otherSuggestions';
-const String EDIT_RESPONSE_DARTFIX_PORT = 'port';
-const String EDIT_RESPONSE_DARTFIX_SUGGESTIONS = 'suggestions';
-const String EDIT_RESPONSE_DARTFIX_URLS = 'urls';
const String EDIT_RESPONSE_FORMAT_EDITS = 'edits';
const String EDIT_RESPONSE_FORMAT_SELECTION_LENGTH = 'selectionLength';
const String EDIT_RESPONSE_FORMAT_SELECTION_OFFSET = 'selectionOffset';
const String EDIT_RESPONSE_GET_ASSISTS_ASSISTS = 'assists';
const String EDIT_RESPONSE_GET_AVAILABLE_REFACTORINGS_KINDS = 'kinds';
-const String EDIT_RESPONSE_GET_DARTFIX_INFO_FIXES = 'fixes';
const String EDIT_RESPONSE_GET_FIXES_FIXES = 'fixes';
const String EDIT_RESPONSE_GET_POSTFIX_COMPLETION_CHANGE = 'change';
const String EDIT_RESPONSE_GET_REFACTORING_CHANGE = 'change';
diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart
index b434a60..dcb4e02 100644
--- a/pkg/analysis_server/lib/protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart
@@ -5471,145 +5471,6 @@
}
}
-/// DartFix
-///
-/// {
-/// "name": String
-/// "description": optional String
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class DartFix implements HasToJson {
- /// The name of the fix.
- String name;
-
- /// A human readable description of the fix.
- String? description;
-
- DartFix(this.name, {this.description});
-
- factory DartFix.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- String name;
- if (json.containsKey('name')) {
- name = jsonDecoder.decodeString(jsonPath + '.name', json['name']);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'name');
- }
- String? description;
- if (json.containsKey('description')) {
- description = jsonDecoder.decodeString(
- jsonPath + '.description', json['description']);
- }
- return DartFix(name, description: description);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'DartFix', json);
- }
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['name'] = name;
- var description = this.description;
- if (description != null) {
- result['description'] = description;
- }
- return result;
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is DartFix) {
- return name == other.name && description == other.description;
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, description.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
-/// DartFixSuggestion
-///
-/// {
-/// "description": String
-/// "location": optional Location
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class DartFixSuggestion implements HasToJson {
- /// A human readable description of the suggested change.
- String description;
-
- /// The location of the suggested change.
- Location? location;
-
- DartFixSuggestion(this.description, {this.location});
-
- factory DartFixSuggestion.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- String description;
- if (json.containsKey('description')) {
- description = jsonDecoder.decodeString(
- jsonPath + '.description', json['description']);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'description');
- }
- Location? location;
- if (json.containsKey('location')) {
- location = Location.fromJson(
- jsonDecoder, jsonPath + '.location', json['location']);
- }
- return DartFixSuggestion(description, location: location);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'DartFixSuggestion', json);
- }
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['description'] = description;
- var location = this.location;
- if (location != null) {
- result['location'] = location.toJson();
- }
- return result;
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is DartFixSuggestion) {
- return description == other.description && location == other.location;
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, description.hashCode);
- hash = JenkinsSmiHash.combine(hash, location.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
/// diagnostic.getDiagnostics params
///
/// Clients may not extend, implement or mix-in this class.
@@ -5988,354 +5849,6 @@
}
}
-/// edit.dartfix params
-///
-/// {
-/// "included": List<FilePath>
-/// "includedFixes": optional List<String>
-/// "includePedanticFixes": optional bool
-/// "excludedFixes": optional List<String>
-/// "port": optional int
-/// "outputDir": optional FilePath
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class EditDartfixParams implements RequestParams {
- /// A list of the files and directories for which edits should be suggested.
- ///
- /// If a request is made with a path that is invalid, e.g. is not absolute
- /// and normalized, an error of type INVALID_FILE_PATH_FORMAT will be
- /// generated. If a request is made for a file which does not exist, or which
- /// is not currently subject to analysis (e.g. because it is not associated
- /// with any analysis root specified to analysis.setAnalysisRoots), an error
- /// of type FILE_NOT_ANALYZED will be generated.
- List<String> included;
-
- /// A list of names indicating which fixes should be applied.
- ///
- /// If a name is specified that does not match the name of a known fix, an
- /// error of type UNKNOWN_FIX will be generated.
- List<String>? includedFixes;
-
- /// A flag indicating whether "pedantic" fixes should be applied.
- bool? includePedanticFixes;
-
- /// A list of names indicating which fixes should not be applied.
- ///
- /// If a name is specified that does not match the name of a known fix, an
- /// error of type UNKNOWN_FIX will be generated.
- List<String>? excludedFixes;
-
- /// Deprecated: This field is now ignored by server.
- int? port;
-
- /// Deprecated: This field is now ignored by server.
- String? outputDir;
-
- EditDartfixParams(this.included,
- {this.includedFixes,
- this.includePedanticFixes,
- this.excludedFixes,
- this.port,
- this.outputDir});
-
- factory EditDartfixParams.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- List<String> included;
- if (json.containsKey('included')) {
- included = jsonDecoder.decodeList(
- jsonPath + '.included', json['included'], jsonDecoder.decodeString);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'included');
- }
- List<String>? includedFixes;
- if (json.containsKey('includedFixes')) {
- includedFixes = jsonDecoder.decodeList(jsonPath + '.includedFixes',
- json['includedFixes'], jsonDecoder.decodeString);
- }
- bool? includePedanticFixes;
- if (json.containsKey('includePedanticFixes')) {
- includePedanticFixes = jsonDecoder.decodeBool(
- jsonPath + '.includePedanticFixes', json['includePedanticFixes']);
- }
- List<String>? excludedFixes;
- if (json.containsKey('excludedFixes')) {
- excludedFixes = jsonDecoder.decodeList(jsonPath + '.excludedFixes',
- json['excludedFixes'], jsonDecoder.decodeString);
- }
- int? port;
- if (json.containsKey('port')) {
- port = jsonDecoder.decodeInt(jsonPath + '.port', json['port']);
- }
- String? outputDir;
- if (json.containsKey('outputDir')) {
- outputDir = jsonDecoder.decodeString(
- jsonPath + '.outputDir', json['outputDir']);
- }
- return EditDartfixParams(included,
- includedFixes: includedFixes,
- includePedanticFixes: includePedanticFixes,
- excludedFixes: excludedFixes,
- port: port,
- outputDir: outputDir);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edit.dartfix params', json);
- }
- }
-
- factory EditDartfixParams.fromRequest(Request request) {
- return EditDartfixParams.fromJson(
- RequestDecoder(request), 'params', request.params);
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['included'] = included;
- var includedFixes = this.includedFixes;
- if (includedFixes != null) {
- result['includedFixes'] = includedFixes;
- }
- var includePedanticFixes = this.includePedanticFixes;
- if (includePedanticFixes != null) {
- result['includePedanticFixes'] = includePedanticFixes;
- }
- var excludedFixes = this.excludedFixes;
- if (excludedFixes != null) {
- result['excludedFixes'] = excludedFixes;
- }
- var port = this.port;
- if (port != null) {
- result['port'] = port;
- }
- var outputDir = this.outputDir;
- if (outputDir != null) {
- result['outputDir'] = outputDir;
- }
- return result;
- }
-
- @override
- Request toRequest(String id) {
- return Request(id, 'edit.dartfix', toJson());
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is EditDartfixParams) {
- return listEqual(
- included, other.included, (String a, String b) => a == b) &&
- listEqual(includedFixes, other.includedFixes,
- (String a, String b) => a == b) &&
- includePedanticFixes == other.includePedanticFixes &&
- listEqual(excludedFixes, other.excludedFixes,
- (String a, String b) => a == b) &&
- port == other.port &&
- outputDir == other.outputDir;
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, included.hashCode);
- hash = JenkinsSmiHash.combine(hash, includedFixes.hashCode);
- hash = JenkinsSmiHash.combine(hash, includePedanticFixes.hashCode);
- hash = JenkinsSmiHash.combine(hash, excludedFixes.hashCode);
- hash = JenkinsSmiHash.combine(hash, port.hashCode);
- hash = JenkinsSmiHash.combine(hash, outputDir.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
-/// edit.dartfix result
-///
-/// {
-/// "suggestions": List<DartFixSuggestion>
-/// "otherSuggestions": List<DartFixSuggestion>
-/// "hasErrors": bool
-/// "edits": List<SourceFileEdit>
-/// "details": optional List<String>
-/// "port": optional int
-/// "urls": optional List<String>
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class EditDartfixResult implements ResponseResult {
- /// A list of recommended changes that can be automatically made by applying
- /// the 'edits' included in this response.
- List<DartFixSuggestion> suggestions;
-
- /// A list of recommended changes that could not be automatically made.
- List<DartFixSuggestion> otherSuggestions;
-
- /// True if the analyzed source contains errors that might impact the
- /// correctness of the recommended changes that can be automatically applied.
- bool hasErrors;
-
- /// A list of source edits to apply the recommended changes.
- List<SourceFileEdit> edits;
-
- /// Messages that should be displayed to the user that describe details of
- /// the fix generation. For example, the messages might (a) point out details
- /// that users might want to explore before committing the changes or (b)
- /// describe exceptions that were thrown but that did not stop the fixes from
- /// being produced. The list will be omitted if it is empty.
- List<String>? details;
-
- /// The port on which the preview tool will respond to GET requests. The
- /// field is omitted if a preview was not requested.
- int? port;
-
- /// The URLs that users can visit in a browser to see a preview of the
- /// proposed changes. There is one URL for each of the included file paths.
- /// The field is omitted if a preview was not requested.
- List<String>? urls;
-
- EditDartfixResult(
- this.suggestions, this.otherSuggestions, this.hasErrors, this.edits,
- {this.details, this.port, this.urls});
-
- factory EditDartfixResult.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- List<DartFixSuggestion> suggestions;
- if (json.containsKey('suggestions')) {
- suggestions = jsonDecoder.decodeList(
- jsonPath + '.suggestions',
- json['suggestions'],
- (String jsonPath, Object? json) =>
- DartFixSuggestion.fromJson(jsonDecoder, jsonPath, json));
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'suggestions');
- }
- List<DartFixSuggestion> otherSuggestions;
- if (json.containsKey('otherSuggestions')) {
- otherSuggestions = jsonDecoder.decodeList(
- jsonPath + '.otherSuggestions',
- json['otherSuggestions'],
- (String jsonPath, Object? json) =>
- DartFixSuggestion.fromJson(jsonDecoder, jsonPath, json));
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'otherSuggestions');
- }
- bool hasErrors;
- if (json.containsKey('hasErrors')) {
- hasErrors =
- jsonDecoder.decodeBool(jsonPath + '.hasErrors', json['hasErrors']);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'hasErrors');
- }
- List<SourceFileEdit> edits;
- if (json.containsKey('edits')) {
- edits = jsonDecoder.decodeList(
- jsonPath + '.edits',
- json['edits'],
- (String jsonPath, Object? json) =>
- SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edits');
- }
- List<String>? details;
- if (json.containsKey('details')) {
- details = jsonDecoder.decodeList(
- jsonPath + '.details', json['details'], jsonDecoder.decodeString);
- }
- int? port;
- if (json.containsKey('port')) {
- port = jsonDecoder.decodeInt(jsonPath + '.port', json['port']);
- }
- List<String>? urls;
- if (json.containsKey('urls')) {
- urls = jsonDecoder.decodeList(
- jsonPath + '.urls', json['urls'], jsonDecoder.decodeString);
- }
- return EditDartfixResult(suggestions, otherSuggestions, hasErrors, edits,
- details: details, port: port, urls: urls);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edit.dartfix result', json);
- }
- }
-
- factory EditDartfixResult.fromResponse(Response response) {
- return EditDartfixResult.fromJson(
- ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
- 'result',
- response.result);
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['suggestions'] =
- suggestions.map((DartFixSuggestion value) => value.toJson()).toList();
- result['otherSuggestions'] = otherSuggestions
- .map((DartFixSuggestion value) => value.toJson())
- .toList();
- result['hasErrors'] = hasErrors;
- result['edits'] =
- edits.map((SourceFileEdit value) => value.toJson()).toList();
- var details = this.details;
- if (details != null) {
- result['details'] = details;
- }
- var port = this.port;
- if (port != null) {
- result['port'] = port;
- }
- var urls = this.urls;
- if (urls != null) {
- result['urls'] = urls;
- }
- return result;
- }
-
- @override
- Response toResponse(String id) {
- return Response(id, result: toJson());
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is EditDartfixResult) {
- return listEqual(suggestions, other.suggestions,
- (DartFixSuggestion a, DartFixSuggestion b) => a == b) &&
- listEqual(otherSuggestions, other.otherSuggestions,
- (DartFixSuggestion a, DartFixSuggestion b) => a == b) &&
- hasErrors == other.hasErrors &&
- listEqual(edits, other.edits,
- (SourceFileEdit a, SourceFileEdit b) => a == b) &&
- listEqual(details, other.details, (String a, String b) => a == b) &&
- port == other.port &&
- listEqual(urls, other.urls, (String a, String b) => a == b);
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, suggestions.hashCode);
- hash = JenkinsSmiHash.combine(hash, otherSuggestions.hashCode);
- hash = JenkinsSmiHash.combine(hash, hasErrors.hashCode);
- hash = JenkinsSmiHash.combine(hash, edits.hashCode);
- hash = JenkinsSmiHash.combine(hash, details.hashCode);
- hash = JenkinsSmiHash.combine(hash, port.hashCode);
- hash = JenkinsSmiHash.combine(hash, urls.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
/// edit.format params
///
/// {
@@ -6877,130 +6390,6 @@
}
}
-/// edit.getDartfixInfo params
-///
-/// {
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class EditGetDartfixInfoParams implements RequestParams {
- EditGetDartfixInfoParams();
-
- factory EditGetDartfixInfoParams.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- return EditGetDartfixInfoParams();
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edit.getDartfixInfo params', json);
- }
- }
-
- factory EditGetDartfixInfoParams.fromRequest(Request request) {
- return EditGetDartfixInfoParams.fromJson(
- RequestDecoder(request), 'params', request.params);
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- return result;
- }
-
- @override
- Request toRequest(String id) {
- return Request(id, 'edit.getDartfixInfo', toJson());
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is EditGetDartfixInfoParams) {
- return true;
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
-}
-
-/// edit.getDartfixInfo result
-///
-/// {
-/// "fixes": List<DartFix>
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class EditGetDartfixInfoResult implements ResponseResult {
- /// A list of fixes that can be specified in an edit.dartfix request.
- List<DartFix> fixes;
-
- EditGetDartfixInfoResult(this.fixes);
-
- factory EditGetDartfixInfoResult.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- List<DartFix> fixes;
- if (json.containsKey('fixes')) {
- fixes = jsonDecoder.decodeList(
- jsonPath + '.fixes',
- json['fixes'],
- (String jsonPath, Object? json) =>
- DartFix.fromJson(jsonDecoder, jsonPath, json));
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'fixes');
- }
- return EditGetDartfixInfoResult(fixes);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edit.getDartfixInfo result', json);
- }
- }
-
- factory EditGetDartfixInfoResult.fromResponse(Response response) {
- return EditGetDartfixInfoResult.fromJson(
- ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
- 'result',
- response.result);
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['fixes'] = fixes.map((DartFix value) => value.toJson()).toList();
- return result;
- }
-
- @override
- Response toResponse(String id) {
- return Response(id, result: toJson());
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is EditGetDartfixInfoResult) {
- return listEqual(fixes, other.fixes, (DartFix a, DartFix b) => a == b);
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
/// edit.getFixes params
///
/// {
@@ -14269,7 +13658,6 @@
/// SERVER_ERROR
/// SORT_MEMBERS_INVALID_FILE
/// SORT_MEMBERS_PARSE_ERRORS
-/// UNKNOWN_FIX
/// UNKNOWN_REQUEST
/// UNSUPPORTED_FEATURE
/// }
@@ -14436,10 +13824,6 @@
static const RequestErrorCode SORT_MEMBERS_PARSE_ERRORS =
RequestErrorCode._('SORT_MEMBERS_PARSE_ERRORS');
- /// A dartfix request was received containing the name of a fix which does
- /// not match the name of any known fixes.
- static const RequestErrorCode UNKNOWN_FIX = RequestErrorCode._('UNKNOWN_FIX');
-
/// A request was received which the analysis server does not recognize, or
/// cannot handle in its current configuration.
static const RequestErrorCode UNKNOWN_REQUEST =
@@ -14487,7 +13871,6 @@
SERVER_ERROR,
SORT_MEMBERS_INVALID_FILE,
SORT_MEMBERS_PARSE_ERRORS,
- UNKNOWN_FIX,
UNKNOWN_REQUEST,
UNSUPPORTED_FEATURE
];
@@ -14563,8 +13946,6 @@
return SORT_MEMBERS_INVALID_FILE;
case 'SORT_MEMBERS_PARSE_ERRORS':
return SORT_MEMBERS_PARSE_ERRORS;
- case 'UNKNOWN_FIX':
- return UNKNOWN_FIX;
case 'UNKNOWN_REQUEST':
return UNKNOWN_REQUEST;
case 'UNSUPPORTED_FEATURE':
diff --git a/pkg/analysis_server/lib/src/edit/edit_dartfix.dart b/pkg/analysis_server/lib/src/edit/edit_dartfix.dart
deleted file mode 100644
index 6289553..0000000
--- a/pkg/analysis_server/lib/src/edit/edit_dartfix.dart
+++ /dev/null
@@ -1,271 +0,0 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
-// 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 'package:analysis_server/protocol/protocol.dart';
-import 'package:analysis_server/protocol/protocol_generated.dart';
-import 'package:analysis_server/src/analysis_server.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_info.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_listener.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_registrar.dart';
-import 'package:analysis_server/src/edit/fix/fix_code_task.dart';
-import 'package:analysis_server/src/edit/fix/fix_error_task.dart';
-import 'package:analysis_server/src/edit/fix/fix_lint_task.dart';
-import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/analysis/session.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
-import 'package:collection/collection.dart';
-
-class EditDartFix
- with FixCodeProcessor, FixErrorProcessor, FixLintProcessor
- implements DartFixRegistrar {
- final AnalysisServer server;
-
- final Request request;
- final pkgFolders = <Folder>[];
- final fixFolders = <Folder>[];
- final fixFiles = <File>[];
-
- DartFixListener listener;
-
- EditDartFix(this.server, this.request) : listener = DartFixListener(server);
-
- Future<Response> compute() async {
- final params = EditDartfixParams.fromRequest(request);
- // Determine the fixes to be applied
- final fixInfo = <DartFixInfo>[];
- if (params.includePedanticFixes == true) {
- for (var fix in allFixes) {
- if (fix.isPedantic && !fixInfo.contains(fix)) {
- fixInfo.add(fix);
- }
- }
- }
- var includedFixes = params.includedFixes;
- if (includedFixes != null) {
- for (var key in includedFixes) {
- var info = allFixes.firstWhereOrNull((i) => i.key == key);
- if (info != null) {
- fixInfo.add(info);
- } else {
- return Response.invalidParameter(
- request, 'includedFixes', 'Unknown fix: $key');
- }
- }
- }
- var excludedFixes = params.excludedFixes;
- if (excludedFixes != null) {
- for (var key in excludedFixes) {
- var info = allFixes.firstWhereOrNull((i) => i.key == key);
- if (info != null) {
- fixInfo.remove(info);
- } else {
- return Response.invalidParameter(
- request, 'excludedFixes', 'Unknown fix: $key');
- }
- }
- }
- for (var info in fixInfo) {
- info.setup(this, listener, params);
- }
-
- // Validate each included file and directory.
- final resourceProvider = server.resourceProvider;
- final contextManager = server.contextManager;
-
- // Discard any existing analysis so that the linters set below will be
- // used to generate errors that can then be fixed.
- // TODO(danrubel): Rework to use a different approach if this command
- // will be used from within the IDE.
- contextManager.refresh();
-
- for (var filePath in params.included) {
- if (!server.isValidFilePath(filePath)) {
- return Response.invalidFilePathFormat(request, filePath);
- }
-
- var analysisContext = contextManager.getContextFor(filePath);
- if (analysisContext == null) {
- return Response.fileNotAnalyzed(request, filePath);
- }
-
- var res = resourceProvider.getResource(filePath);
- if (!res.exists) {
- return Response.fileNotAnalyzed(request, filePath);
- }
-
- // Set the linters used during analysis. If this command is used from
- // within an IDE, then this will cause the lint results to change.
- // TODO(danrubel): Rework to use a different approach if this command
- // will be used from within the IDE.
- var driver = analysisContext.driver;
- var analysisOptions = driver.analysisOptions as AnalysisOptionsImpl;
- analysisOptions.lint = true;
- analysisOptions.lintRules = linters;
-
- var pkgFolder = analysisContext.contextRoot.root;
- if (!pkgFolders.contains(pkgFolder)) {
- pkgFolders.add(pkgFolder);
- }
-
- if (res is Folder) {
- fixFolders.add(res);
- } else {
- fixFiles.add(res as File);
- }
- }
-
- String? changedPath;
- contextManager.driverMap.values.forEach((driver) {
- // Setup a listener to remember the resource that changed during analysis
- // so it can be reported if there is an InconsistentAnalysisException.
- driver.onCurrentSessionAboutToBeDiscarded = (String? path) {
- changedPath = path;
- };
- });
-
- bool hasErrors;
- try {
- hasErrors = await runAllTasks();
- } on InconsistentAnalysisException catch (_) {
- // If a resource changed, report the problem without suggesting fixes
- var changedMessage = changedPath != null
- ? 'resource changed during analysis: $changedPath'
- : 'multiple resources changed during analysis.';
- return EditDartfixResult(
- [DartFixSuggestion('Analysis canceled because $changedMessage')],
- listener.otherSuggestions,
- false, // We may have errors, but we do not know, and it doesn't matter.
- listener.sourceChange.edits,
- details: listener.details,
- ).toResponse(request.id);
- }
-
- return EditDartfixResult(
- listener.suggestions,
- listener.otherSuggestions,
- hasErrors,
- listener.sourceChange.edits,
- details: listener.details,
- ).toResponse(request.id);
- }
-
- Folder? findPkgFolder(Folder start) {
- for (var folder in start.withAncestors) {
- if (folder.getChild('analysis_options.yaml').exists ||
- folder.getChild('pubspec.yaml').exists) {
- return folder;
- }
- }
- return null;
- }
-
- Set<String> getPathsToProcess() {
- final contextManager = server.contextManager;
- final resourceProvider = server.resourceProvider;
- final resources = <Resource>[];
- for (var rootPath in contextManager.includedPaths) {
- resources.add(resourceProvider.getResource(rootPath));
- }
-
- var pathsToProcess = <String>{};
- while (resources.isNotEmpty) {
- var res = resources.removeLast();
- if (res is Folder) {
- for (var child in res.getChildren()) {
- if (!child.shortName.startsWith('.') &&
- server.isAnalyzed(child.path)) {
- resources.add(child);
- }
- }
- continue;
- }
- if (!isIncluded(res.path)) {
- continue;
- }
- pathsToProcess.add(res.path);
- }
- return pathsToProcess;
- }
-
- /// Return `true` if the path in within the set of `included` files
- /// or is within an `included` directory.
- bool isIncluded(String filePath) {
- for (var file in fixFiles) {
- if (file.path == filePath) {
- return true;
- }
- }
- for (var folder in fixFolders) {
- if (folder.contains(filePath)) {
- return true;
- }
- }
- return false;
- }
-
- /// Call the supplied [process] function to process each compilation unit.
- Future processResources(
- Future<void> Function(ResolvedUnitResult result) process) async {
- final pathsToProcess = getPathsToProcess();
- var pathsProcessed = <String>{};
- for (var path in pathsToProcess) {
- if (pathsProcessed.contains(path)) continue;
- var driver = server.getAnalysisDriver(path);
- if (driver != null) {
- var result = await driver.getResolvedLibrary2(path);
- if (result is ResolvedLibraryResult) {
- for (var unit in result.units!) {
- if (pathsToProcess.contains(unit.path) &&
- !pathsProcessed.contains(unit.path)) {
- await process(unit);
- pathsProcessed.add(unit.path!);
- }
- }
- break;
- }
- }
- }
-
- for (var path in pathsToProcess.difference(pathsProcessed)) {
- var result = await server.getResolvedUnit(path);
- if (result == null || result.unit == null) {
- continue;
- }
- await process(result);
- }
- }
-
- Future<bool> runAllTasks() async {
- // Process each package
- for (var pkgFolder in pkgFolders) {
- await processPackage(pkgFolder);
- }
-
- var hasErrors = false;
-
- // Process each source file.
- try {
- await processResources((ResolvedUnitResult result) async {
- if (await processErrors(result)) {
- hasErrors = true;
- }
- if (numPhases > 0) {
- await processCodeTasks(0, result);
- }
- });
- for (var phase = 1; phase < numPhases; phase++) {
- await processResources((ResolvedUnitResult result) async {
- await processCodeTasks(phase, result);
- });
- }
- await finishCodeTasks();
- } finally {
- server.contextManager.driverMap.values
- .forEach((d) => d.onCurrentSessionAboutToBeDiscarded = null);
- }
-
- return hasErrors;
- }
-}
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index f4f16f9..e7456df 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -11,8 +11,6 @@
import 'package:analysis_server/src/collections.dart';
import 'package:analysis_server/src/computer/import_elements_computer.dart';
import 'package:analysis_server/src/domain_abstract.dart';
-import 'package:analysis_server/src/edit/edit_dartfix.dart' show EditDartFix;
-import 'package:analysis_server/src/edit/fix/dartfix_info.dart' show allFixes;
import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:analysis_server/src/plugin/result_converter.dart';
import 'package:analysis_server/src/protocol_server.dart'
@@ -119,23 +117,6 @@
}
}
- Future dartfix(Request request) async {
- // TODO(danrubel): Add support for dartfix plugins
-
- //
- // Compute fixes
- //
- try {
- var dartFix = EditDartFix(server, request);
- var response = await dartFix.compute();
-
- server.sendResponse(response);
- } catch (exception, stackTrace) {
- server.sendServerErrorNotification('Exception while running dartfix',
- CaughtException(exception, stackTrace), stackTrace);
- }
- }
-
Response format(Request request) {
server.options.analytics?.sendEvent('edit', 'format');
@@ -244,10 +225,6 @@
server.sendResponse(EditGetAssistsResult(changes).toResponse(request.id));
}
- Response getDartfixInfo(Request request) =>
- EditGetDartfixInfoResult(allFixes.map((i) => i.asDartFix()).toList())
- .toResponse(request.id);
-
Future<void> getFixes(Request request) async {
var params = EditGetFixesParams.fromRequest(request);
var file = params.file;
@@ -374,14 +351,9 @@
} else if (requestName == EDIT_REQUEST_BULK_FIXES) {
bulkFixes(request);
return Response.DELAYED_RESPONSE;
- } else if (requestName == EDIT_REQUEST_GET_DARTFIX_INFO) {
- return getDartfixInfo(request);
} else if (requestName == EDIT_REQUEST_GET_FIXES) {
getFixes(request);
return Response.DELAYED_RESPONSE;
- } else if (requestName == EDIT_REQUEST_DARTFIX) {
- dartfix(request);
- return Response.DELAYED_RESPONSE;
} else if (requestName == EDIT_REQUEST_GET_REFACTORING) {
return _getRefactoring(request);
} else if (requestName == EDIT_REQUEST_IMPORT_ELEMENTS) {
diff --git a/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart b/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart
deleted file mode 100644
index 0d4ac07..0000000
--- a/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart
+++ /dev/null
@@ -1,562 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// 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 'package:analysis_server/protocol/protocol_generated.dart'
- show DartFix, EditDartfixParams;
-import 'package:analysis_server/src/edit/edit_dartfix.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_listener.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_registrar.dart';
-import 'package:analysis_server/src/edit/fix/fix_error_task.dart';
-import 'package:analysis_server/src/edit/fix/fix_lint_task.dart';
-import 'package:analysis_server/src/edit/fix/prefer_mixin_fix.dart';
-import 'package:analysis_server/src/services/correction/fix.dart';
-import 'package:analyzer/src/lint/registry.dart';
-import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
-
-final allFixes = <DartFixInfo>[
- //
- // Error and warning fixes.
- //
- DartFixInfo(
- 'wrong_number_of_type_arguments_constructor',
- 'Move named constructor type arguments from the name to the type.',
- FixErrorTask.fixNamedConstructorTypeArgs,
- ),
- //
- // Assist fixes.
- //
- DartFixInfo(
- 'convert_class_to_mixin',
- 'Convert classes used as a mixin to the new mixin syntax.',
- PreferMixinFix.task,
- ),
- //
- // Lint fixes.
- //
- // TODO(brianwilkerson) The commented out fixes below involve potentially
- // non-local changes, so they can't currently be applied together. I have an
- // idea for how to update FixProcessor to support these fixes.
-// LintFixInfo.alwaysDeclareReturnTypes,
-// LintFixInfo.alwaysRequireNonNullNamedParameters
-// LintFixInfo.alwaysSpecifyTypes,
- LintFixInfo.annotateOverrides,
- LintFixInfo.avoidAnnotatingWithDynamic,
- LintFixInfo.avoidEmptyElse,
- LintFixInfo.avoidInitToNull,
- LintFixInfo.avoidRedundantArgumentValues,
- LintFixInfo.avoidRelativeLibImports,
- LintFixInfo.avoidReturnTypesOnSetters,
- LintFixInfo.avoidTypesOnClosureParameters,
- LintFixInfo.awaitOnlyFutures,
- LintFixInfo.curlyBracesInFlowControlStructures,
- LintFixInfo.diagnosticDescribeAllProperties,
- LintFixInfo.emptyCatches,
- LintFixInfo.emptyConstructorBodies,
- LintFixInfo.emptyStatements,
- LintFixInfo.hashAndEquals,
- LintFixInfo.noDuplicateCaseValues,
- LintFixInfo.nonConstantIdentifierNames,
- LintFixInfo.nullClosures,
- LintFixInfo.omitLocalVariableTypes,
- LintFixInfo.preferAdjacentStringConcatenation,
- LintFixInfo.preferCollectionLiterals,
- LintFixInfo.preferConditionalAssignment,
- LintFixInfo.preferConstConstructors,
- LintFixInfo.preferConstConstructorsInImmutables,
- LintFixInfo.preferConstDeclarations,
- LintFixInfo.preferContains,
- LintFixInfo.preferEqualForDefaultValues,
- LintFixInfo.preferFinalFields,
- LintFixInfo.preferFinalLocals,
- LintFixInfo.preferForElementsToMapFromIterable,
- LintFixInfo.preferGenericFunctionTypeAliases,
- LintFixInfo.preferIfElementsToConditionalExpressions,
- LintFixInfo.preferIfNullOperators,
- LintFixInfo.preferInlinedAdds,
- LintFixInfo.preferIntLiterals,
- LintFixInfo.preferIsEmpty,
- LintFixInfo.preferIsNotEmpty,
- LintFixInfo.preferIterableWhereType,
- LintFixInfo.preferNullAwareOperators,
- LintFixInfo.preferRelativeImports,
- LintFixInfo.preferSingleQuotes,
- LintFixInfo.preferSpreadCollections,
- LintFixInfo.slashForDocComments,
- LintFixInfo.sortChildPropertiesLast,
-// LintFixInfo.typeAnnotatePublicApis,
- LintFixInfo.typeInitFormals,
- LintFixInfo.unawaitedFutures,
- LintFixInfo.unnecessaryBraceInStringInterps,
- LintFixInfo.unnecessaryConst,
- LintFixInfo.unnecessaryLambdas,
- LintFixInfo.unnecessaryNew,
- LintFixInfo.unnecessaryOverrides,
- LintFixInfo.unnecessaryThis,
- LintFixInfo.useFunctionTypeSyntaxForParameters,
- LintFixInfo.useRethrowWhenPossible,
-];
-
-/// [DartFixInfo] represents a fix that can be applied by [EditDartFix].
-class DartFixInfo {
- /// The key provided on the command line via the `--fix` option to refer to
- /// this fix.
- final String key;
-
- /// A description of the fix, printed by the `--help` option.
- final String description;
-
- /// A flag indicating whether this fix is related to the lints in the pedantic
- /// lint set.
- final bool isPedantic;
-
- final void Function(DartFixRegistrar registrar, DartFixListener listener,
- EditDartfixParams params) _setup;
-
- const DartFixInfo(
- this.key,
- this.description,
- this._setup, {
- this.isPedantic = false,
- });
-
- /// Return a newly created fix generated from this fix info.
- DartFix asDartFix() => DartFix(key, description: description);
-
- /// Register this fix with the [registrar] and report progress to the
- /// [listener].
- void setup(DartFixRegistrar registrar, DartFixListener listener,
- EditDartfixParams params) {
- _setup(registrar, listener, params);
- }
-}
-
-/// Information about a fix that applies to a lint.
-class LintFixInfo extends DartFixInfo {
- // TODO(brianwilkerson) Add fixes in FixProcessor for the following pedantic
- // lints:
- // avoid_null_checks_in_equality_operators
- // avoid_shadowing_type_parameters
- // avoid_types_as_parameter_names
- // camel_case_extensions
- // library_names
- // prefer_contains
- // recursive_getters
- // unrelated_type_equality_checks
- // valid_regexps
-
- static final alwaysDeclareReturnTypes = LintFixInfo(
- 'always_declare_return_types',
- DartFixKind.ADD_RETURN_TYPE,
- 'Add a return type where possible.',
- isPedantic: true,
- );
-
- static final alwaysRequireNonNullNamedParameters = LintFixInfo(
- 'always_require_non_null_named_parameters',
- DartFixKind.ADD_REQUIRED,
- 'Add an @required annotation.',
- isPedantic: true,
- );
-
- static final alwaysSpecifyTypes = LintFixInfo(
- 'always_specify_types',
- DartFixKind.ADD_TYPE_ANNOTATION,
- 'Add a type annotation.',
- );
-
- static final annotateOverrides = LintFixInfo(
- 'annotate_overrides',
- DartFixKind.ADD_OVERRIDE,
- 'Add an @override annotation.',
- isPedantic: true,
- );
-
- static final avoidAnnotatingWithDynamic = LintFixInfo(
- 'avoid_annotating_with_dynamic',
- DartFixKind.REMOVE_TYPE_ANNOTATION,
- 'Remove the type annotation.',
- );
-
- static final avoidEmptyElse = LintFixInfo(
- 'avoid_empty_else',
- DartFixKind.REMOVE_EMPTY_ELSE,
- 'Remove the empty else.',
- isPedantic: true,
- );
-
- static final avoidInitToNull = LintFixInfo(
- 'avoid_init_to_null',
- DartFixKind.REMOVE_INITIALIZER,
- 'Remove the initializer.',
- isPedantic: true,
- );
-
- static final avoidRedundantArgumentValues = LintFixInfo(
- 'avoid_redundant_argument_values',
- DartFixKind.REMOVE_ARGUMENT,
- 'Remove the redundant argument.',
- );
-
- static final avoidRelativeLibImports = LintFixInfo(
- 'avoid_relative_lib_imports',
- DartFixKind.CONVERT_TO_PACKAGE_IMPORT,
- 'Convert the import to a package: import.',
- isPedantic: true,
- );
-
- static final avoidReturnTypesOnSetters = LintFixInfo(
- 'avoid_return_types_on_setters',
- DartFixKind.REMOVE_TYPE_ANNOTATION,
- 'Remove the return type.',
- isPedantic: true,
- );
-
- static final avoidTypesOnClosureParameters = LintFixInfo(
- 'avoid_types_on_closure_parameters',
- // Also sometimes fixed by DartFixKind.REPLACE_WITH_IDENTIFIER
- DartFixKind.REMOVE_TYPE_ANNOTATION,
- 'Remove the type annotation.',
- );
-
- static final awaitOnlyFutures = LintFixInfo(
- 'await_only_futures',
- DartFixKind.REMOVE_AWAIT,
- "Remove the 'await'.",
- );
-
- static final curlyBracesInFlowControlStructures = LintFixInfo(
- 'curly_braces_in_flow_control_structures',
- DartFixKind.ADD_CURLY_BRACES,
- 'Add curly braces.',
- isPedantic: true,
- );
-
- static final diagnosticDescribeAllProperties = LintFixInfo(
- 'diagnostic_describe_all_properties',
- DartFixKind.ADD_DIAGNOSTIC_PROPERTY_REFERENCE,
- 'Add a debug reference to this property.',
- );
-
- static final emptyCatches = LintFixInfo(
- 'empty_catches',
- DartFixKind.REMOVE_EMPTY_CATCH,
- 'Remove the empty catch clause.',
- isPedantic: true,
- );
-
- static final emptyConstructorBodies = LintFixInfo(
- 'empty_constructor_bodies',
- DartFixKind.REMOVE_EMPTY_CONSTRUCTOR_BODY,
- 'Remove the empoty catch clause.',
- isPedantic: true,
- );
-
- static final emptyStatements = LintFixInfo(
- 'empty_statements',
- // Also sometimes fixed by DartFixKind.REPLACE_WITH_BRACKETS
- DartFixKind.REMOVE_EMPTY_STATEMENT,
- 'Remove the empty statement.',
- );
-
- static final hashAndEquals = LintFixInfo(
- 'hash_and_equals',
- DartFixKind.CREATE_METHOD,
- 'Create the missing method.',
- );
-
- static final noDuplicateCaseValues = LintFixInfo(
- 'no_duplicate_case_values',
- DartFixKind.REMOVE_DUPLICATE_CASE,
- 'Remove the duplicate case clause.',
- isPedantic: true,
- );
-
- static final nonConstantIdentifierNames = LintFixInfo(
- 'non_constant_identifier_names',
- DartFixKind.RENAME_TO_CAMEL_CASE,
- 'Change the name to be camelCase.',
- );
-
- static final nullClosures = LintFixInfo(
- 'null_closures',
- DartFixKind.REPLACE_NULL_WITH_CLOSURE,
- 'Convert nulls to closures that return null where expected.',
- isPedantic: true,
- );
-
- static final omitLocalVariableTypes = LintFixInfo(
- 'omit_local_variable_types',
- DartFixKind.REPLACE_WITH_VAR,
- "Replace the type annotation with 'var'",
- isPedantic: true,
- );
-
- static final preferAdjacentStringConcatenation = LintFixInfo(
- 'prefer_adjacent_string_concatenation',
- DartFixKind.REMOVE_OPERATOR,
- "Remove the '+' operator.",
- isPedantic: true,
- );
-
- static final preferCollectionLiterals = LintFixInfo(
- 'prefer_collection_literals',
- DartFixKind.CONVERT_TO_LIST_LITERAL,
- 'Replace with a collection literal.',
- isPedantic: true,
- );
-
- static final preferConditionalAssignment = LintFixInfo(
- 'prefer_conditional_assignment',
- DartFixKind.REPLACE_WITH_CONDITIONAL_ASSIGNMENT,
- 'Replace with a conditional assignment.',
- isPedantic: true,
- );
-
- static final preferConstConstructors = LintFixInfo(
- 'prefer_const_constructors',
- DartFixKind.ADD_CONST,
- 'Make the instantiation const.',
- );
-
- static final preferConstConstructorsInImmutables = LintFixInfo(
- 'prefer_const_constructors_in_immutables',
- DartFixKind.ADD_CONST,
- 'Make the constructor const.',
- );
-
- static final preferConstDeclarations = LintFixInfo(
- 'prefer_const_declarations',
- DartFixKind.REPLACE_FINAL_WITH_CONST,
- 'Make the declaration const.',
- );
-
- static final preferContains = LintFixInfo(
- 'prefer_contains',
- DartFixKind.CONVERT_TO_CONTAINS,
- "Convert to using 'contains'.",
- isPedantic: true,
- );
-
- static final preferEqualForDefaultValues = LintFixInfo(
- 'prefer_equal_for_default_values',
- DartFixKind.REPLACE_COLON_WITH_EQUALS,
- 'Convert declarations to use = to separate a named parameter from its default value.',
- isPedantic: true,
- );
-
- static final preferFinalFields = LintFixInfo(
- 'prefer_final_fields',
- DartFixKind.MAKE_FINAL,
- 'Make the field final.',
- isPedantic: true,
- );
-
- static final preferFinalLocals = LintFixInfo(
- 'prefer_final_locals',
- DartFixKind.MAKE_FINAL,
- "Make the variable 'final'.",
- );
-
- static final preferForElementsToMapFromIterable = LintFixInfo(
- 'prefer_for_elements_to_map_fromIterable',
- DartFixKind.CONVERT_TO_FOR_ELEMENT,
- 'Convert to a for element.',
- isPedantic: true,
- );
-
- static final preferGenericFunctionTypeAliases = LintFixInfo(
- 'prefer_generic_function_type_aliases',
- DartFixKind.CONVERT_TO_GENERIC_FUNCTION_SYNTAX,
- "Convert into 'Function' syntax",
- isPedantic: true,
- );
-
- static final preferIfElementsToConditionalExpressions = LintFixInfo(
- 'prefer_if_elements_to_conditional_expressions',
- DartFixKind.CONVERT_TO_IF_ELEMENT,
- "Convert to an 'if' element.");
-
- static final preferIfNullOperators = LintFixInfo(
- 'prefer_if_null_operators',
- DartFixKind.CONVERT_TO_IF_NULL,
- "Convert to use '??'.",
- isPedantic: true,
- );
-
- static final preferInlinedAdds = LintFixInfo(
- 'prefer_inlined_adds',
- DartFixKind.INLINE_INVOCATION,
- 'Inline the invocation.',
- );
-
- static final preferIntLiterals = LintFixInfo(
- 'prefer_int_literals',
- DartFixKind.CONVERT_TO_INT_LITERAL,
- 'Convert to an int literal',
- );
-
- static final preferIsEmpty = LintFixInfo(
- 'prefer_is_empty',
- DartFixKind.REPLACE_WITH_IS_EMPTY,
- "Convert to using 'isEmpty' when checking if a collection or iterable is empty.",
- isPedantic: true,
- );
-
- static final preferIsNotEmpty = LintFixInfo(
- 'prefer_is_not_empty',
- DartFixKind.REPLACE_WITH_IS_NOT_EMPTY,
- "Convert to using 'isNotEmpty' when checking if a collection or iterable is not empty.",
- isPedantic: true,
- );
-
- static final preferIterableWhereType = LintFixInfo(
- 'prefer_iterable_whereType',
- DartFixKind.CONVERT_TO_WHERE_TYPE,
- 'Add a return type where possible.',
- isPedantic: true,
- );
-
- static final preferNullAwareOperators = LintFixInfo(
- 'prefer_null_aware_operators',
- DartFixKind.CONVERT_TO_NULL_AWARE,
- "Convert to use '?.'.",
- );
-
- static final preferRelativeImports = LintFixInfo(
- 'prefer_relative_imports',
- DartFixKind.CONVERT_TO_RELATIVE_IMPORT,
- 'Convert to a relative import.',
- );
-
- static final preferSingleQuotes = LintFixInfo(
- 'prefer_single_quotes',
- DartFixKind.CONVERT_TO_SINGLE_QUOTED_STRING,
- 'Convert strings using a double quote to use a single quote.',
- isPedantic: true,
- );
-
- static final preferSpreadCollections = LintFixInfo(
- 'prefer_spread_collections',
- // TODO(brianwilkerson) There are two possible fixes here, but not under
- // user control.
- DartFixKind.CONVERT_TO_SPREAD,
- 'Convert to a spread operator.',
-
- isPedantic: true,
- );
-
- static final slashForDocComments = LintFixInfo(
- 'slash_for_doc_comments',
- DartFixKind.CONVERT_TO_LINE_COMMENT,
- 'Convert to a line comment.',
- isPedantic: true,
- );
-
- static final sortChildPropertiesLast = LintFixInfo(
- 'sort_child_properties_last',
- DartFixKind.SORT_CHILD_PROPERTY_LAST,
- "Move the 'child' argument to the end of the argument list.",
- );
-
- static final typeAnnotatePublicApis = LintFixInfo(
- 'type_annotate_public_apis',
- DartFixKind.ADD_TYPE_ANNOTATION,
- 'Add a type annotation.',
- );
-
- static final typeInitFormals = LintFixInfo(
- 'type_init_formals',
- DartFixKind.REMOVE_TYPE_ANNOTATION,
- 'Remove the type annotation.',
- isPedantic: true,
- );
-
- static final unawaitedFutures = LintFixInfo(
- 'unawaited_futures',
- DartFixKind.ADD_AWAIT,
- 'Add await.',
- isPedantic: true,
- );
-
- static final unnecessaryBraceInStringInterps = LintFixInfo(
- 'unnecessary_brace_in_string_interps',
- DartFixKind.REMOVE_INTERPOLATION_BRACES,
- 'Remove the unnecessary interpolation braces.',
- );
-
- static final unnecessaryConst = LintFixInfo(
- 'unnecessary_const',
- DartFixKind.REMOVE_UNNECESSARY_CONST,
- "Remove unnecessary 'const'' keywords.",
- isPedantic: true,
- );
-
- static final unnecessaryLambdas = LintFixInfo(
- 'unnecessary_lambdas',
- DartFixKind.REPLACE_WITH_TEAR_OFF,
- 'Replace the function literal with a tear-off.',
- );
-
- static final unnecessaryNew = LintFixInfo(
- 'unnecessary_new',
- DartFixKind.REMOVE_UNNECESSARY_NEW,
- "Remove unnecessary 'new' keywords.",
- isPedantic: true,
- );
-
- static final unnecessaryNullInIfNullOperators = LintFixInfo(
- 'unnecessary_null_in_if_null_operators',
- DartFixKind.REMOVE_IF_NULL_OPERATOR,
- "Remove the '??' operator.",
- isPedantic: true,
- );
-
- static final unnecessaryOverrides = LintFixInfo(
- 'unnecessary_overrides',
- DartFixKind.REMOVE_METHOD_DECLARATION,
- 'Remove the unnecessary override.',
- );
-
- static final unnecessaryThis = LintFixInfo(
- 'unnecessary_this',
- DartFixKind.REMOVE_THIS_EXPRESSION,
- 'Remove this.',
- isPedantic: true,
- );
-
- static final useFunctionTypeSyntaxForParameters = LintFixInfo(
- 'use_function_type_syntax_for_parameters',
- DartFixKind.CONVERT_TO_GENERIC_FUNCTION_SYNTAX,
- "Convert into 'Function' syntax",
- isPedantic: true,
- );
-
- static final useRethrowWhenPossible = LintFixInfo(
- 'use_rethrow_when_possible',
- DartFixKind.USE_RETHROW,
- 'Replace with rethrow.',
- isPedantic: true,
- );
-
- /// The name of the lint to be fixed.
- final String lintName;
-
- /// The kind of fix to be applied.
- final FixKind fixKind;
-
- /// Initialize a newly created set of fix information.
- LintFixInfo(
- this.lintName,
- this.fixKind,
- String description, {
- bool isPedantic = false,
- }) : super(lintName, description, (_, __, ___) {}, isPedantic: isPedantic);
-
- @override
- void setup(DartFixRegistrar registrar, DartFixListener listener,
- EditDartfixParams params) {
- registrar.registerLintTask(
- Registry.ruleRegistry[lintName]!, FixLintTask(listener));
- }
-}
diff --git a/pkg/analysis_server/lib/src/edit/fix/dartfix_listener.dart b/pkg/analysis_server/lib/src/edit/fix/dartfix_listener.dart
deleted file mode 100644
index 42868cd..0000000
--- a/pkg/analysis_server/lib/src/edit/fix/dartfix_listener.dart
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// 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 'package:analysis_server/protocol/protocol_generated.dart';
-import 'package:analysis_server/src/analysis_server.dart';
-import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer_plugin/protocol/protocol_common.dart'
- show Location, SourceChange, SourceEdit, SourceFileEdit;
-
-/// Tasks use this API to report results.
-class DartFixListener {
- final AnalysisServer server;
-
- final List<DartFixSuggestion> suggestions = <DartFixSuggestion>[];
- final List<DartFixSuggestion> otherSuggestions = <DartFixSuggestion>[];
-
- final SourceChange sourceChange = SourceChange('dartfix');
-
- /// The details to be returned to the client.
- List<String> details = [];
-
- DartFixListener(this.server);
-
- ResourceProvider get resourceProvider => server.resourceProvider;
-
- /// Record an edit to be sent to the client.
- ///
- /// The associated suggestion should be separately added by calling
- /// [addSuggestion].
- void addEditWithoutSuggestion(Source source, SourceEdit edit) {
- sourceChange.addEdit(source.fullName, -1, edit);
- }
-
- /// Record a recommendation to be sent to the client.
- void addRecommendation(String description, [Location? location]) {
- otherSuggestions.add(DartFixSuggestion(description, location: location));
- }
-
- /// Record a source change to be sent to the client.
- void addSourceChange(
- String description, Location location, SourceChange change) {
- suggestions.add(DartFixSuggestion(description, location: location));
- for (var fileEdit in change.edits) {
- for (var sourceEdit in fileEdit.edits) {
- sourceChange.addEdit(fileEdit.file, fileEdit.fileStamp, sourceEdit);
- }
- }
- }
-
- /// Record edits for a single source to be sent to the client.
- void addSourceEdits(String description, Location location, Source source,
- Iterable<SourceEdit> edits) {
- suggestions.add(DartFixSuggestion(description, location: location));
- for (var edit in edits) {
- sourceChange.addEdit(source.fullName, -1, edit);
- }
- }
-
- /// Record a source change to be sent to the client.
- void addSourceFileEdit(
- String description, Location location, SourceFileEdit fileEdit) {
- suggestions.add(DartFixSuggestion(description, location: location));
- for (var sourceEdit in fileEdit.edits) {
- sourceChange.addEdit(fileEdit.file, fileEdit.fileStamp, sourceEdit);
- }
- }
-
- /// Record a suggestion to be sent to the client.
- ///
- /// The associated edits should be separately added by calling
- /// [addEditWithoutRecommendation].
- void addSuggestion(String description, Location location) {
- suggestions.add(DartFixSuggestion(description, location: location));
- }
-
- /// Return the [Location] representing the specified offset and length
- /// in the given compilation unit.
- Location locationFor(ResolvedUnitResult result, int offset, int length) {
- var lineInfo = result.unit!.lineInfo!;
- var startLocation = lineInfo.getLocation(offset);
- var endLocation = lineInfo.getLocation(offset + length);
- return Location(
- result.path!,
- offset,
- length,
- startLocation.lineNumber,
- startLocation.columnNumber,
- endLocation.lineNumber,
- endLocation.columnNumber);
- }
-}
diff --git a/pkg/analysis_server/lib/src/edit/fix/dartfix_registrar.dart b/pkg/analysis_server/lib/src/edit/fix/dartfix_registrar.dart
deleted file mode 100644
index 07652c0..0000000
--- a/pkg/analysis_server/lib/src/edit/fix/dartfix_registrar.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// 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 'package:analysis_server/src/edit/fix/dartfix_info.dart';
-import 'package:analysis_server/src/edit/fix/fix_code_task.dart';
-import 'package:analysis_server/src/edit/fix/fix_error_task.dart';
-import 'package:analysis_server/src/edit/fix/fix_lint_task.dart';
-import 'package:analyzer/error/error.dart';
-import 'package:analyzer/src/lint/linter.dart';
-
-/// Fixes use this API to register tasks. See [DartFixInfo.setup].
-abstract class DartFixRegistrar {
- /// Register the specified task to analyze and fix problems.
- void registerCodeTask(FixCodeTask task);
-
- /// Register the specified task to fix the given error condition.
- void registerErrorTask(ErrorCode errorCode, FixErrorTask task);
-
- /// Register the specified task to fix the given lint.
- void registerLintTask(LintRule ruleRegistry, FixLintTask task);
-}
diff --git a/pkg/analysis_server/lib/src/edit/fix/fix_code_task.dart b/pkg/analysis_server/lib/src/edit/fix/fix_code_task.dart
deleted file mode 100644
index a4243a9..0000000
--- a/pkg/analysis_server/lib/src/edit/fix/fix_code_task.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// 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:math' show max;
-
-import 'package:analysis_server/src/edit/edit_dartfix.dart';
-import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/file_system/file_system.dart';
-
-/// A processor used by [EditDartFix] to manage [FixCodeTask]s.
-mixin FixCodeProcessor {
- final _codeTasks = <FixCodeTask>[];
-
- int _numPhases = 0;
-
- int get numPhases => _numPhases;
-
- Future<void> finishCodeTasks() async {
- for (var task in _codeTasks) {
- await task.finish();
- }
- }
-
- Future<void> processCodeTasks(int phase, ResolvedUnitResult result) async {
- for (var task in _codeTasks) {
- await task.processUnit(phase, result);
- }
- }
-
- Future<void> processPackage(Folder pkgFolder) async {
- for (var task in _codeTasks) {
- await task.processPackage(pkgFolder);
- }
- }
-
- void registerCodeTask(FixCodeTask task) {
- _codeTasks.add(task);
- _numPhases = max(_numPhases, task.numPhases);
- }
-}
-
-/// A general task for performing a fix.
-abstract class FixCodeTask {
- /// Number of times [processUnit] should be called for each compilation unit.
- int get numPhases;
-
- /// [finish] is called after [processUnit] has been called for each
- /// phase and compilation unit.
- Future<void> finish();
-
- /// [processPackage] is called once for each package
- /// before [processUnit] is called for any compilation unit in any package.
- Future<void> processPackage(Folder pkgFolder);
-
- /// [processUnit] is called for each phase and compilation unit.
- ///
- /// First [processUnit] will be called once for each compilation unit with
- /// [phase] set to 0; then it will be called for each compilation unit with
- /// [phase] set to 1; and so on through `numPhases-1`.
- Future<void> processUnit(int phase, ResolvedUnitResult result);
-}
diff --git a/pkg/analysis_server/lib/src/edit/fix/fix_error_task.dart b/pkg/analysis_server/lib/src/edit/fix/fix_error_task.dart
deleted file mode 100644
index 2896407..0000000
--- a/pkg/analysis_server/lib/src/edit/fix/fix_error_task.dart
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// 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 'package:analysis_server/protocol/protocol_generated.dart';
-import 'package:analysis_server/src/edit/edit_dartfix.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_listener.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_registrar.dart';
-import 'package:analysis_server/src/services/correction/change_workspace.dart';
-import 'package:analysis_server/src/services/correction/fix.dart';
-import 'package:analysis_server/src/services/correction/fix_internal.dart';
-import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/error/error.dart';
-import 'package:analyzer/instrumentation/service.dart';
-import 'package:analyzer/src/error/codes.dart';
-
-/// A processor used by [EditDartFix] to manage [FixErrorTask]s.
-mixin FixErrorProcessor {
- /// A mapping from [ErrorCode] to the fix that should be applied.
- final errorTaskMap = <ErrorCode, FixErrorTask>{};
-
- Future<bool> processErrors(ResolvedUnitResult result) async {
- var foundError = false;
- for (var error in result.errors) {
- final task = errorTaskMap[error.errorCode];
- if (task != null) {
- await task.fixError(result, error);
- } else if (error.errorCode.type == ErrorType.SYNTACTIC_ERROR) {
- foundError = true;
- }
- }
- return foundError;
- }
-
- void registerErrorTask(ErrorCode errorCode, FixErrorTask task) {
- errorTaskMap[errorCode] = task;
- }
-}
-
-/// A task for fixing a particular error
-class FixErrorTask {
- final DartFixListener listener;
-
- FixErrorTask(this.listener);
-
- Future<void> fixError(ResolvedUnitResult result, AnalysisError error) async {
- final workspace = DartChangeWorkspace(listener.server.currentSessions);
- final dartContext = DartFixContextImpl(
- InstrumentationService.NULL_SERVICE,
- workspace,
- result,
- error,
- (name) => [],
- );
- final processor = FixProcessor(dartContext);
- var fix = await processor.computeFix();
- final location = listener.locationFor(result, error.offset, error.length);
- if (fix != null) {
- listener.addSourceChange(fix.change.message, location, fix.change);
- } else {
- // TODO(danrubel): Determine why the fix could not be applied
- // and report that in the description.
- listener.addRecommendation("Couldn't fix \"${error.message}\"", location);
- }
- }
-
- static void fixNamedConstructorTypeArgs(DartFixRegistrar registrar,
- DartFixListener listener, EditDartfixParams params) {
- registrar.registerErrorTask(
- CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
- FixErrorTask(listener));
- }
-}
diff --git a/pkg/analysis_server/lib/src/edit/fix/fix_lint_task.dart b/pkg/analysis_server/lib/src/edit/fix/fix_lint_task.dart
deleted file mode 100644
index 2aac75e..0000000
--- a/pkg/analysis_server/lib/src/edit/fix/fix_lint_task.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// 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 'package:analysis_server/src/edit/edit_dartfix.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_listener.dart';
-import 'package:analysis_server/src/edit/fix/fix_error_task.dart';
-import 'package:analyzer/src/lint/linter.dart';
-import 'package:analyzer/src/services/lint.dart';
-
-/// A processor used by [EditDartFix] to manage [FixLintTask]s.
-mixin FixLintProcessor implements FixErrorProcessor {
- final linters = <Linter>[];
- final lintTasks = <FixLintTask>[];
-
- void registerLintTask(LintRule lint, FixLintTask task) {
- linters.add(lint);
- lintTasks.add(task);
- errorTaskMap[lint.lintCode] = task;
- }
-}
-
-/// A task for fixing a particular lint.
-class FixLintTask extends FixErrorTask {
- FixLintTask(DartFixListener listener) : super(listener);
-}
diff --git a/pkg/analysis_server/lib/src/edit/fix/prefer_mixin_fix.dart b/pkg/analysis_server/lib/src/edit/fix/prefer_mixin_fix.dart
deleted file mode 100644
index 10c0214..0000000
--- a/pkg/analysis_server/lib/src/edit/fix/prefer_mixin_fix.dart
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
-// 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 'package:analysis_server/protocol/protocol_generated.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_listener.dart';
-import 'package:analysis_server/src/edit/fix/dartfix_registrar.dart';
-import 'package:analysis_server/src/edit/fix/fix_code_task.dart';
-import 'package:analysis_server/src/edit/fix/fix_lint_task.dart';
-import 'package:analysis_server/src/services/correction/assist.dart';
-import 'package:analysis_server/src/services/correction/assist_internal.dart';
-import 'package:analysis_server/src/services/correction/change_workspace.dart';
-import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/error/error.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/instrumentation/service.dart';
-import 'package:analyzer/src/dart/ast/utilities.dart';
-import 'package:analyzer/src/lint/registry.dart';
-
-class PreferMixinFix extends FixLintTask implements FixCodeTask {
- final classesToConvert = <Element>{};
-
- PreferMixinFix(DartFixListener listener) : super(listener);
-
- @override
- int get numPhases => 0;
-
- Future<void> convertClassToMixin(Element elem) async {
- var result = await listener.server.getResolvedUnit(elem.source!.fullName);
- if (result == null) {
- return;
- }
-
- for (var declaration in result.unit!.declarations) {
- if (declaration is ClassOrMixinDeclaration &&
- declaration.name.name == elem.name) {
- var processor = AssistProcessor(
- DartAssistContextImpl(
- InstrumentationService.NULL_SERVICE,
- DartChangeWorkspace(listener.server.currentSessions),
- result,
- declaration.name.offset,
- 0),
- );
- var assists = await processor
- .computeAssist(DartAssistKind.CONVERT_CLASS_TO_MIXIN);
- final location =
- listener.locationFor(result, elem.nameOffset, elem.nameLength);
- if (assists.isNotEmpty) {
- for (var assist in assists) {
- listener.addSourceChange('Convert ${elem.displayName} to a mixin',
- location, assist.change);
- }
- } else {
- // TODO(danrubel): If assists is empty, then determine why
- // assist could not be performed and report that in the description.
- listener.addRecommendation(
- "Couldn't convert ${elem.displayName} to a mixin"
- ' because the class contains a constructor',
- location);
- }
- }
- }
- }
-
- @override
- Future<void> finish() async {
- for (var elem in classesToConvert) {
- await convertClassToMixin(elem);
- }
- }
-
- @override
- Future<void> fixError(ResolvedUnitResult result, AnalysisError error) async {
- var node = NodeLocator(error.offset).searchWithin(result.unit);
- if (node == null) {
- return;
- }
- var type = node.thisOrAncestorOfType<TypeName>();
- if (type != null) {
- var element = type.name.staticElement;
- if (element != null && element.source?.fullName != null) {
- classesToConvert.add(element);
- }
- } else {
- // TODO(danrubel): Report if lint does not point to a type name
- final location = listener.locationFor(result, node.offset, node.length);
- listener.addRecommendation(
- 'Cannot not convert $node to a mixin', location);
- }
- }
-
- @override
- Future<void> processPackage(Folder pkgFolder) async {}
-
- @override
- Future<void> processUnit(int phase, ResolvedUnitResult result) async {}
-
- static void task(DartFixRegistrar registrar, DartFixListener listener,
- EditDartfixParams params) {
- var task = PreferMixinFix(listener);
- registrar.registerLintTask(Registry.ruleRegistry['prefer_mixin']!, task);
- registrar.registerCodeTask(task);
- }
-}
diff --git a/pkg/analysis_server/test/domain_edit_dartfix_test.dart b/pkg/analysis_server/test/domain_edit_dartfix_test.dart
deleted file mode 100644
index 5f889d9..0000000
--- a/pkg/analysis_server/test/domain_edit_dartfix_test.dart
+++ /dev/null
@@ -1,340 +0,0 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
-// 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 'package:analysis_server/protocol/protocol.dart';
-import 'package:analysis_server/protocol/protocol_generated.dart';
-import 'package:analysis_server/src/edit/edit_dartfix.dart';
-import 'package:analyzer_plugin/protocol/protocol_common.dart';
-import 'package:linter/src/rules.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'analysis_abstract.dart';
-
-void main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(EditDartfixDomainHandlerTest);
- });
-}
-
-@reflectiveTest
-class EditDartfixDomainHandlerTest extends AbstractAnalysisTest {
- int requestId = 30;
-
- String get nextRequestId => (++requestId).toString();
-
- void expectEdits(List<SourceFileEdit> fileEdits, String expectedSource) {
- expect(fileEdits, hasLength(1));
- expect(fileEdits[0].file, testFile);
- expectFileEdits(testCode, fileEdits[0], expectedSource);
- }
-
- void expectFileEdits(
- String originalSource, SourceFileEdit fileEdit, String expectedSource) {
- var source = SourceEdit.applySequence(originalSource, fileEdit.edits);
- expect(source, expectedSource);
- }
-
- void expectSuggestion(DartFixSuggestion suggestion, String partialText,
- [int? offset, int? length]) {
- expect(suggestion.description, contains(partialText));
- if (offset == null) {
- expect(suggestion.location, isNull);
- } else {
- var location = suggestion.location!;
- expect(location.offset, offset);
- expect(location.length, length);
- }
- }
-
- Future<EditDartfixResult> performFix(
- {List<String>? includedFixes, bool? pedantic}) async {
- var response =
- await performFixRaw(includedFixes: includedFixes, pedantic: pedantic);
- expect(response.error, isNull);
- return EditDartfixResult.fromResponse(response);
- }
-
- Future<Response> performFixRaw(
- {List<String>? includedFixes,
- List<String>? excludedFixes,
- bool? pedantic}) async {
- final id = nextRequestId;
- final params = EditDartfixParams([projectPath]);
- params.includedFixes = includedFixes;
- params.excludedFixes = excludedFixes;
- params.includePedanticFixes = pedantic;
- final request = Request(id, 'edit.dartfix', params.toJson());
-
- var fix = EditDartFix(server, request);
- final response = await fix.compute();
- expect(response.id, id);
- return response;
- }
-
- @override
- void setUp() {
- super.setUp();
- registerLintRules();
- testFile = resourceProvider.convertPath('/project/lib/fileToBeFixed.dart');
- }
-
- Future<void> test_collection_if_elements() async {
- addTestFile('''
-f(bool b) {
- return ['a', b ? 'c' : 'd', 'e'];
-}
-''');
- createProject();
- var result = await performFix(
- includedFixes: ['prefer_if_elements_to_conditional_expressions']);
- expect(result.suggestions.length, greaterThanOrEqualTo(1));
- expect(result.hasErrors, isFalse);
- expectEdits(result.edits, '''
-f(bool b) {
- return ['a', if (b) 'c' else 'd', 'e'];
-}
-''');
- }
-
- Future<void> test_excludedFix_invalid() async {
- addTestFile('''
-const double myDouble = 42.0;
- ''');
- createProject();
-
- final result = await performFixRaw(excludedFixes: ['not_a_fix']);
- expect(result.error, isNotNull);
- }
-
- Future<void> test_excludedSource() async {
- // Add analysis options to exclude the lib directory then reanalyze
- newAnalysisOptionsYamlFile('/project', content: '''
-analyzer:
- exclude:
- - lib/**
-''');
-
- addTestFile('''
-const double myDouble = 42.0;
- ''');
- createProject();
-
- // Assert no suggestions now that source has been excluded
- final result = await performFix(includedFixes: ['prefer_int_literals']);
- expect(result.suggestions, hasLength(0));
- expect(result.edits, hasLength(0));
- }
-
- Future<void> test_fixNamedConstructorTypeArgs() async {
- addTestFile('''
-class A<T> {
- A.from(Object obj);
-}
-void f() {
- print(A.from<String>([]));
-}
- ''');
- createProject();
- var result = await performFix(
- includedFixes: ['wrong_number_of_type_arguments_constructor']);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(result.suggestions[0], 'type arguments', 62, 8);
- expectEdits(result.edits, '''
-class A<T> {
- A.from(Object obj);
-}
-void f() {
- print(A<String>.from([]));
-}
- ''');
- }
-
- Future<void> test_includedFix_invalid() async {
- addTestFile('''
-const double myDouble = 42.0;
- ''');
- createProject();
-
- final result = await performFixRaw(includedFixes: ['not_a_fix']);
- expect(result.error, isNotNull);
- }
-
- Future<void> test_partFile() async {
- newFile('/project/lib/lib.dart', content: '''
-library lib2;
-part 'fileToBeFixed.dart';
- ''');
- addTestFile('''
-part of lib2;
-const double myDouble = 42.0;
- ''');
- createProject();
-
- // Assert dartfix suggestions
- var result = await performFix(includedFixes: ['prefer_int_literals']);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(result.suggestions[0], 'int literal', 38, 4);
- expectEdits(result.edits, '''
-part of lib2;
-const double myDouble = 42;
- ''');
- }
-
- Future<void> test_partFile_loose() async {
- addTestFile('''
-part of lib2;
-const double myDouble = 42.0;
- ''');
- createProject();
-
- // Assert dartfix suggestions
- var result = await performFix(includedFixes: ['prefer_int_literals']);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(result.suggestions[0], 'int literal', 38, 4);
- expectEdits(result.edits, '''
-part of lib2;
-const double myDouble = 42;
- ''');
- }
-
- Future<void> test_pedantic() async {
- addTestFile('void f(List args) { if (args.length == 0) { } }');
- createProject();
- var result = await performFix(pedantic: true);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(result.suggestions[0], "Replace with 'isEmpty'", 24, 16);
- expect(result.hasErrors, isFalse);
- expectEdits(result.edits, 'void f(List args) { if (args.isEmpty) { } }');
- }
-
- Future<void> test_preferEqualForDefaultValues() async {
- // Add analysis options to enable ui as code
- addTestFile('f({a: 1}) { }');
- createProject();
- var result =
- await performFix(includedFixes: ['prefer_equal_for_default_values']);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(result.suggestions[0], "Replace ':' with '='", 4, 1);
- expect(result.hasErrors, isFalse);
- expectEdits(result.edits, 'f({a = 1}) { }');
- }
-
- Future<void> test_preferForElementsToMapFromIterable() async {
- addTestFile('''
-var m =
- Map<int, int>.fromIterable([1, 2, 3], key: (i) => i, value: (i) => i * 2);
- ''');
- createProject();
- var result = await performFix(
- includedFixes: ['prefer_for_elements_to_map_fromIterable']);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(
- result.suggestions[0], "Convert to a 'for' element", 10, 73);
- expectEdits(result.edits, '''
-var m =
- { for (var i in [1, 2, 3]) i : i * 2 };
- ''');
- }
-
- Future<void> test_preferIfElementsToConditionalExpressions() async {
- addTestFile('''
-f(bool b) => ['a', b ? 'c' : 'd', 'e'];
- ''');
- createProject();
- var result = await performFix(
- includedFixes: ['prefer_if_elements_to_conditional_expressions']);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(
- result.suggestions[0], "Convert to an 'if' element", 19, 13);
- expectEdits(result.edits, '''
-f(bool b) => ['a', if (b) 'c' else 'd', 'e'];
- ''');
- }
-
- Future<void> test_preferIntLiterals() async {
- addTestFile('''
-const double myDouble = 42.0;
- ''');
- createProject();
- var result = await performFix(includedFixes: ['prefer_int_literals']);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(result.suggestions[0], 'int literal', 24, 4);
- expectEdits(result.edits, '''
-const double myDouble = 42;
- ''');
- }
-
- Future<void> test_preferIsEmpty() async {
- addTestFile('void f(List<String> args) { if (args.length == 0) { } }');
- createProject();
- var result = await performFix(includedFixes: ['prefer_is_empty']);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(result.suggestions[0], "Replace with 'isEmpty'", 32, 16);
- expect(result.hasErrors, isFalse);
- expectEdits(
- result.edits, 'void f(List<String> args) { if (args.isEmpty) { } }');
- }
-
- Future<void> test_preferMixin() async {
- addTestFile('''
-class A {}
-class B extends A {}
-class C with B {}
- ''');
- createProject();
- var result = await performFix(includedFixes: ['convert_class_to_mixin']);
- expect(result.suggestions, hasLength(1));
- expectSuggestion(result.suggestions[0], 'mixin', 17, 1);
- expectEdits(result.edits, '''
-class A {}
-mixin B implements A {}
-class C with B {}
- ''');
- }
-
- Future<void> test_preferSingleQuotes() async {
- addTestFile('''
-var l = [
- "abc",
- 'def',
- "'g'",
- """hij""",
- \'''klm\''',
-];
-''');
- createProject();
- var result = await performFix(includedFixes: ['prefer_single_quotes']);
- expect(result.suggestions, hasLength(2));
- expectSuggestion(
- result.suggestions[0], 'Convert to single quoted string', 12, 5);
- expectSuggestion(
- result.suggestions[1], 'Convert to single quoted string', 39, 9);
- expect(result.hasErrors, isFalse);
- expectEdits(result.edits, '''
-var l = [
- 'abc',
- 'def',
- "'g'",
- \'''hij\''',
- \'''klm\''',
-];
-''');
- }
-
- Future<void> test_preferSpreadCollections() async {
- addTestFile('''
-var l1 = ['b'];
-var l2 = ['a']..addAll(l1);
-''');
- createProject();
- var result = await performFix(includedFixes: ['prefer_spread_collections']);
- expect(result.suggestions.length, greaterThanOrEqualTo(1));
- expect(result.hasErrors, isFalse);
- expectEdits(result.edits, '''
-var l1 = ['b'];
-var l2 = ['a', ...l1];
-''');
- }
-}
diff --git a/pkg/analysis_server/test/integration/coverage.md b/pkg/analysis_server/test/integration/coverage.md
index 38705c6..58d0edf 100644
--- a/pkg/analysis_server/test/integration/coverage.md
+++ b/pkg/analysis_server/test/integration/coverage.md
@@ -44,11 +44,9 @@
## edit domain
- [x] edit.bulkFixes
-- [x] edit.dartfix
- [x] edit.format
- [x] edit.getAssists
- [x] edit.getAvailableRefactorings
-- [x] edit.getDartfixInfo
- [x] edit.getFixes
- [x] edit.getPostfixCompletion
- [x] edit.getRefactoring
diff --git a/pkg/analysis_server/test/integration/edit/dartfix_test.dart b/pkg/analysis_server/test/integration/edit/dartfix_test.dart
deleted file mode 100644
index 7029973..0000000
--- a/pkg/analysis_server/test/integration/edit/dartfix_test.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// 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 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../support/integration_tests.dart';
-
-void main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(DartfixTest);
- });
-}
-
-@reflectiveTest
-class DartfixTest extends AbstractAnalysisServerIntegrationTest {
- void setupTarget() {
- writeFile(sourcePath('test.dart'), '''
-class A {}
-class B extends A {}
-class C with B {}
- ''');
- standardAnalysisSetup();
- }
-
- Future<void> test_dartfix_exclude() async {
- setupTarget();
- var result = await sendEditDartfix([(sourceDirectory.path)],
- excludedFixes: ['convert_class_to_mixin']);
- expect(result.hasErrors, isFalse);
- expect(result.suggestions.length, 0);
- expect(result.edits.length, 0);
- }
-
- Future<void> test_dartfix_include() async {
- setupTarget();
- var result = await sendEditDartfix([(sourceDirectory.path)],
- includedFixes: ['convert_class_to_mixin']);
- expect(result.hasErrors, isFalse);
- expect(result.suggestions.length, greaterThanOrEqualTo(1));
- expect(result.edits.length, greaterThanOrEqualTo(1));
- }
-
- Future<void> test_dartfix_include_other() async {
- setupTarget();
- var result = await sendEditDartfix([(sourceDirectory.path)],
- includedFixes: ['prefer_int_literals']);
- expect(result.hasErrors, isFalse);
- expect(result.suggestions.length, 0);
- expect(result.edits.length, 0);
- }
-}
diff --git a/pkg/analysis_server/test/integration/edit/get_dartfix_info_test.dart b/pkg/analysis_server/test/integration/edit/get_dartfix_info_test.dart
deleted file mode 100644
index 3d3bf9f..0000000
--- a/pkg/analysis_server/test/integration/edit/get_dartfix_info_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// 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 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../support/integration_tests.dart';
-
-void main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(GetDartfixInfoTest);
- });
-}
-
-@reflectiveTest
-class GetDartfixInfoTest extends AbstractAnalysisServerIntegrationTest {
- Future<void> test_getDartfixInfo() async {
- standardAnalysisSetup();
- var info = await sendEditGetDartfixInfo();
- expect(info.fixes.length, greaterThanOrEqualTo(3));
- }
-}
diff --git a/pkg/analysis_server/test/integration/edit/test_all.dart b/pkg/analysis_server/test/integration/edit/test_all.dart
index 5c3a653..f0e98d7 100644
--- a/pkg/analysis_server/test/integration/edit/test_all.dart
+++ b/pkg/analysis_server/test/integration/edit/test_all.dart
@@ -5,12 +5,10 @@
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'bulk_fixes_test.dart' as bulk_fixes_test;
-import 'dartfix_test.dart' as dartfix_test;
import 'format_test.dart' as format_test;
import 'get_assists_test.dart' as get_assists_test;
import 'get_available_refactorings_test.dart'
as get_available_refactorings_test;
-import 'get_dartfix_info_test.dart' as get_dartfix_info_test;
import 'get_fixes_test.dart' as get_fixes_test;
import 'get_postfix_completion_test.dart' as get_postfix_completion_test;
import 'get_refactoring_test.dart' as get_refactoring_test;
@@ -26,11 +24,9 @@
void main() {
defineReflectiveSuite(() {
bulk_fixes_test.main();
- dartfix_test.main();
format_test.main();
get_assists_test.main();
get_available_refactorings_test.main();
- get_dartfix_info_test.main();
get_fixes_test.main();
get_refactoring_test.main();
get_postfix_completion_test.main();
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 c424f42..5fd4d70 100644
--- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
@@ -1522,23 +1522,6 @@
decoder, 'result', result);
}
- /// Request information about edit.dartfix such as the list of known fixes
- /// that can be specified in an edit.dartfix request.
- ///
- /// Parameters
- ///
- /// Returns
- ///
- /// fixes: List<DartFix>
- ///
- /// A list of fixes that can be specified in an edit.dartfix request.
- Future<EditGetDartfixInfoResult> sendEditGetDartfixInfo() async {
- var params = EditGetDartfixInfoParams().toJson();
- var result = await server.send('edit.getDartfixInfo', params);
- var decoder = ResponseDecoder(null);
- return EditGetDartfixInfoResult.fromJson(decoder, 'result', result);
- }
-
/// Analyze the specified sources for fixes that can be applied in bulk and
/// return a set of suggested edits for those sources. These edits may
/// include changes to sources outside the set of specified sources if a
@@ -1586,117 +1569,6 @@
return EditBulkFixesResult.fromJson(decoder, 'result', result);
}
- /// Analyze the specified sources for recommended changes and return a set of
- /// suggested edits for those sources. These edits may include changes to
- /// sources outside the set of specified sources if a change in a specified
- /// source requires it.
- ///
- /// If includedFixes is specified, then those fixes will be applied. If
- /// includePedanticFixes is specified, then fixes associated with the
- /// pedantic rule set will be applied in addition to whatever fixes are
- /// specified in includedFixes if any. If neither includedFixes nor
- /// includePedanticFixes is specified, then no fixes will be applied. If
- /// excludedFixes is specified, then those fixes will not be applied
- /// regardless of whether they are specified in includedFixes.
- ///
- /// Parameters
- ///
- /// included: List<FilePath>
- ///
- /// A list of the files and directories for which edits should be
- /// suggested.
- ///
- /// If a request is made with a path that is invalid, e.g. is not absolute
- /// and normalized, an error of type INVALID_FILE_PATH_FORMAT will be
- /// generated. If a request is made for a file which does not exist, or
- /// which is not currently subject to analysis (e.g. because it is not
- /// associated with any analysis root specified to
- /// analysis.setAnalysisRoots), an error of type FILE_NOT_ANALYZED will be
- /// generated.
- ///
- /// includedFixes: List<String> (optional)
- ///
- /// A list of names indicating which fixes should be applied.
- ///
- /// If a name is specified that does not match the name of a known fix, an
- /// error of type UNKNOWN_FIX will be generated.
- ///
- /// includePedanticFixes: bool (optional)
- ///
- /// A flag indicating whether "pedantic" fixes should be applied.
- ///
- /// excludedFixes: List<String> (optional)
- ///
- /// A list of names indicating which fixes should not be applied.
- ///
- /// If a name is specified that does not match the name of a known fix, an
- /// error of type UNKNOWN_FIX will be generated.
- ///
- /// port: int (optional)
- ///
- /// Deprecated: This field is now ignored by server.
- ///
- /// outputDir: FilePath (optional)
- ///
- /// Deprecated: This field is now ignored by server.
- ///
- /// Returns
- ///
- /// suggestions: List<DartFixSuggestion>
- ///
- /// A list of recommended changes that can be automatically made by
- /// applying the 'edits' included in this response.
- ///
- /// otherSuggestions: List<DartFixSuggestion>
- ///
- /// A list of recommended changes that could not be automatically made.
- ///
- /// hasErrors: bool
- ///
- /// True if the analyzed source contains errors that might impact the
- /// correctness of the recommended changes that can be automatically
- /// applied.
- ///
- /// edits: List<SourceFileEdit>
- ///
- /// A list of source edits to apply the recommended changes.
- ///
- /// details: List<String> (optional)
- ///
- /// Messages that should be displayed to the user that describe details of
- /// the fix generation. For example, the messages might (a) point out
- /// details that users might want to explore before committing the changes
- /// or (b) describe exceptions that were thrown but that did not stop the
- /// fixes from being produced. The list will be omitted if it is empty.
- ///
- /// port: int (optional)
- ///
- /// The port on which the preview tool will respond to GET requests. The
- /// field is omitted if a preview was not requested.
- ///
- /// urls: List<String> (optional)
- ///
- /// The URLs that users can visit in a browser to see a preview of the
- /// proposed changes. There is one URL for each of the included file paths.
- /// The field is omitted if a preview was not requested.
- Future<EditDartfixResult> sendEditDartfix(List<String> included,
- {List<String>? includedFixes,
- bool? includePedanticFixes,
- List<String>? excludedFixes,
- int? port,
- String? outputDir}) async {
- var params = EditDartfixParams(included,
- includedFixes: includedFixes,
- includePedanticFixes: includePedanticFixes,
- excludedFixes: excludedFixes,
- port: port,
- outputDir: outputDir)
- .toJson();
- var result = await server.send('edit.dartfix', params);
- var decoder = ResponseDecoder(null);
- return EditDartfixResult.fromJson(decoder, 'result', result);
- }
-
/// Return the set of fixes that are available for the errors at a given
/// offset in a given file.
///
diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
index 4ad56ae..3c0e282 100644
--- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
@@ -344,26 +344,6 @@
'cacheEntryExceptions': isListOf(isString)
}));
-/// DartFix
-///
-/// {
-/// "name": String
-/// "description": optional String
-/// }
-final Matcher isDartFix = LazyMatcher(() => MatchesJsonObject(
- 'DartFix', {'name': isString},
- optionalFields: {'description': isString}));
-
-/// DartFixSuggestion
-///
-/// {
-/// "description": String
-/// "location": optional Location
-/// }
-final Matcher isDartFixSuggestion = LazyMatcher(() => MatchesJsonObject(
- 'DartFixSuggestion', {'description': isString},
- optionalFields: {'location': isLocation}));
-
/// DiagnosticMessage
///
/// {
@@ -1429,7 +1409,6 @@
/// SERVER_ERROR
/// SORT_MEMBERS_INVALID_FILE
/// SORT_MEMBERS_PARSE_ERRORS
-/// UNKNOWN_FIX
/// UNKNOWN_REQUEST
/// UNSUPPORTED_FEATURE
/// }
@@ -1466,7 +1445,6 @@
'SERVER_ERROR',
'SORT_MEMBERS_INVALID_FILE',
'SORT_MEMBERS_PARSE_ERRORS',
- 'UNKNOWN_FIX',
'UNKNOWN_REQUEST',
'UNSUPPORTED_FEATURE'
]);
@@ -2240,50 +2218,6 @@
'edit.bulkFixes result',
{'edits': isListOf(isSourceFileEdit), 'details': isListOf(isBulkFix)}));
-/// edit.dartfix params
-///
-/// {
-/// "included": List<FilePath>
-/// "includedFixes": optional List<String>
-/// "includePedanticFixes": optional bool
-/// "excludedFixes": optional List<String>
-/// "port": optional int
-/// "outputDir": optional FilePath
-/// }
-final Matcher isEditDartfixParams =
- LazyMatcher(() => MatchesJsonObject('edit.dartfix params', {
- 'included': isListOf(isFilePath)
- }, optionalFields: {
- 'includedFixes': isListOf(isString),
- 'includePedanticFixes': isBool,
- 'excludedFixes': isListOf(isString),
- 'port': isInt,
- 'outputDir': isFilePath
- }));
-
-/// edit.dartfix result
-///
-/// {
-/// "suggestions": List<DartFixSuggestion>
-/// "otherSuggestions": List<DartFixSuggestion>
-/// "hasErrors": bool
-/// "edits": List<SourceFileEdit>
-/// "details": optional List<String>
-/// "port": optional int
-/// "urls": optional List<String>
-/// }
-final Matcher isEditDartfixResult =
- LazyMatcher(() => MatchesJsonObject('edit.dartfix result', {
- 'suggestions': isListOf(isDartFixSuggestion),
- 'otherSuggestions': isListOf(isDartFixSuggestion),
- 'hasErrors': isBool,
- 'edits': isListOf(isSourceFileEdit)
- }, optionalFields: {
- 'details': isListOf(isString),
- 'port': isInt,
- 'urls': isListOf(isString)
- }));
-
/// edit.format params
///
/// {
@@ -2350,21 +2284,6 @@
MatchesJsonObject('edit.getAvailableRefactorings result',
{'kinds': isListOf(isRefactoringKind)}));
-/// edit.getDartfixInfo params
-///
-/// {
-/// }
-final Matcher isEditGetDartfixInfoParams =
- LazyMatcher(() => MatchesJsonObject('edit.getDartfixInfo params', null));
-
-/// edit.getDartfixInfo result
-///
-/// {
-/// "fixes": List<DartFix>
-/// }
-final Matcher isEditGetDartfixInfoResult = LazyMatcher(() => MatchesJsonObject(
- 'edit.getDartfixInfo result', {'fixes': isListOf(isDartFix)}));
-
/// edit.getFixes params
///
/// {
diff --git a/pkg/analysis_server/test/test_all.dart b/pkg/analysis_server/test/test_all.dart
index eca22e0..4c5a33f 100644
--- a/pkg/analysis_server/test/test_all.dart
+++ b/pkg/analysis_server/test/test_all.dart
@@ -14,7 +14,6 @@
import 'domain_analysis_test.dart' as domain_analysis;
import 'domain_completion_test.dart' as domain_completion;
import 'domain_diagnostic_test.dart' as domain_experimental;
-import 'domain_edit_dartfix_test.dart' as domain_edit_dartfix;
import 'domain_execution_test.dart' as domain_execution;
import 'domain_server_test.dart' as domain_server;
import 'edit/test_all.dart' as edit;
@@ -40,7 +39,6 @@
completion.main();
domain_analysis.main();
domain_completion.main();
- domain_edit_dartfix.main();
domain_execution.main();
domain_experimental.main();
domain_server.main();
diff --git a/pkg/analysis_server/tool/migration_runner.dart b/pkg/analysis_server/tool/migration_runner.dart
deleted file mode 100644
index ec9b6a2..0000000
--- a/pkg/analysis_server/tool/migration_runner.dart
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// 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.
-
-/// This executable provides the ability to run the migration tool in process
-/// on a single package. It should be invoked with two command-line arguments:
-/// a path to a configuration file and the name of a package to migrate.
-///
-/// The configuration file format is a JSON map, with the following keys:
-/// - `sdk_root`: path to the SDK source code on the user's machine (this is the
-/// directory that contains `pkg`, `third_party`, `tests`, etc.
-/// - `output_root`: if present, path to the directory on the user's machine
-/// where output HTML files should go. A subdirectory will be created for
-/// each package that is migrated.
-/// - `external_packages`: a map (name => path) of additional non-SDK packages
-/// that may need to be migrated.
-/// - `port`: if present, the port where a server should be spawned serving HTML
-/// pages.
-library migration_runner;
-
-import 'dart:convert';
-import 'dart:io' as io;
-
-import 'package:analysis_server/protocol/protocol.dart';
-import 'package:analysis_server/protocol/protocol_constants.dart';
-import 'package:analysis_server/protocol/protocol_generated.dart';
-import 'package:analysis_server/src/analysis_server.dart';
-import 'package:analysis_server/src/server/crash_reporting_attachments.dart';
-import 'package:analysis_server/src/utilities/mocks.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/physical_file_system.dart';
-import 'package:analyzer/instrumentation/instrumentation.dart';
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:cli_util/cli_util.dart';
-import 'package:path/path.dart' as path;
-import 'package:test/test.dart';
-
-Future<void> main(List<String> args) async {
- if (args.length != 2) {
- throw StateError(
- 'Exactly two arguments are required: the path to a JSON configuration '
- 'file, and the name of the package to migrate');
- }
- var testInfoJsonPath = args[0];
- var testInfoJson = json.decode(io.File(testInfoJsonPath).readAsStringSync());
- var packageName = args[1];
- var testInfo = TestInfo(testInfoJson);
- var packageRoot = testInfo.packageRoot(packageName);
- var port = testInfo.port;
- print('Preparing to migrate');
- var migrationTest = MigrationTest();
- migrationTest.setUp();
- print('Migrating');
- await migrationTest.run(packageRoot, port);
- migrationTest.tearDown();
- print('Done. Please point your browser to localhost:$port/\$filePath');
-}
-
-class MigrationBase {
- ResourceProvider resourceProvider = PhysicalResourceProvider.INSTANCE;
- late MockServerChannel serverChannel;
- late AnalysisServer server;
-
- AnalysisServer createAnalysisServer() {
- //
- // Create server
- //
- var options = AnalysisServerOptions();
- var sdkPath = getSdkPath();
- return AnalysisServer(
- serverChannel,
- resourceProvider,
- options,
- DartSdkManager(sdkPath),
- CrashReportingAttachmentsBuilder.empty,
- InstrumentationService.NULL_SERVICE);
- }
-
- void processNotification(Notification notification) {
- if (notification.event == SERVER_NOTIFICATION_ERROR) {
- fail('${notification.toJson()}');
- }
- }
-
- Future<Response> sendAnalysisSetAnalysisRoots(List<String> directories) {
- var request =
- AnalysisSetAnalysisRootsParams(directories, []).toRequest('0');
- return waitResponse(request);
- }
-
- Future<Response> sendEditDartfix(List<String> directories, int port) {
- var request = EditDartfixParams(directories,
- includedFixes: ['non-nullable'], port: port)
- .toRequest('1');
- return waitResponse(request);
- }
-
- void setUp() {
- serverChannel = MockServerChannel();
- server = createAnalysisServer();
- server.pluginManager = TestPluginManager();
- // listen for notifications
- var notificationStream = serverChannel.notificationController.stream;
- notificationStream.listen((Notification notification) {
- processNotification(notification);
- });
- }
-
- void tearDown() {
- server.done();
- }
-
- /// Returns a [Future] that completes when the server's analysis is complete.
- Future waitForTasksFinished() {
- return server.onAnalysisComplete;
- }
-
- /// Completes with a successful [Response] for the given [request].
- Future<Response> waitResponse(Request request,
- {bool throwOnError = true}) async {
- return serverChannel.sendRequest(request, throwOnError: throwOnError);
- }
-}
-
-class MigrationTest extends MigrationBase {
- Future<void> run(String packageRoot, int port) async {
- var packageRoots = <String>[packageRoot];
- await sendAnalysisSetAnalysisRoots(packageRoots);
- await sendEditDartfix(packageRoots, port);
- }
-}
-
-class TestInfo {
- static const Set<String> thirdPartyPackages = {
- 'charcode',
- 'collection',
- 'logging',
- 'meta',
- 'pedantic',
- 'typed_data'
- };
-
- static const Set<String> builtInPackages = {'meta', 'path'};
-
- final Map<String, Object> testInfoJson;
-
- TestInfo(this.testInfoJson);
-
- Map<String, String> get externalPackages =>
- ((testInfoJson['external_packages'] ?? {}) as Map).cast<String, String>();
-
- String get outputRoot => testInfoJson['output_root'] as String;
-
- int get port => testInfoJson['port'] as int;
-
- String get sdkRoot => testInfoJson['sdk_root'] as String;
-
- String packageRoot(String packageName) {
- if (thirdPartyPackages.contains(packageName)) {
- return path.join(sdkRoot, 'third_party', 'pkg', packageName);
- } else if (builtInPackages.contains(packageName)) {
- return path.join(sdkRoot, 'pkg', packageName);
- } else if (externalPackages.containsKey(packageName)) {
- return externalPackages[packageName] as String;
- } else {
- throw StateError('Unrecognized package $packageName');
- }
- }
-}
diff --git a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
index 5731163..03b9cbe 100644
--- a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
+++ b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
@@ -479,37 +479,6 @@
public void edit_bulkFixes(List<String> included, boolean inTestMode, BulkFixesConsumer consumer);
/**
- * {@code edit.dartfix}
- *
- * Analyze the specified sources for recommended changes and return a set of suggested edits for
- * those sources. These edits may include changes to sources outside the set of specified sources
- * if a change in a specified source requires it.
- *
- * If includedFixes is specified, then those fixes will be applied. If includePedanticFixes is
- * specified, then fixes associated with the pedantic rule set will be applied in addition to
- * whatever fixes are specified in includedFixes if any. If neither includedFixes nor
- * includePedanticFixes is specified, then no fixes will be applied. If excludedFixes is specified,
- * then those fixes will not be applied regardless of whether they are specified in includedFixes.
- *
- * @param included A list of the files and directories for which edits should be suggested. If a
- * request is made with a path that is invalid, e.g. is not absolute and normalized, an
- * error of type INVALID_FILE_PATH_FORMAT will be generated. If a request is made for a
- * file which does not exist, or which is not currently subject to analysis (e.g. because
- * it is not associated with any analysis root specified to analysis.setAnalysisRoots), an
- * error of type FILE_NOT_ANALYZED will be generated.
- * @param includedFixes A list of names indicating which fixes should be applied. If a name is
- * specified that does not match the name of a known fix, an error of type UNKNOWN_FIX will
- * be generated.
- * @param includePedanticFixes A flag indicating whether "pedantic" fixes should be applied.
- * @param excludedFixes A list of names indicating which fixes should not be applied. If a name is
- * specified that does not match the name of a known fix, an error of type UNKNOWN_FIX will
- * be generated.
- * @param port Deprecated: This field is now ignored by server.
- * @param outputDir Deprecated: This field is now ignored by server.
- */
- public void edit_dartfix(List<String> included, List<String> includedFixes, boolean includePedanticFixes, List<String> excludedFixes, int port, String outputDir, DartfixConsumer consumer);
-
- /**
* {@code edit.format}
*
* Format the contents of a single file. The currently selected region of text is passed in so that
@@ -556,14 +525,6 @@
public void edit_getAvailableRefactorings(String file, int offset, int length, GetAvailableRefactoringsConsumer consumer);
/**
- * {@code edit.getDartfixInfo}
- *
- * Request information about edit.dartfix such as the list of known fixes that can be specified in
- * an edit.dartfix request.
- */
- public void edit_getDartfixInfo(GetDartfixInfoConsumer consumer);
-
- /**
* {@code edit.getFixes}
*
* Return the set of fixes that are available for the errors at a given offset in a given file.
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/DartFix.java b/pkg/analysis_server/tool/spec/generated/java/types/DartFix.java
deleted file mode 100644
index 1d2dde1..0000000
--- a/pkg/analysis_server/tool/spec/generated/java/types/DartFix.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
- * 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.
- *
- * This file has been automatically generated. Please do not edit it manually.
- * To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files".
- */
-package org.dartlang.analysis.server.protocol;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import com.google.common.collect.Lists;
-import com.google.dart.server.utilities.general.JsonUtilities;
-import com.google.dart.server.utilities.general.ObjectUtilities;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * A "fix" that can be specified in an edit.dartfix request.
- *
- * @coverage dart.server.generated.types
- */
-@SuppressWarnings("unused")
-public class DartFix {
-
- public static final DartFix[] EMPTY_ARRAY = new DartFix[0];
-
- public static final List<DartFix> EMPTY_LIST = Lists.newArrayList();
-
- /**
- * The name of the fix.
- */
- private final String name;
-
- /**
- * A human readable description of the fix.
- */
- private final String description;
-
- /**
- * Constructor for {@link DartFix}.
- */
- public DartFix(String name, String description) {
- this.name = name;
- this.description = description;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof DartFix) {
- DartFix other = (DartFix) obj;
- return
- ObjectUtilities.equals(other.name, name) &&
- ObjectUtilities.equals(other.description, description);
- }
- return false;
- }
-
- public static DartFix fromJson(JsonObject jsonObject) {
- String name = jsonObject.get("name").getAsString();
- String description = jsonObject.get("description") == null ? null : jsonObject.get("description").getAsString();
- return new DartFix(name, description);
- }
-
- public static List<DartFix> fromJsonArray(JsonArray jsonArray) {
- if (jsonArray == null) {
- return EMPTY_LIST;
- }
- ArrayList<DartFix> list = new ArrayList<DartFix>(jsonArray.size());
- Iterator<JsonElement> iterator = jsonArray.iterator();
- while (iterator.hasNext()) {
- list.add(fromJson(iterator.next().getAsJsonObject()));
- }
- return list;
- }
-
- /**
- * A human readable description of the fix.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * The name of the fix.
- */
- public String getName() {
- return name;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
- builder.append(name);
- builder.append(description);
- return builder.toHashCode();
- }
-
- public JsonObject toJson() {
- JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("name", name);
- if (description != null) {
- jsonObject.addProperty("description", description);
- }
- return jsonObject;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("[");
- builder.append("name=");
- builder.append(name + ", ");
- builder.append("description=");
- builder.append(description);
- builder.append("]");
- return builder.toString();
- }
-
-}
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/DartFixSuggestion.java b/pkg/analysis_server/tool/spec/generated/java/types/DartFixSuggestion.java
deleted file mode 100644
index b40cb10..0000000
--- a/pkg/analysis_server/tool/spec/generated/java/types/DartFixSuggestion.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
- * 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.
- *
- * This file has been automatically generated. Please do not edit it manually.
- * To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files".
- */
-package org.dartlang.analysis.server.protocol;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import com.google.common.collect.Lists;
-import com.google.dart.server.utilities.general.JsonUtilities;
-import com.google.dart.server.utilities.general.ObjectUtilities;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * A suggestion from an edit.dartfix request.
- *
- * @coverage dart.server.generated.types
- */
-@SuppressWarnings("unused")
-public class DartFixSuggestion {
-
- public static final DartFixSuggestion[] EMPTY_ARRAY = new DartFixSuggestion[0];
-
- public static final List<DartFixSuggestion> EMPTY_LIST = Lists.newArrayList();
-
- /**
- * A human readable description of the suggested change.
- */
- private final String description;
-
- /**
- * The location of the suggested change.
- */
- private final Location location;
-
- /**
- * Constructor for {@link DartFixSuggestion}.
- */
- public DartFixSuggestion(String description, Location location) {
- this.description = description;
- this.location = location;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof DartFixSuggestion) {
- DartFixSuggestion other = (DartFixSuggestion) obj;
- return
- ObjectUtilities.equals(other.description, description) &&
- ObjectUtilities.equals(other.location, location);
- }
- return false;
- }
-
- public static DartFixSuggestion fromJson(JsonObject jsonObject) {
- String description = jsonObject.get("description").getAsString();
- Location location = jsonObject.get("location") == null ? null : Location.fromJson(jsonObject.get("location").getAsJsonObject());
- return new DartFixSuggestion(description, location);
- }
-
- public static List<DartFixSuggestion> fromJsonArray(JsonArray jsonArray) {
- if (jsonArray == null) {
- return EMPTY_LIST;
- }
- ArrayList<DartFixSuggestion> list = new ArrayList<DartFixSuggestion>(jsonArray.size());
- Iterator<JsonElement> iterator = jsonArray.iterator();
- while (iterator.hasNext()) {
- list.add(fromJson(iterator.next().getAsJsonObject()));
- }
- return list;
- }
-
- /**
- * A human readable description of the suggested change.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * The location of the suggested change.
- */
- public Location getLocation() {
- return location;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
- builder.append(description);
- builder.append(location);
- return builder.toHashCode();
- }
-
- public JsonObject toJson() {
- JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("description", description);
- if (location != null) {
- jsonObject.add("location", location.toJson());
- }
- return jsonObject;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("[");
- builder.append("description=");
- builder.append(description + ", ");
- builder.append("location=");
- builder.append(location);
- builder.append("]");
- return builder.toString();
- }
-
-}
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/RequestErrorCode.java b/pkg/analysis_server/tool/spec/generated/java/types/RequestErrorCode.java
index 44da4d7..66c6210 100644
--- a/pkg/analysis_server/tool/spec/generated/java/types/RequestErrorCode.java
+++ b/pkg/analysis_server/tool/spec/generated/java/types/RequestErrorCode.java
@@ -198,12 +198,6 @@
public static final String SORT_MEMBERS_PARSE_ERRORS = "SORT_MEMBERS_PARSE_ERRORS";
/**
- * A dartfix request was received containing the name of a fix which does not match the name of any
- * known fixes.
- */
- public static final String UNKNOWN_FIX = "UNKNOWN_FIX";
-
- /**
* A request was received which the analysis server does not recognize, or cannot handle in its
* current configuration.
*/
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index 9168b9b..7bb2fe0 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -2154,26 +2154,6 @@
</field>
</result>
</request>
- <request method="getDartfixInfo" experimental="true">
- <p>
- Request information about edit.dartfix
- such as the list of known fixes that can be specified
- in an edit.dartfix request.
- </p>
- <params>
- </params>
- <result>
- <field name="fixes">
- <list>
- <ref>DartFix</ref>
- </list>
- <p>
- A list of fixes that can be specified
- in an edit.dartfix request.
- </p>
- </field>
- </result>
- </request>
<request method="bulkFixes" experimental="true">
<p>
Analyze the specified sources for fixes that can be applied in bulk
@@ -2233,148 +2213,6 @@
</field>
</result>
</request>
- <request method="dartfix" experimental="true">
- <p>
- Analyze the specified sources for recommended changes
- and return a set of suggested edits for those sources.
- These edits may include changes to sources outside the set
- of specified sources if a change in a specified source requires it.
- </p>
- <p>
- If includedFixes is specified, then those fixes will be applied. If
- includePedanticFixes is specified, then fixes associated with the pedantic
- rule set will be applied in addition to whatever fixes are specified in
- includedFixes if any. If neither includedFixes nor includePedanticFixes is
- specified, then no fixes will be applied. If excludedFixes is specified,
- then those fixes will not be applied regardless of whether they are
- specified in includedFixes.
- </p>
- <params>
- <field name="included">
- <list>
- <ref>FilePath</ref>
- </list>
- <p>
- A list of the files and directories for which edits should be
- suggested.
- </p>
- <p>
- If a request is made with a path that is invalid, e.g. is not absolute
- and normalized, an error of type <tt>INVALID_FILE_PATH_FORMAT</tt>
- will be generated. If a request is made for a file which does not
- exist, or which is not currently subject to analysis (e.g. because it
- is not associated with any analysis root specified to
- analysis.setAnalysisRoots), an error of type
- <tt>FILE_NOT_ANALYZED</tt> will be generated.
- </p>
- </field>
- <field name="includedFixes" optional="true">
- <list>
- <ref>String</ref>
- </list>
- <p>
- A list of names indicating which fixes should be applied.
- </p>
- <p>
- If a name is specified that does not match the name of a known fix, an
- error of type <tt>UNKNOWN_FIX</tt> will be generated.
- </p>
- </field>
- <field name="includePedanticFixes" optional="true">
- <ref>bool</ref>
- <p>
- A flag indicating whether "pedantic" fixes should be applied.
- </p>
- </field>
- <field name="excludedFixes" optional="true">
- <list>
- <ref>String</ref>
- </list>
- <p>
- A list of names indicating which fixes should not be applied.
- </p>
- <p>
- If a name is specified that does not match the name of a known fix, an
- error of type <tt>UNKNOWN_FIX</tt> will be generated.
- </p>
- </field>
- <field name="port" optional="true" deprecated="true">
- <ref>int</ref>
- <p>
- <b>Deprecated:</b> This field is now ignored by server.
- </p>
- </field>
- <field name="outputDir" optional="true" deprecated="true">
- <ref>FilePath</ref>
- <p>
- <b>Deprecated:</b> This field is now ignored by server.
- </p>
- </field>
- </params>
- <result>
- <field name="suggestions">
- <list>
- <ref>DartFixSuggestion</ref>
- </list>
- <p>
- A list of recommended changes that can be automatically made
- by applying the 'edits' included in this response.
- </p>
- </field>
- <field name="otherSuggestions">
- <list>
- <ref>DartFixSuggestion</ref>
- </list>
- <p>
- A list of recommended changes that could not be automatically made.
- </p>
- </field>
- <field name="hasErrors">
- <ref>bool</ref>
- <p>
- True if the analyzed source contains errors that might impact the correctness
- of the recommended changes that can be automatically applied.
- </p>
- </field>
- <field name="edits">
- <list>
- <ref>SourceFileEdit</ref>
- </list>
- <p>
- A list of source edits to apply the recommended changes.
- </p>
- </field>
- <field name="details" optional="true">
- <list>
- <ref>String</ref>
- </list>
- <p>
- Messages that should be displayed to the user that describe details of
- the fix generation. For example, the messages might (a) point out
- details that users might want to explore before committing the changes
- or (b) describe exceptions that were thrown but that did not stop the
- fixes from being produced. The list will be omitted if it is empty.
- </p>
- </field>
- <field name="port" optional="true">
- <ref>int</ref>
- <p>
- The port on which the preview tool will respond to GET requests. The
- field is omitted if a preview was not requested.
- </p>
- </field>
- <field name="urls" optional="true">
- <list>
- <ref>String</ref>
- </list>
- <p>
- The URLs that users can visit in a browser to see a preview of the
- proposed changes. There is one URL for each of the included file
- paths. The field is omitted if a preview was not requested.
- </p>
- </field>
- </result>
- </request>
<request method="getFixes">
<p>
Return the set of fixes that are available for the errors at
@@ -5206,13 +5044,6 @@
</p>
</value>
<value>
- <code>UNKNOWN_FIX</code>
- <p>
- A dartfix request was received containing the name of a fix
- which does not match the name of any known fixes.
- </p>
- </value>
- <value>
<code>UNKNOWN_REQUEST</code>
<p>
A request was received which the analysis server does
@@ -5242,44 +5073,6 @@
request.
</p>
</type>
- <type name="DartFix" experimental="true">
- <p>
- A "fix" that can be specified in an edit.dartfix request.
- </p>
- <object>
- <field name="name">
- <ref>String</ref>
- <p>
- The name of the fix.
- </p>
- </field>
- <field name="description" optional="true">
- <ref>String</ref>
- <p>
- A human readable description of the fix.
- </p>
- </field>
- </object>
- </type>
- <type name="DartFixSuggestion" experimental="true">
- <p>
- A suggestion from an edit.dartfix request.
- </p>
- <object>
- <field name="description">
- <ref>String</ref>
- <p>
- A human readable description of the suggested change.
- </p>
- </field>
- <field name="location" optional="true">
- <ref>Location</ref>
- <p>
- The location of the suggested change.
- </p>
- </field>
- </object>
- </type>
<type name="SearchResult">
<p>
A single result from a search request.
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 c06dbe8..84b3a5c 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart
@@ -163,14 +163,6 @@
const String EDIT_REQUEST_BULK_FIXES = 'edit.bulkFixes';
const String EDIT_REQUEST_BULK_FIXES_INCLUDED = 'included';
const String EDIT_REQUEST_BULK_FIXES_IN_TEST_MODE = 'inTestMode';
-const String EDIT_REQUEST_DARTFIX = 'edit.dartfix';
-const String EDIT_REQUEST_DARTFIX_EXCLUDED_FIXES = 'excludedFixes';
-const String EDIT_REQUEST_DARTFIX_INCLUDED = 'included';
-const String EDIT_REQUEST_DARTFIX_INCLUDED_FIXES = 'includedFixes';
-const String EDIT_REQUEST_DARTFIX_INCLUDE_PEDANTIC_FIXES =
- 'includePedanticFixes';
-const String EDIT_REQUEST_DARTFIX_OUTPUT_DIR = 'outputDir';
-const String EDIT_REQUEST_DARTFIX_PORT = 'port';
const String EDIT_REQUEST_FORMAT = 'edit.format';
const String EDIT_REQUEST_FORMAT_FILE = 'file';
const String EDIT_REQUEST_FORMAT_LINE_LENGTH = 'lineLength';
@@ -185,7 +177,6 @@
const String EDIT_REQUEST_GET_AVAILABLE_REFACTORINGS_FILE = 'file';
const String EDIT_REQUEST_GET_AVAILABLE_REFACTORINGS_LENGTH = 'length';
const String EDIT_REQUEST_GET_AVAILABLE_REFACTORINGS_OFFSET = 'offset';
-const String EDIT_REQUEST_GET_DARTFIX_INFO = 'edit.getDartfixInfo';
const String EDIT_REQUEST_GET_FIXES = 'edit.getFixes';
const String EDIT_REQUEST_GET_FIXES_FILE = 'file';
const String EDIT_REQUEST_GET_FIXES_OFFSET = 'offset';
@@ -221,19 +212,11 @@
const String EDIT_REQUEST_SORT_MEMBERS_FILE = 'file';
const String EDIT_RESPONSE_BULK_FIXES_DETAILS = 'details';
const String EDIT_RESPONSE_BULK_FIXES_EDITS = 'edits';
-const String EDIT_RESPONSE_DARTFIX_DETAILS = 'details';
-const String EDIT_RESPONSE_DARTFIX_EDITS = 'edits';
-const String EDIT_RESPONSE_DARTFIX_HAS_ERRORS = 'hasErrors';
-const String EDIT_RESPONSE_DARTFIX_OTHER_SUGGESTIONS = 'otherSuggestions';
-const String EDIT_RESPONSE_DARTFIX_PORT = 'port';
-const String EDIT_RESPONSE_DARTFIX_SUGGESTIONS = 'suggestions';
-const String EDIT_RESPONSE_DARTFIX_URLS = 'urls';
const String EDIT_RESPONSE_FORMAT_EDITS = 'edits';
const String EDIT_RESPONSE_FORMAT_SELECTION_LENGTH = 'selectionLength';
const String EDIT_RESPONSE_FORMAT_SELECTION_OFFSET = 'selectionOffset';
const String EDIT_RESPONSE_GET_ASSISTS_ASSISTS = 'assists';
const String EDIT_RESPONSE_GET_AVAILABLE_REFACTORINGS_KINDS = 'kinds';
-const String EDIT_RESPONSE_GET_DARTFIX_INFO_FIXES = 'fixes';
const String EDIT_RESPONSE_GET_FIXES_FIXES = 'fixes';
const String EDIT_RESPONSE_GET_POSTFIX_COMPLETION_CHANGE = 'change';
const String EDIT_RESPONSE_GET_REFACTORING_CHANGE = 'change';
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 5a777f6..470f830 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
@@ -5471,145 +5471,6 @@
}
}
-/// DartFix
-///
-/// {
-/// "name": String
-/// "description": optional String
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class DartFix implements HasToJson {
- /// The name of the fix.
- String name;
-
- /// A human readable description of the fix.
- String? description;
-
- DartFix(this.name, {this.description});
-
- factory DartFix.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- String name;
- if (json.containsKey('name')) {
- name = jsonDecoder.decodeString(jsonPath + '.name', json['name']);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'name');
- }
- String? description;
- if (json.containsKey('description')) {
- description = jsonDecoder.decodeString(
- jsonPath + '.description', json['description']);
- }
- return DartFix(name, description: description);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'DartFix', json);
- }
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['name'] = name;
- var description = this.description;
- if (description != null) {
- result['description'] = description;
- }
- return result;
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is DartFix) {
- return name == other.name && description == other.description;
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, description.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
-/// DartFixSuggestion
-///
-/// {
-/// "description": String
-/// "location": optional Location
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class DartFixSuggestion implements HasToJson {
- /// A human readable description of the suggested change.
- String description;
-
- /// The location of the suggested change.
- Location? location;
-
- DartFixSuggestion(this.description, {this.location});
-
- factory DartFixSuggestion.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- String description;
- if (json.containsKey('description')) {
- description = jsonDecoder.decodeString(
- jsonPath + '.description', json['description']);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'description');
- }
- Location? location;
- if (json.containsKey('location')) {
- location = Location.fromJson(
- jsonDecoder, jsonPath + '.location', json['location']);
- }
- return DartFixSuggestion(description, location: location);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'DartFixSuggestion', json);
- }
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['description'] = description;
- var location = this.location;
- if (location != null) {
- result['location'] = location.toJson();
- }
- return result;
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is DartFixSuggestion) {
- return description == other.description && location == other.location;
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, description.hashCode);
- hash = JenkinsSmiHash.combine(hash, location.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
/// diagnostic.getDiagnostics params
///
/// Clients may not extend, implement or mix-in this class.
@@ -5988,354 +5849,6 @@
}
}
-/// edit.dartfix params
-///
-/// {
-/// "included": List<FilePath>
-/// "includedFixes": optional List<String>
-/// "includePedanticFixes": optional bool
-/// "excludedFixes": optional List<String>
-/// "port": optional int
-/// "outputDir": optional FilePath
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class EditDartfixParams implements RequestParams {
- /// A list of the files and directories for which edits should be suggested.
- ///
- /// If a request is made with a path that is invalid, e.g. is not absolute
- /// and normalized, an error of type INVALID_FILE_PATH_FORMAT will be
- /// generated. If a request is made for a file which does not exist, or which
- /// is not currently subject to analysis (e.g. because it is not associated
- /// with any analysis root specified to analysis.setAnalysisRoots), an error
- /// of type FILE_NOT_ANALYZED will be generated.
- List<String> included;
-
- /// A list of names indicating which fixes should be applied.
- ///
- /// If a name is specified that does not match the name of a known fix, an
- /// error of type UNKNOWN_FIX will be generated.
- List<String>? includedFixes;
-
- /// A flag indicating whether "pedantic" fixes should be applied.
- bool? includePedanticFixes;
-
- /// A list of names indicating which fixes should not be applied.
- ///
- /// If a name is specified that does not match the name of a known fix, an
- /// error of type UNKNOWN_FIX will be generated.
- List<String>? excludedFixes;
-
- /// Deprecated: This field is now ignored by server.
- int? port;
-
- /// Deprecated: This field is now ignored by server.
- String? outputDir;
-
- EditDartfixParams(this.included,
- {this.includedFixes,
- this.includePedanticFixes,
- this.excludedFixes,
- this.port,
- this.outputDir});
-
- factory EditDartfixParams.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- List<String> included;
- if (json.containsKey('included')) {
- included = jsonDecoder.decodeList(
- jsonPath + '.included', json['included'], jsonDecoder.decodeString);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'included');
- }
- List<String>? includedFixes;
- if (json.containsKey('includedFixes')) {
- includedFixes = jsonDecoder.decodeList(jsonPath + '.includedFixes',
- json['includedFixes'], jsonDecoder.decodeString);
- }
- bool? includePedanticFixes;
- if (json.containsKey('includePedanticFixes')) {
- includePedanticFixes = jsonDecoder.decodeBool(
- jsonPath + '.includePedanticFixes', json['includePedanticFixes']);
- }
- List<String>? excludedFixes;
- if (json.containsKey('excludedFixes')) {
- excludedFixes = jsonDecoder.decodeList(jsonPath + '.excludedFixes',
- json['excludedFixes'], jsonDecoder.decodeString);
- }
- int? port;
- if (json.containsKey('port')) {
- port = jsonDecoder.decodeInt(jsonPath + '.port', json['port']);
- }
- String? outputDir;
- if (json.containsKey('outputDir')) {
- outputDir = jsonDecoder.decodeString(
- jsonPath + '.outputDir', json['outputDir']);
- }
- return EditDartfixParams(included,
- includedFixes: includedFixes,
- includePedanticFixes: includePedanticFixes,
- excludedFixes: excludedFixes,
- port: port,
- outputDir: outputDir);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edit.dartfix params', json);
- }
- }
-
- factory EditDartfixParams.fromRequest(Request request) {
- return EditDartfixParams.fromJson(
- RequestDecoder(request), 'params', request.params);
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['included'] = included;
- var includedFixes = this.includedFixes;
- if (includedFixes != null) {
- result['includedFixes'] = includedFixes;
- }
- var includePedanticFixes = this.includePedanticFixes;
- if (includePedanticFixes != null) {
- result['includePedanticFixes'] = includePedanticFixes;
- }
- var excludedFixes = this.excludedFixes;
- if (excludedFixes != null) {
- result['excludedFixes'] = excludedFixes;
- }
- var port = this.port;
- if (port != null) {
- result['port'] = port;
- }
- var outputDir = this.outputDir;
- if (outputDir != null) {
- result['outputDir'] = outputDir;
- }
- return result;
- }
-
- @override
- Request toRequest(String id) {
- return Request(id, 'edit.dartfix', toJson());
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is EditDartfixParams) {
- return listEqual(
- included, other.included, (String a, String b) => a == b) &&
- listEqual(includedFixes, other.includedFixes,
- (String a, String b) => a == b) &&
- includePedanticFixes == other.includePedanticFixes &&
- listEqual(excludedFixes, other.excludedFixes,
- (String a, String b) => a == b) &&
- port == other.port &&
- outputDir == other.outputDir;
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, included.hashCode);
- hash = JenkinsSmiHash.combine(hash, includedFixes.hashCode);
- hash = JenkinsSmiHash.combine(hash, includePedanticFixes.hashCode);
- hash = JenkinsSmiHash.combine(hash, excludedFixes.hashCode);
- hash = JenkinsSmiHash.combine(hash, port.hashCode);
- hash = JenkinsSmiHash.combine(hash, outputDir.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
-/// edit.dartfix result
-///
-/// {
-/// "suggestions": List<DartFixSuggestion>
-/// "otherSuggestions": List<DartFixSuggestion>
-/// "hasErrors": bool
-/// "edits": List<SourceFileEdit>
-/// "details": optional List<String>
-/// "port": optional int
-/// "urls": optional List<String>
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class EditDartfixResult implements ResponseResult {
- /// A list of recommended changes that can be automatically made by applying
- /// the 'edits' included in this response.
- List<DartFixSuggestion> suggestions;
-
- /// A list of recommended changes that could not be automatically made.
- List<DartFixSuggestion> otherSuggestions;
-
- /// True if the analyzed source contains errors that might impact the
- /// correctness of the recommended changes that can be automatically applied.
- bool hasErrors;
-
- /// A list of source edits to apply the recommended changes.
- List<SourceFileEdit> edits;
-
- /// Messages that should be displayed to the user that describe details of
- /// the fix generation. For example, the messages might (a) point out details
- /// that users might want to explore before committing the changes or (b)
- /// describe exceptions that were thrown but that did not stop the fixes from
- /// being produced. The list will be omitted if it is empty.
- List<String>? details;
-
- /// The port on which the preview tool will respond to GET requests. The
- /// field is omitted if a preview was not requested.
- int? port;
-
- /// The URLs that users can visit in a browser to see a preview of the
- /// proposed changes. There is one URL for each of the included file paths.
- /// The field is omitted if a preview was not requested.
- List<String>? urls;
-
- EditDartfixResult(
- this.suggestions, this.otherSuggestions, this.hasErrors, this.edits,
- {this.details, this.port, this.urls});
-
- factory EditDartfixResult.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- List<DartFixSuggestion> suggestions;
- if (json.containsKey('suggestions')) {
- suggestions = jsonDecoder.decodeList(
- jsonPath + '.suggestions',
- json['suggestions'],
- (String jsonPath, Object? json) =>
- DartFixSuggestion.fromJson(jsonDecoder, jsonPath, json));
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'suggestions');
- }
- List<DartFixSuggestion> otherSuggestions;
- if (json.containsKey('otherSuggestions')) {
- otherSuggestions = jsonDecoder.decodeList(
- jsonPath + '.otherSuggestions',
- json['otherSuggestions'],
- (String jsonPath, Object? json) =>
- DartFixSuggestion.fromJson(jsonDecoder, jsonPath, json));
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'otherSuggestions');
- }
- bool hasErrors;
- if (json.containsKey('hasErrors')) {
- hasErrors =
- jsonDecoder.decodeBool(jsonPath + '.hasErrors', json['hasErrors']);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'hasErrors');
- }
- List<SourceFileEdit> edits;
- if (json.containsKey('edits')) {
- edits = jsonDecoder.decodeList(
- jsonPath + '.edits',
- json['edits'],
- (String jsonPath, Object? json) =>
- SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edits');
- }
- List<String>? details;
- if (json.containsKey('details')) {
- details = jsonDecoder.decodeList(
- jsonPath + '.details', json['details'], jsonDecoder.decodeString);
- }
- int? port;
- if (json.containsKey('port')) {
- port = jsonDecoder.decodeInt(jsonPath + '.port', json['port']);
- }
- List<String>? urls;
- if (json.containsKey('urls')) {
- urls = jsonDecoder.decodeList(
- jsonPath + '.urls', json['urls'], jsonDecoder.decodeString);
- }
- return EditDartfixResult(suggestions, otherSuggestions, hasErrors, edits,
- details: details, port: port, urls: urls);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edit.dartfix result', json);
- }
- }
-
- factory EditDartfixResult.fromResponse(Response response) {
- return EditDartfixResult.fromJson(
- ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
- 'result',
- response.result);
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['suggestions'] =
- suggestions.map((DartFixSuggestion value) => value.toJson()).toList();
- result['otherSuggestions'] = otherSuggestions
- .map((DartFixSuggestion value) => value.toJson())
- .toList();
- result['hasErrors'] = hasErrors;
- result['edits'] =
- edits.map((SourceFileEdit value) => value.toJson()).toList();
- var details = this.details;
- if (details != null) {
- result['details'] = details;
- }
- var port = this.port;
- if (port != null) {
- result['port'] = port;
- }
- var urls = this.urls;
- if (urls != null) {
- result['urls'] = urls;
- }
- return result;
- }
-
- @override
- Response toResponse(String id) {
- return Response(id, result: toJson());
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is EditDartfixResult) {
- return listEqual(suggestions, other.suggestions,
- (DartFixSuggestion a, DartFixSuggestion b) => a == b) &&
- listEqual(otherSuggestions, other.otherSuggestions,
- (DartFixSuggestion a, DartFixSuggestion b) => a == b) &&
- hasErrors == other.hasErrors &&
- listEqual(edits, other.edits,
- (SourceFileEdit a, SourceFileEdit b) => a == b) &&
- listEqual(details, other.details, (String a, String b) => a == b) &&
- port == other.port &&
- listEqual(urls, other.urls, (String a, String b) => a == b);
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, suggestions.hashCode);
- hash = JenkinsSmiHash.combine(hash, otherSuggestions.hashCode);
- hash = JenkinsSmiHash.combine(hash, hasErrors.hashCode);
- hash = JenkinsSmiHash.combine(hash, edits.hashCode);
- hash = JenkinsSmiHash.combine(hash, details.hashCode);
- hash = JenkinsSmiHash.combine(hash, port.hashCode);
- hash = JenkinsSmiHash.combine(hash, urls.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
/// edit.format params
///
/// {
@@ -6877,130 +6390,6 @@
}
}
-/// edit.getDartfixInfo params
-///
-/// {
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class EditGetDartfixInfoParams implements RequestParams {
- EditGetDartfixInfoParams();
-
- factory EditGetDartfixInfoParams.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- return EditGetDartfixInfoParams();
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edit.getDartfixInfo params', json);
- }
- }
-
- factory EditGetDartfixInfoParams.fromRequest(Request request) {
- return EditGetDartfixInfoParams.fromJson(
- RequestDecoder(request), 'params', request.params);
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- return result;
- }
-
- @override
- Request toRequest(String id) {
- return Request(id, 'edit.getDartfixInfo', toJson());
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is EditGetDartfixInfoParams) {
- return true;
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
-}
-
-/// edit.getDartfixInfo result
-///
-/// {
-/// "fixes": List<DartFix>
-/// }
-///
-/// Clients may not extend, implement or mix-in this class.
-class EditGetDartfixInfoResult implements ResponseResult {
- /// A list of fixes that can be specified in an edit.dartfix request.
- List<DartFix> fixes;
-
- EditGetDartfixInfoResult(this.fixes);
-
- factory EditGetDartfixInfoResult.fromJson(
- JsonDecoder jsonDecoder, String jsonPath, Object? json) {
- json ??= {};
- if (json is Map) {
- List<DartFix> fixes;
- if (json.containsKey('fixes')) {
- fixes = jsonDecoder.decodeList(
- jsonPath + '.fixes',
- json['fixes'],
- (String jsonPath, Object? json) =>
- DartFix.fromJson(jsonDecoder, jsonPath, json));
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'fixes');
- }
- return EditGetDartfixInfoResult(fixes);
- } else {
- throw jsonDecoder.mismatch(jsonPath, 'edit.getDartfixInfo result', json);
- }
- }
-
- factory EditGetDartfixInfoResult.fromResponse(Response response) {
- return EditGetDartfixInfoResult.fromJson(
- ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
- 'result',
- response.result);
- }
-
- @override
- Map<String, Object> toJson() {
- var result = <String, Object>{};
- result['fixes'] = fixes.map((DartFix value) => value.toJson()).toList();
- return result;
- }
-
- @override
- Response toResponse(String id) {
- return Response(id, result: toJson());
- }
-
- @override
- String toString() => json.encode(toJson());
-
- @override
- bool operator ==(other) {
- if (other is EditGetDartfixInfoResult) {
- return listEqual(fixes, other.fixes, (DartFix a, DartFix b) => a == b);
- }
- return false;
- }
-
- @override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
-}
-
/// edit.getFixes params
///
/// {
@@ -14269,7 +13658,6 @@
/// SERVER_ERROR
/// SORT_MEMBERS_INVALID_FILE
/// SORT_MEMBERS_PARSE_ERRORS
-/// UNKNOWN_FIX
/// UNKNOWN_REQUEST
/// UNSUPPORTED_FEATURE
/// }
@@ -14436,10 +13824,6 @@
static const RequestErrorCode SORT_MEMBERS_PARSE_ERRORS =
RequestErrorCode._('SORT_MEMBERS_PARSE_ERRORS');
- /// A dartfix request was received containing the name of a fix which does
- /// not match the name of any known fixes.
- static const RequestErrorCode UNKNOWN_FIX = RequestErrorCode._('UNKNOWN_FIX');
-
/// A request was received which the analysis server does not recognize, or
/// cannot handle in its current configuration.
static const RequestErrorCode UNKNOWN_REQUEST =
@@ -14487,7 +13871,6 @@
SERVER_ERROR,
SORT_MEMBERS_INVALID_FILE,
SORT_MEMBERS_PARSE_ERRORS,
- UNKNOWN_FIX,
UNKNOWN_REQUEST,
UNSUPPORTED_FEATURE
];
@@ -14563,8 +13946,6 @@
return SORT_MEMBERS_INVALID_FILE;
case 'SORT_MEMBERS_PARSE_ERRORS':
return SORT_MEMBERS_PARSE_ERRORS;
- case 'UNKNOWN_FIX':
- return UNKNOWN_FIX;
case 'UNKNOWN_REQUEST':
return UNKNOWN_REQUEST;
case 'UNSUPPORTED_FEATURE':