blob: 1c1456c77c1325a2c1d6a75a8c74605e96872add [file] [log] [blame]
// Copyright (c) 2017, 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".
import 'dart:convert' hide JsonDecoder;
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/src/protocol/protocol_internal.dart';
import 'package:analyzer_plugin/src/utilities/client_uri_converter.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
/// analysis.analyzedFiles params
///
/// {
/// "directories": List<FilePath>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisAnalyzedFilesParams implements HasToJson {
/// A list of the paths of the files that are being analyzed.
List<String> directories;
AnalysisAnalyzedFilesParams(this.directories);
factory AnalysisAnalyzedFilesParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
List<String> directories;
if (json.containsKey('directories')) {
directories = jsonDecoder.decodeList(
'$jsonPath.directories',
json['directories'],
(String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'directories');
}
return AnalysisAnalyzedFilesParams(directories);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.analyzedFiles params', json);
}
}
factory AnalysisAnalyzedFilesParams.fromNotification(
Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisAnalyzedFilesParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['directories'] = directories
.map((String value) =>
clientUriConverter?.toClientFilePath(value) ?? value)
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification('analysis.analyzedFiles',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisAnalyzedFilesParams) {
return listEqual(
directories, other.directories, (String a, String b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hashAll(directories);
}
/// analysis.closingLabels params
///
/// {
/// "file": FilePath
/// "labels": List<ClosingLabel>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisClosingLabelsParams implements HasToJson {
/// The file the closing labels relate to.
String file;
/// Closing labels relevant to the file. Each item represents a useful label
/// associated with some range with may be useful to display to the user
/// within the editor at the end of the range to indicate what construct is
/// closed at that location. Closing labels include constructor/method calls
/// and List arguments that span multiple lines. Note that the ranges that
/// are returned can overlap each other because they may be associated with
/// constructs that can be nested.
List<ClosingLabel> labels;
AnalysisClosingLabelsParams(this.file, this.labels);
factory AnalysisClosingLabelsParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
List<ClosingLabel> labels;
if (json.containsKey('labels')) {
labels = jsonDecoder.decodeList(
'$jsonPath.labels',
json['labels'],
(String jsonPath, Object? json) => ClosingLabel.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'labels');
}
return AnalysisClosingLabelsParams(file, labels);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.closingLabels params', json);
}
}
factory AnalysisClosingLabelsParams.fromNotification(
Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisClosingLabelsParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['labels'] = labels
.map((ClosingLabel value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification('analysis.closingLabels',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisClosingLabelsParams) {
return file == other.file &&
listEqual(
labels, other.labels, (ClosingLabel a, ClosingLabel b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
file,
Object.hashAll(labels),
);
}
/// AnalysisErrorFixes
///
/// {
/// "error": AnalysisError
/// "fixes": List<SourceChange>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisErrorFixes implements HasToJson {
/// The error with which the fixes are associated.
AnalysisError error;
/// The fixes associated with the error.
List<SourceChange> fixes;
AnalysisErrorFixes(this.error, {List<SourceChange>? fixes})
: fixes = fixes ?? <SourceChange>[];
factory AnalysisErrorFixes.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
AnalysisError error;
if (json.containsKey('error')) {
error = AnalysisError.fromJson(
jsonDecoder, '$jsonPath.error', json['error'],
clientUriConverter: clientUriConverter);
} else {
throw jsonDecoder.mismatch(jsonPath, 'error');
}
List<SourceChange> fixes;
if (json.containsKey('fixes')) {
fixes = jsonDecoder.decodeList(
'$jsonPath.fixes',
json['fixes'],
(String jsonPath, Object? json) => SourceChange.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'fixes');
}
return AnalysisErrorFixes(error, fixes: fixes);
} else {
throw jsonDecoder.mismatch(jsonPath, 'AnalysisErrorFixes', json);
}
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['error'] = error.toJson(clientUriConverter: clientUriConverter);
result['fixes'] = fixes
.map((SourceChange value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisErrorFixes) {
return error == other.error &&
listEqual(
fixes, other.fixes, (SourceChange a, SourceChange b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
error,
Object.hashAll(fixes),
);
}
/// analysis.errors params
///
/// {
/// "file": FilePath
/// "errors": List<AnalysisError>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisErrorsParams implements HasToJson {
/// The file containing the errors.
String file;
/// The errors contained in the file.
List<AnalysisError> errors;
AnalysisErrorsParams(this.file, this.errors);
factory AnalysisErrorsParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
List<AnalysisError> errors;
if (json.containsKey('errors')) {
errors = jsonDecoder.decodeList(
'$jsonPath.errors',
json['errors'],
(String jsonPath, Object? json) => AnalysisError.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'errors');
}
return AnalysisErrorsParams(file, errors);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.errors params', json);
}
}
factory AnalysisErrorsParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisErrorsParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['errors'] = errors
.map((AnalysisError value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification(
'analysis.errors', toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisErrorsParams) {
return file == other.file &&
listEqual(errors, other.errors,
(AnalysisError a, AnalysisError b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
file,
Object.hashAll(errors),
);
}
/// analysis.flushResults params
///
/// {
/// "files": List<FilePath>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisFlushResultsParams implements HasToJson {
/// The files that are no longer being analyzed.
List<String> files;
AnalysisFlushResultsParams(this.files);
factory AnalysisFlushResultsParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
List<String> files;
if (json.containsKey('files')) {
files = jsonDecoder.decodeList(
'$jsonPath.files',
json['files'],
(String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'files');
}
return AnalysisFlushResultsParams(files);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.flushResults params', json);
}
}
factory AnalysisFlushResultsParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisFlushResultsParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['files'] = files
.map((String value) =>
clientUriConverter?.toClientFilePath(value) ?? value)
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification('analysis.flushResults',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisFlushResultsParams) {
return listEqual(files, other.files, (String a, String b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hashAll(files);
}
/// analysis.folding params
///
/// {
/// "file": FilePath
/// "regions": List<FoldingRegion>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisFoldingParams implements HasToJson {
/// The file containing the folding regions.
String file;
/// The folding regions contained in the file.
List<FoldingRegion> regions;
AnalysisFoldingParams(this.file, this.regions);
factory AnalysisFoldingParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
List<FoldingRegion> regions;
if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList(
'$jsonPath.regions',
json['regions'],
(String jsonPath, Object? json) => FoldingRegion.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'regions');
}
return AnalysisFoldingParams(file, regions);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.folding params', json);
}
}
factory AnalysisFoldingParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisFoldingParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['regions'] = regions
.map((FoldingRegion value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification(
'analysis.folding', toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisFoldingParams) {
return file == other.file &&
listEqual(regions, other.regions,
(FoldingRegion a, FoldingRegion b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
file,
Object.hashAll(regions),
);
}
/// analysis.getErrors params
///
/// {
/// "file": FilePath
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetErrorsParams implements RequestParams {
/// The file for which errors are being requested.
String file;
AnalysisGetErrorsParams(this.file);
factory AnalysisGetErrorsParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
return AnalysisGetErrorsParams(file);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.getErrors params', json);
}
}
factory AnalysisGetErrorsParams.fromRequest(Request request,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetErrorsParams.fromJson(
RequestDecoder(request), 'params', request.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
return result;
}
@override
Request toRequest(String id,
{required ClientUriConverter? clientUriConverter}) {
return Request(id, 'analysis.getErrors',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetErrorsParams) {
return file == other.file;
}
return false;
}
@override
int get hashCode => file.hashCode;
}
/// analysis.getErrors result
///
/// {
/// "errors": List<AnalysisError>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetErrorsResult implements ResponseResult {
/// The errors associated with the file.
List<AnalysisError> errors;
AnalysisGetErrorsResult(this.errors);
factory AnalysisGetErrorsResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
List<AnalysisError> errors;
if (json.containsKey('errors')) {
errors = jsonDecoder.decodeList(
'$jsonPath.errors',
json['errors'],
(String jsonPath, Object? json) => AnalysisError.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'errors');
}
return AnalysisGetErrorsResult(errors);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.getErrors result', json);
}
}
factory AnalysisGetErrorsResult.fromResponse(Response response,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetErrorsResult.fromJson(
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
'result',
response.result,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['errors'] = errors
.map((AnalysisError value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
@override
Response toResponse(String id,
{required ClientUriConverter? clientUriConverter}) {
return Response(id, result: toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetErrorsResult) {
return listEqual(
errors, other.errors, (AnalysisError a, AnalysisError b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hashAll(errors);
}
/// analysis.getHover params
///
/// {
/// "file": FilePath
/// "offset": int
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetHoverParams implements RequestParams {
/// The file in which hover information is being requested.
String file;
/// The offset for which hover information is being requested.
int offset;
AnalysisGetHoverParams(this.file, this.offset);
factory AnalysisGetHoverParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
int offset;
if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offset');
}
return AnalysisGetHoverParams(file, offset);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.getHover params', json);
}
}
factory AnalysisGetHoverParams.fromRequest(Request request,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetHoverParams.fromJson(
RequestDecoder(request), 'params', request.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['offset'] = offset;
return result;
}
@override
Request toRequest(String id,
{required ClientUriConverter? clientUriConverter}) {
return Request(id, 'analysis.getHover',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetHoverParams) {
return file == other.file && offset == other.offset;
}
return false;
}
@override
int get hashCode => Object.hash(
file,
offset,
);
}
/// analysis.getHover result
///
/// {
/// "hovers": List<HoverInformation>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetHoverResult implements ResponseResult {
/// The hover information associated with the location. The list will be
/// empty if no information could be determined for the location. The list
/// can contain multiple items if the file is being analyzed in multiple
/// contexts in conflicting ways (such as a part that is included in multiple
/// libraries).
List<HoverInformation> hovers;
AnalysisGetHoverResult(this.hovers);
factory AnalysisGetHoverResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
List<HoverInformation> hovers;
if (json.containsKey('hovers')) {
hovers = jsonDecoder.decodeList(
'$jsonPath.hovers',
json['hovers'],
(String jsonPath, Object? json) => HoverInformation.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'hovers');
}
return AnalysisGetHoverResult(hovers);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.getHover result', json);
}
}
factory AnalysisGetHoverResult.fromResponse(Response response,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetHoverResult.fromJson(
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
'result',
response.result,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['hovers'] = hovers
.map((HoverInformation value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
@override
Response toResponse(String id,
{required ClientUriConverter? clientUriConverter}) {
return Response(id, result: toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetHoverResult) {
return listEqual(hovers, other.hovers,
(HoverInformation a, HoverInformation b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hashAll(hovers);
}
/// analysis.getImportedElements params
///
/// {
/// "file": FilePath
/// "offset": int
/// "length": int
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetImportedElementsParams implements RequestParams {
/// The file in which import information is being requested.
String file;
/// The offset of the region for which import information is being requested.
int offset;
/// The length of the region for which import information is being requested.
int length;
AnalysisGetImportedElementsParams(this.file, this.offset, this.length);
factory AnalysisGetImportedElementsParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
int offset;
if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offset');
}
int length;
if (json.containsKey('length')) {
length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'length');
}
return AnalysisGetImportedElementsParams(file, offset, length);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getImportedElements params', json);
}
}
factory AnalysisGetImportedElementsParams.fromRequest(Request request,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetImportedElementsParams.fromJson(
RequestDecoder(request), 'params', request.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['offset'] = offset;
result['length'] = length;
return result;
}
@override
Request toRequest(String id,
{required ClientUriConverter? clientUriConverter}) {
return Request(id, 'analysis.getImportedElements',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetImportedElementsParams) {
return file == other.file &&
offset == other.offset &&
length == other.length;
}
return false;
}
@override
int get hashCode => Object.hash(
file,
offset,
length,
);
}
/// analysis.getImportedElements result
///
/// {
/// "elements": List<ImportedElements>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetImportedElementsResult implements ResponseResult {
/// The information about the elements that are referenced in the specified
/// region of the specified file that come from imported libraries.
List<ImportedElements> elements;
AnalysisGetImportedElementsResult(this.elements);
factory AnalysisGetImportedElementsResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
List<ImportedElements> elements;
if (json.containsKey('elements')) {
elements = jsonDecoder.decodeList(
'$jsonPath.elements',
json['elements'],
(String jsonPath, Object? json) => ImportedElements.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'elements');
}
return AnalysisGetImportedElementsResult(elements);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getImportedElements result', json);
}
}
factory AnalysisGetImportedElementsResult.fromResponse(Response response,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetImportedElementsResult.fromJson(
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
'result',
response.result,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['elements'] = elements
.map((ImportedElements value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
@override
Response toResponse(String id,
{required ClientUriConverter? clientUriConverter}) {
return Response(id, result: toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetImportedElementsResult) {
return listEqual(elements, other.elements,
(ImportedElements a, ImportedElements b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hashAll(elements);
}
/// analysis.getLibraryDependencies params
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetLibraryDependenciesParams implements RequestParams {
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) =>
{};
@override
Request toRequest(String id,
{required ClientUriConverter? clientUriConverter}) {
return Request(id, 'analysis.getLibraryDependencies');
}
@override
bool operator ==(other) => other is AnalysisGetLibraryDependenciesParams;
@override
int get hashCode => 246577680;
}
/// analysis.getLibraryDependencies result
///
/// {
/// "libraries": List<FilePath>
/// "packageMap": Map<String, Map<String, List<FilePath>>>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetLibraryDependenciesResult implements ResponseResult {
/// A list of the paths of library elements referenced by files in existing
/// analysis roots.
List<String> libraries;
/// A mapping from context source roots to package maps which map package
/// names to source directories for use in client-side package URI
/// resolution.
Map<String, Map<String, List<String>>> packageMap;
AnalysisGetLibraryDependenciesResult(this.libraries, this.packageMap);
factory AnalysisGetLibraryDependenciesResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
List<String> libraries;
if (json.containsKey('libraries')) {
libraries = jsonDecoder.decodeList(
'$jsonPath.libraries',
json['libraries'],
(String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'libraries');
}
Map<String, Map<String, List<String>>> packageMap;
if (json.containsKey('packageMap')) {
packageMap = jsonDecoder.decodeMap(
'$jsonPath.packageMap', json['packageMap'],
valueDecoder: (String jsonPath, Object? json) =>
jsonDecoder.decodeMap(jsonPath, json,
valueDecoder: (String jsonPath, Object? json) =>
jsonDecoder.decodeList(
jsonPath,
json,
(String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json))));
} else {
throw jsonDecoder.mismatch(jsonPath, 'packageMap');
}
return AnalysisGetLibraryDependenciesResult(libraries, packageMap);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getLibraryDependencies result', json);
}
}
factory AnalysisGetLibraryDependenciesResult.fromResponse(Response response,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetLibraryDependenciesResult.fromJson(
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
'result',
response.result,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['libraries'] = libraries
.map((String value) =>
clientUriConverter?.toClientFilePath(value) ?? value)
.toList();
result['packageMap'] = mapMap(packageMap,
valueCallback: (Map<String, List<String>> value) => mapMap(value,
valueCallback: (List<String> value) => value
.map((String value) =>
clientUriConverter?.toClientFilePath(value) ?? value)
.toList()));
return result;
}
@override
Response toResponse(String id,
{required ClientUriConverter? clientUriConverter}) {
return Response(id, result: toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetLibraryDependenciesResult) {
return listEqual(
libraries, other.libraries, (String a, String b) => a == b) &&
mapEqual(
packageMap,
other.packageMap,
(Map<String, List<String>> a, Map<String, List<String>> b) =>
mapEqual(
a,
b,
(List<String> a, List<String> b) =>
listEqual(a, b, (String a, String b) => a == b)));
}
return false;
}
@override
int get hashCode => Object.hash(
Object.hashAll(libraries),
Object.hashAll([...packageMap.keys, ...packageMap.values]),
);
}
/// analysis.getNavigation params
///
/// {
/// "file": FilePath
/// "offset": int
/// "length": int
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetNavigationParams implements RequestParams {
/// The file in which navigation information is being requested.
String file;
/// The offset of the region for which navigation information is being
/// requested.
int offset;
/// The length of the region for which navigation information is being
/// requested.
int length;
AnalysisGetNavigationParams(this.file, this.offset, this.length);
factory AnalysisGetNavigationParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
int offset;
if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offset');
}
int length;
if (json.containsKey('length')) {
length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'length');
}
return AnalysisGetNavigationParams(file, offset, length);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getNavigation params', json);
}
}
factory AnalysisGetNavigationParams.fromRequest(Request request,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetNavigationParams.fromJson(
RequestDecoder(request), 'params', request.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['offset'] = offset;
result['length'] = length;
return result;
}
@override
Request toRequest(String id,
{required ClientUriConverter? clientUriConverter}) {
return Request(id, 'analysis.getNavigation',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetNavigationParams) {
return file == other.file &&
offset == other.offset &&
length == other.length;
}
return false;
}
@override
int get hashCode => Object.hash(
file,
offset,
length,
);
}
/// analysis.getNavigation result
///
/// {
/// "files": List<FilePath>
/// "targets": List<NavigationTarget>
/// "regions": List<NavigationRegion>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetNavigationResult implements ResponseResult {
/// A list of the paths of files that are referenced by the navigation
/// targets.
List<String> files;
/// A list of the navigation targets that are referenced by the navigation
/// regions.
List<NavigationTarget> targets;
/// A list of the navigation regions within the requested region of the file.
List<NavigationRegion> regions;
AnalysisGetNavigationResult(this.files, this.targets, this.regions);
factory AnalysisGetNavigationResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
List<String> files;
if (json.containsKey('files')) {
files = jsonDecoder.decodeList(
'$jsonPath.files',
json['files'],
(String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'files');
}
List<NavigationTarget> targets;
if (json.containsKey('targets')) {
targets = jsonDecoder.decodeList(
'$jsonPath.targets',
json['targets'],
(String jsonPath, Object? json) => NavigationTarget.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'targets');
}
List<NavigationRegion> regions;
if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList(
'$jsonPath.regions',
json['regions'],
(String jsonPath, Object? json) => NavigationRegion.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'regions');
}
return AnalysisGetNavigationResult(files, targets, regions);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getNavigation result', json);
}
}
factory AnalysisGetNavigationResult.fromResponse(Response response,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetNavigationResult.fromJson(
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
'result',
response.result,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['files'] = files
.map((String value) =>
clientUriConverter?.toClientFilePath(value) ?? value)
.toList();
result['targets'] = targets
.map((NavigationTarget value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
result['regions'] = regions
.map((NavigationRegion value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
@override
Response toResponse(String id,
{required ClientUriConverter? clientUriConverter}) {
return Response(id, result: toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetNavigationResult) {
return listEqual(files, other.files, (String a, String b) => a == b) &&
listEqual(targets, other.targets,
(NavigationTarget a, NavigationTarget b) => a == b) &&
listEqual(regions, other.regions,
(NavigationRegion a, NavigationRegion b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
Object.hashAll(files),
Object.hashAll(targets),
Object.hashAll(regions),
);
}
/// analysis.getReachableSources params
///
/// {
/// "file": FilePath
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetReachableSourcesParams implements RequestParams {
/// The file for which reachable source information is being requested.
String file;
AnalysisGetReachableSourcesParams(this.file);
factory AnalysisGetReachableSourcesParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
return AnalysisGetReachableSourcesParams(file);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getReachableSources params', json);
}
}
factory AnalysisGetReachableSourcesParams.fromRequest(Request request,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetReachableSourcesParams.fromJson(
RequestDecoder(request), 'params', request.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
return result;
}
@override
Request toRequest(String id,
{required ClientUriConverter? clientUriConverter}) {
return Request(id, 'analysis.getReachableSources',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetReachableSourcesParams) {
return file == other.file;
}
return false;
}
@override
int get hashCode => file.hashCode;
}
/// analysis.getReachableSources result
///
/// {
/// "sources": Map<String, List<String>>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetReachableSourcesResult implements ResponseResult {
/// A mapping from source URIs to directly reachable source URIs. For
/// example, a file "foo.dart" that imports "bar.dart" would have the
/// corresponding mapping { "file:///foo.dart" : ["file:///bar.dart"] }. If
/// "bar.dart" has further imports (or exports) there will be a mapping from
/// the URI "file:///bar.dart" to them. To check if a specific URI is
/// reachable from a given file, clients can check for its presence in the
/// resulting key set.
Map<String, List<String>> sources;
AnalysisGetReachableSourcesResult(this.sources);
factory AnalysisGetReachableSourcesResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
Map<String, List<String>> sources;
if (json.containsKey('sources')) {
sources = jsonDecoder.decodeMap('$jsonPath.sources', json['sources'],
valueDecoder: (String jsonPath, Object? json) => jsonDecoder
.decodeList(jsonPath, json, jsonDecoder.decodeString));
} else {
throw jsonDecoder.mismatch(jsonPath, 'sources');
}
return AnalysisGetReachableSourcesResult(sources);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getReachableSources result', json);
}
}
factory AnalysisGetReachableSourcesResult.fromResponse(Response response,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetReachableSourcesResult.fromJson(
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
'result',
response.result,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['sources'] = sources;
return result;
}
@override
Response toResponse(String id,
{required ClientUriConverter? clientUriConverter}) {
return Response(id, result: toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetReachableSourcesResult) {
return mapEqual(
sources,
other.sources,
(List<String> a, List<String> b) =>
listEqual(a, b, (String a, String b) => a == b));
}
return false;
}
@override
int get hashCode => Object.hashAll([...sources.keys, ...sources.values]);
}
/// analysis.getSignature params
///
/// {
/// "file": FilePath
/// "offset": int
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetSignatureParams implements RequestParams {
/// The file in which signature information is being requested.
String file;
/// The location for which signature information is being requested.
int offset;
AnalysisGetSignatureParams(this.file, this.offset);
factory AnalysisGetSignatureParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
int offset;
if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offset');
}
return AnalysisGetSignatureParams(file, offset);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getSignature params', json);
}
}
factory AnalysisGetSignatureParams.fromRequest(Request request,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetSignatureParams.fromJson(
RequestDecoder(request), 'params', request.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['offset'] = offset;
return result;
}
@override
Request toRequest(String id,
{required ClientUriConverter? clientUriConverter}) {
return Request(id, 'analysis.getSignature',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetSignatureParams) {
return file == other.file && offset == other.offset;
}
return false;
}
@override
int get hashCode => Object.hash(
file,
offset,
);
}
/// analysis.getSignature result
///
/// {
/// "name": String
/// "parameters": List<ParameterInfo>
/// "dartdoc": optional String
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisGetSignatureResult implements ResponseResult {
/// The name of the function being invoked at the given offset.
String name;
/// A list of information about each of the parameters of the function being
/// invoked.
List<ParameterInfo> parameters;
/// The dartdoc associated with the function being invoked. Other than the
/// removal of the comment delimiters, including leading asterisks in the
/// case of a block comment, the dartdoc is unprocessed markdown. This data
/// is omitted if there is no referenced element, or if the element has no
/// dartdoc.
String? dartdoc;
AnalysisGetSignatureResult(this.name, this.parameters, {this.dartdoc});
factory AnalysisGetSignatureResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String name;
if (json.containsKey('name')) {
name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'name');
}
List<ParameterInfo> parameters;
if (json.containsKey('parameters')) {
parameters = jsonDecoder.decodeList(
'$jsonPath.parameters',
json['parameters'],
(String jsonPath, Object? json) => ParameterInfo.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'parameters');
}
String? dartdoc;
if (json.containsKey('dartdoc')) {
dartdoc =
jsonDecoder.decodeString('$jsonPath.dartdoc', json['dartdoc']);
}
return AnalysisGetSignatureResult(name, parameters, dartdoc: dartdoc);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getSignature result', json);
}
}
factory AnalysisGetSignatureResult.fromResponse(Response response,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisGetSignatureResult.fromJson(
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
'result',
response.result,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['name'] = name;
result['parameters'] = parameters
.map((ParameterInfo value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
var dartdoc = this.dartdoc;
if (dartdoc != null) {
result['dartdoc'] = dartdoc;
}
return result;
}
@override
Response toResponse(String id,
{required ClientUriConverter? clientUriConverter}) {
return Response(id, result: toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisGetSignatureResult) {
return name == other.name &&
listEqual(parameters, other.parameters,
(ParameterInfo a, ParameterInfo b) => a == b) &&
dartdoc == other.dartdoc;
}
return false;
}
@override
int get hashCode => Object.hash(
name,
Object.hashAll(parameters),
dartdoc,
);
}
/// analysis.highlights params
///
/// {
/// "file": FilePath
/// "regions": List<HighlightRegion>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisHighlightsParams implements HasToJson {
/// The file containing the highlight regions.
String file;
/// The highlight regions contained in the file. Each highlight region
/// represents a particular syntactic or semantic meaning associated with
/// some range. Note that the highlight regions that are returned can overlap
/// other highlight regions if there is more than one meaning associated with
/// a particular region.
List<HighlightRegion> regions;
AnalysisHighlightsParams(this.file, this.regions);
factory AnalysisHighlightsParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
List<HighlightRegion> regions;
if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList(
'$jsonPath.regions',
json['regions'],
(String jsonPath, Object? json) => HighlightRegion.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'regions');
}
return AnalysisHighlightsParams(file, regions);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.highlights params', json);
}
}
factory AnalysisHighlightsParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisHighlightsParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['regions'] = regions
.map((HighlightRegion value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification(
'analysis.highlights', toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisHighlightsParams) {
return file == other.file &&
listEqual(regions, other.regions,
(HighlightRegion a, HighlightRegion b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
file,
Object.hashAll(regions),
);
}
/// analysis.implemented params
///
/// {
/// "file": FilePath
/// "classes": List<ImplementedClass>
/// "members": List<ImplementedMember>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisImplementedParams implements HasToJson {
/// The file with which the implementations are associated.
String file;
/// The classes defined in the file that are implemented or extended.
List<ImplementedClass> classes;
/// The member defined in the file that are implemented or overridden.
List<ImplementedMember> members;
AnalysisImplementedParams(this.file, this.classes, this.members);
factory AnalysisImplementedParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
List<ImplementedClass> classes;
if (json.containsKey('classes')) {
classes = jsonDecoder.decodeList(
'$jsonPath.classes',
json['classes'],
(String jsonPath, Object? json) => ImplementedClass.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'classes');
}
List<ImplementedMember> members;
if (json.containsKey('members')) {
members = jsonDecoder.decodeList(
'$jsonPath.members',
json['members'],
(String jsonPath, Object? json) => ImplementedMember.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'members');
}
return AnalysisImplementedParams(file, classes, members);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.implemented params', json);
}
}
factory AnalysisImplementedParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisImplementedParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['classes'] = classes
.map((ImplementedClass value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
result['members'] = members
.map((ImplementedMember value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification(
'analysis.implemented', toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisImplementedParams) {
return file == other.file &&
listEqual(classes, other.classes,
(ImplementedClass a, ImplementedClass b) => a == b) &&
listEqual(members, other.members,
(ImplementedMember a, ImplementedMember b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
file,
Object.hashAll(classes),
Object.hashAll(members),
);
}
/// analysis.invalidate params
///
/// {
/// "file": FilePath
/// "offset": int
/// "length": int
/// "delta": int
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisInvalidateParams implements HasToJson {
/// The file whose information has been invalidated.
String file;
/// The offset of the invalidated region.
int offset;
/// The length of the invalidated region.
int length;
/// The delta to be applied to the offsets in information that follows the
/// invalidated region in order to update it so that it doesn't need to be
/// re-requested.
int delta;
AnalysisInvalidateParams(this.file, this.offset, this.length, this.delta);
factory AnalysisInvalidateParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
int offset;
if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offset');
}
int length;
if (json.containsKey('length')) {
length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'length');
}
int delta;
if (json.containsKey('delta')) {
delta = jsonDecoder.decodeInt('$jsonPath.delta', json['delta']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'delta');
}
return AnalysisInvalidateParams(file, offset, length, delta);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.invalidate params', json);
}
}
factory AnalysisInvalidateParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisInvalidateParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['offset'] = offset;
result['length'] = length;
result['delta'] = delta;
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification(
'analysis.invalidate', toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisInvalidateParams) {
return file == other.file &&
offset == other.offset &&
length == other.length &&
delta == other.delta;
}
return false;
}
@override
int get hashCode => Object.hash(
file,
offset,
length,
delta,
);
}
/// analysis.navigation params
///
/// {
/// "file": FilePath
/// "regions": List<NavigationRegion>
/// "targets": List<NavigationTarget>
/// "files": List<FilePath>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisNavigationParams implements HasToJson {
/// The file containing the navigation regions.
String file;
/// The navigation regions contained in the file. The regions are sorted by
/// their offsets. Each navigation region represents a list of targets
/// associated with some range. The lists will usually contain a single
/// target, but can contain more in the case of a part that is included in
/// multiple libraries or in Dart code that is compiled against multiple
/// versions of a package. Note that the navigation regions that are returned
/// do not overlap other navigation regions.
List<NavigationRegion> regions;
/// The navigation targets referenced in the file. They are referenced by
/// NavigationRegions by their index in this array.
List<NavigationTarget> targets;
/// The files containing navigation targets referenced in the file. They are
/// referenced by NavigationTargets by their index in this array.
List<String> files;
AnalysisNavigationParams(this.file, this.regions, this.targets, this.files);
factory AnalysisNavigationParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
List<NavigationRegion> regions;
if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList(
'$jsonPath.regions',
json['regions'],
(String jsonPath, Object? json) => NavigationRegion.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'regions');
}
List<NavigationTarget> targets;
if (json.containsKey('targets')) {
targets = jsonDecoder.decodeList(
'$jsonPath.targets',
json['targets'],
(String jsonPath, Object? json) => NavigationTarget.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'targets');
}
List<String> files;
if (json.containsKey('files')) {
files = jsonDecoder.decodeList(
'$jsonPath.files',
json['files'],
(String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'files');
}
return AnalysisNavigationParams(file, regions, targets, files);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.navigation params', json);
}
}
factory AnalysisNavigationParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisNavigationParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['regions'] = regions
.map((NavigationRegion value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
result['targets'] = targets
.map((NavigationTarget value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
result['files'] = files
.map((String value) =>
clientUriConverter?.toClientFilePath(value) ?? value)
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification(
'analysis.navigation', toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisNavigationParams) {
return file == other.file &&
listEqual(regions, other.regions,
(NavigationRegion a, NavigationRegion b) => a == b) &&
listEqual(targets, other.targets,
(NavigationTarget a, NavigationTarget b) => a == b) &&
listEqual(files, other.files, (String a, String b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
file,
Object.hashAll(regions),
Object.hashAll(targets),
Object.hashAll(files),
);
}
/// analysis.occurrences params
///
/// {
/// "file": FilePath
/// "occurrences": List<Occurrences>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisOccurrencesParams implements HasToJson {
/// The file in which the references occur.
String file;
/// The occurrences of references to elements within the file.
List<Occurrences> occurrences;
AnalysisOccurrencesParams(this.file, this.occurrences);
factory AnalysisOccurrencesParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
List<Occurrences> occurrences;
if (json.containsKey('occurrences')) {
occurrences = jsonDecoder.decodeList(
'$jsonPath.occurrences',
json['occurrences'],
(String jsonPath, Object? json) => Occurrences.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'occurrences');
}
return AnalysisOccurrencesParams(file, occurrences);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.occurrences params', json);
}
}
factory AnalysisOccurrencesParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisOccurrencesParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['occurrences'] = occurrences
.map((Occurrences value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification(
'analysis.occurrences', toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisOccurrencesParams) {
return file == other.file &&
listEqual(occurrences, other.occurrences,
(Occurrences a, Occurrences b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
file,
Object.hashAll(occurrences),
);
}
/// AnalysisOptions
///
/// {
/// "enableAsync": optional bool
/// "enableDeferredLoading": optional bool
/// "enableEnums": optional bool
/// "enableNullAwareOperators": optional bool
/// "generateDart2jsHints": optional bool
/// "generateHints": optional bool
/// "generateLints": optional bool
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisOptions implements HasToJson {
/// Deprecated: this feature is always enabled.
///
/// True if the client wants to enable support for the proposed async
/// feature.
bool? enableAsync;
/// Deprecated: this feature is always enabled.
///
/// True if the client wants to enable support for the proposed deferred
/// loading feature.
bool? enableDeferredLoading;
/// Deprecated: this feature is always enabled.
///
/// True if the client wants to enable support for the proposed enum feature.
bool? enableEnums;
/// Deprecated: this feature is always enabled.
///
/// True if the client wants to enable support for the proposed "null aware
/// operators" feature.
bool? enableNullAwareOperators;
/// True if hints that are specific to dart2js should be generated. This
/// option is ignored if generateHints is false.
bool? generateDart2jsHints;
/// True if hints should be generated as part of generating errors and
/// warnings.
bool? generateHints;
/// True if lints should be generated as part of generating errors and
/// warnings.
bool? generateLints;
AnalysisOptions(
{this.enableAsync,
this.enableDeferredLoading,
this.enableEnums,
this.enableNullAwareOperators,
this.generateDart2jsHints,
this.generateHints,
this.generateLints});
factory AnalysisOptions.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
bool? enableAsync;
if (json.containsKey('enableAsync')) {
enableAsync = jsonDecoder.decodeBool(
'$jsonPath.enableAsync', json['enableAsync']);
}
bool? enableDeferredLoading;
if (json.containsKey('enableDeferredLoading')) {
enableDeferredLoading = jsonDecoder.decodeBool(
'$jsonPath.enableDeferredLoading', json['enableDeferredLoading']);
}
bool? enableEnums;
if (json.containsKey('enableEnums')) {
enableEnums = jsonDecoder.decodeBool(
'$jsonPath.enableEnums', json['enableEnums']);
}
bool? enableNullAwareOperators;
if (json.containsKey('enableNullAwareOperators')) {
enableNullAwareOperators = jsonDecoder.decodeBool(
'$jsonPath.enableNullAwareOperators',
json['enableNullAwareOperators']);
}
bool? generateDart2jsHints;
if (json.containsKey('generateDart2jsHints')) {
generateDart2jsHints = jsonDecoder.decodeBool(
'$jsonPath.generateDart2jsHints', json['generateDart2jsHints']);
}
bool? generateHints;
if (json.containsKey('generateHints')) {
generateHints = jsonDecoder.decodeBool(
'$jsonPath.generateHints', json['generateHints']);
}
bool? generateLints;
if (json.containsKey('generateLints')) {
generateLints = jsonDecoder.decodeBool(
'$jsonPath.generateLints', json['generateLints']);
}
return AnalysisOptions(
enableAsync: enableAsync,
enableDeferredLoading: enableDeferredLoading,
enableEnums: enableEnums,
enableNullAwareOperators: enableNullAwareOperators,
generateDart2jsHints: generateDart2jsHints,
generateHints: generateHints,
generateLints: generateLints);
} else {
throw jsonDecoder.mismatch(jsonPath, 'AnalysisOptions', json);
}
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
var enableAsync = this.enableAsync;
if (enableAsync != null) {
result['enableAsync'] = enableAsync;
}
var enableDeferredLoading = this.enableDeferredLoading;
if (enableDeferredLoading != null) {
result['enableDeferredLoading'] = enableDeferredLoading;
}
var enableEnums = this.enableEnums;
if (enableEnums != null) {
result['enableEnums'] = enableEnums;
}
var enableNullAwareOperators = this.enableNullAwareOperators;
if (enableNullAwareOperators != null) {
result['enableNullAwareOperators'] = enableNullAwareOperators;
}
var generateDart2jsHints = this.generateDart2jsHints;
if (generateDart2jsHints != null) {
result['generateDart2jsHints'] = generateDart2jsHints;
}
var generateHints = this.generateHints;
if (generateHints != null) {
result['generateHints'] = generateHints;
}
var generateLints = this.generateLints;
if (generateLints != null) {
result['generateLints'] = generateLints;
}
return result;
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisOptions) {
return enableAsync == other.enableAsync &&
enableDeferredLoading == other.enableDeferredLoading &&
enableEnums == other.enableEnums &&
enableNullAwareOperators == other.enableNullAwareOperators &&
generateDart2jsHints == other.generateDart2jsHints &&
generateHints == other.generateHints &&
generateLints == other.generateLints;
}
return false;
}
@override
int get hashCode => Object.hash(
enableAsync,
enableDeferredLoading,
enableEnums,
enableNullAwareOperators,
generateDart2jsHints,
generateHints,
generateLints,
);
}
/// analysis.outline params
///
/// {
/// "file": FilePath
/// "kind": FileKind
/// "libraryName": optional String
/// "outline": Outline
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisOutlineParams implements HasToJson {
/// The file with which the outline is associated.
String file;
/// The kind of the file.
FileKind kind;
/// The name of the library defined by the file using a "library" directive,
/// or referenced by a "part of" directive. If both "library" and "part of"
/// directives are present, then the "library" directive takes precedence.
/// This field will be omitted if the file has neither "library" nor "part
/// of" directives.
String? libraryName;
/// The outline associated with the file.
Outline outline;
AnalysisOutlineParams(this.file, this.kind, this.outline, {this.libraryName});
factory AnalysisOutlineParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
FileKind kind;
if (json.containsKey('kind')) {
kind = FileKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind'],
clientUriConverter: clientUriConverter);
} else {
throw jsonDecoder.mismatch(jsonPath, 'kind');
}
String? libraryName;
if (json.containsKey('libraryName')) {
libraryName = jsonDecoder.decodeString(
'$jsonPath.libraryName', json['libraryName']);
}
Outline outline;
if (json.containsKey('outline')) {
outline = Outline.fromJson(
jsonDecoder, '$jsonPath.outline', json['outline'],
clientUriConverter: clientUriConverter);
} else {
throw jsonDecoder.mismatch(jsonPath, 'outline');
}
return AnalysisOutlineParams(file, kind, outline,
libraryName: libraryName);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.outline params', json);
}
}
factory AnalysisOutlineParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisOutlineParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['kind'] = kind.toJson(clientUriConverter: clientUriConverter);
var libraryName = this.libraryName;
if (libraryName != null) {
result['libraryName'] = libraryName;
}
result['outline'] = outline.toJson(clientUriConverter: clientUriConverter);
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification(
'analysis.outline', toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisOutlineParams) {
return file == other.file &&
kind == other.kind &&
libraryName == other.libraryName &&
outline == other.outline;
}
return false;
}
@override
int get hashCode => Object.hash(
file,
kind,
libraryName,
outline,
);
}
/// analysis.overrides params
///
/// {
/// "file": FilePath
/// "overrides": List<Override>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisOverridesParams implements HasToJson {
/// The file with which the overrides are associated.
String file;
/// The overrides associated with the file.
List<Override> overrides;
AnalysisOverridesParams(this.file, this.overrides);
factory AnalysisOverridesParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
List<Override> overrides;
if (json.containsKey('overrides')) {
overrides = jsonDecoder.decodeList(
'$jsonPath.overrides',
json['overrides'],
(String jsonPath, Object? json) => Override.fromJson(
jsonDecoder, jsonPath, json,
clientUriConverter: clientUriConverter));
} else {
throw jsonDecoder.mismatch(jsonPath, 'overrides');
}
return AnalysisOverridesParams(file, overrides);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.overrides params', json);
}
}
factory AnalysisOverridesParams.fromNotification(Notification notification,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisOverridesParams.fromJson(
ResponseDecoder(null), 'params', notification.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['file'] = clientUriConverter?.toClientFilePath(file) ?? file;
result['overrides'] = overrides
.map((Override value) =>
value.toJson(clientUriConverter: clientUriConverter))
.toList();
return result;
}
Notification toNotification(
{required ClientUriConverter? clientUriConverter}) {
return Notification(
'analysis.overrides', toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisOverridesParams) {
return file == other.file &&
listEqual(
overrides, other.overrides, (Override a, Override b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
file,
Object.hashAll(overrides),
);
}
/// analysis.reanalyze params
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisReanalyzeParams implements RequestParams {
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) =>
{};
@override
Request toRequest(String id,
{required ClientUriConverter? clientUriConverter}) {
return Request(id, 'analysis.reanalyze');
}
@override
bool operator ==(other) => other is AnalysisReanalyzeParams;
@override
int get hashCode => 613039876;
}
/// analysis.reanalyze result
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisReanalyzeResult implements ResponseResult {
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) =>
{};
@override
Response toResponse(String id,
{required ClientUriConverter? clientUriConverter}) {
return Response(id);
}
@override
bool operator ==(other) => other is AnalysisReanalyzeResult;
@override
int get hashCode => 846803925;
}
/// AnalysisService
///
/// enum {
/// CLOSING_LABELS
/// FOLDING
/// HIGHLIGHTS
/// IMPLEMENTED
/// INVALIDATE
/// NAVIGATION
/// OCCURRENCES
/// OUTLINE
/// OVERRIDES
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisService implements Enum {
static const AnalysisService CLOSING_LABELS =
AnalysisService._('CLOSING_LABELS');
static const AnalysisService FOLDING = AnalysisService._('FOLDING');
static const AnalysisService HIGHLIGHTS = AnalysisService._('HIGHLIGHTS');
static const AnalysisService IMPLEMENTED = AnalysisService._('IMPLEMENTED');
/// This service is not currently implemented and will become a
/// GeneralAnalysisService in a future release.
static const AnalysisService INVALIDATE = AnalysisService._('INVALIDATE');
static const AnalysisService NAVIGATION = AnalysisService._('NAVIGATION');
static const AnalysisService OCCURRENCES = AnalysisService._('OCCURRENCES');
static const AnalysisService OUTLINE = AnalysisService._('OUTLINE');
static const AnalysisService OVERRIDES = AnalysisService._('OVERRIDES');
/// A list containing all of the enum values that are defined.
static const List<AnalysisService> VALUES = <AnalysisService>[
CLOSING_LABELS,
FOLDING,
HIGHLIGHTS,
IMPLEMENTED,
INVALIDATE,
NAVIGATION,
OCCURRENCES,
OUTLINE,
OVERRIDES
];
@override
final String name;
const AnalysisService._(this.name);
factory AnalysisService(String name) {
switch (name) {
case 'CLOSING_LABELS':
return CLOSING_LABELS;
case 'FOLDING':
return FOLDING;
case 'HIGHLIGHTS':
return HIGHLIGHTS;
case 'IMPLEMENTED':
return IMPLEMENTED;
case 'INVALIDATE':
return INVALIDATE;
case 'NAVIGATION':
return NAVIGATION;
case 'OCCURRENCES':
return OCCURRENCES;
case 'OUTLINE':
return OUTLINE;
case 'OVERRIDES':
return OVERRIDES;
}
throw Exception('Illegal enum value: $name');
}
factory AnalysisService.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
if (json is String) {
try {
return AnalysisService(json);
} catch (_) {
// Fall through
}
}
throw jsonDecoder.mismatch(jsonPath, 'AnalysisService', json);
}
@override
String toString() => 'AnalysisService.$name';
String toJson({required ClientUriConverter? clientUriConverter}) => name;
}
/// analysis.setAnalysisRoots params
///
/// {
/// "included": List<FilePath>
/// "excluded": List<FilePath>
/// "packageRoots": optional Map<FilePath, FilePath>
/// }
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisSetAnalysisRootsParams implements RequestParams {
/// A list of the files and directories that should be analyzed.
List<String> included;
/// A list of the files and directories within the included directories that
/// should not be analyzed.
List<String> excluded;
/// A mapping from source directories to package roots that should override
/// the normal package: URI resolution mechanism.
///
/// If a package root is a file, then the analyzer will behave as though that
/// file is a ".dart_tool/package_config.json" file in the source directory.
/// The effect is the same as specifying the file as a "--packages" parameter
/// to the Dart VM when executing any Dart file inside the source directory.
///
/// Files in any directories that are not overridden by this mapping have
/// their package: URI's resolved using the normal pubspec.yaml mechanism. If
/// this field is absent, or the empty map is specified, that indicates that
/// the normal pubspec.yaml mechanism should always be used.
Map<String, String>? packageRoots;
AnalysisSetAnalysisRootsParams(this.included, this.excluded,
{this.packageRoots});
factory AnalysisSetAnalysisRootsParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{required ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
List<String> included;
if (json.containsKey('included')) {
included = jsonDecoder.decodeList(
'$jsonPath.included',
json['included'],
(String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'included');
}
List<String> excluded;
if (json.containsKey('excluded')) {
excluded = jsonDecoder.decodeList(
'$jsonPath.excluded',
json['excluded'],
(String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'excluded');
}
Map<String, String>? packageRoots;
if (json.containsKey('packageRoots')) {
packageRoots = jsonDecoder.decodeMap(
'$jsonPath.packageRoots', json['packageRoots'],
keyDecoder: (String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json),
valueDecoder: (String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json)) ??
jsonDecoder.decodeString(jsonPath, json));
}
return AnalysisSetAnalysisRootsParams(included, excluded,
packageRoots: packageRoots);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.setAnalysisRoots params', json);
}
}
factory AnalysisSetAnalysisRootsParams.fromRequest(Request request,
{required ClientUriConverter? clientUriConverter}) {
return AnalysisSetAnalysisRootsParams.fromJson(
RequestDecoder(request), 'params', request.params,
clientUriConverter: clientUriConverter);
}
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) {
var result = <String, Object>{};
result['included'] = included
.map((String value) =>
clientUriConverter?.toClientFilePath(value) ?? value)
.toList();
result['excluded'] = excluded
.map((String value) =>
clientUriConverter?.toClientFilePath(value) ?? value)
.toList();
var packageRoots = this.packageRoots;
if (packageRoots != null) {
result['packageRoots'] = mapMap(packageRoots,
keyCallback: (String value) =>
clientUriConverter?.toClientFilePath(value) ?? value,
valueCallback: (String value) =>
clientUriConverter?.toClientFilePath(value) ?? value);
}
return result;
}
@override
Request toRequest(String id,
{required ClientUriConverter? clientUriConverter}) {
return Request(id, 'analysis.setAnalysisRoots',
toJson(clientUriConverter: clientUriConverter));
}
@override
String toString() => json.encode(toJson(clientUriConverter: null));
@override
bool operator ==(other) {
if (other is AnalysisSetAnalysisRootsParams) {
return listEqual(
included, other.included, (String a, String b) => a == b) &&
listEqual(excluded, other.excluded, (String a, String b) => a == b) &&
mapEqual(
packageRoots, other.packageRoots, (String a, String b) => a == b);
}
return false;
}
@override
int get hashCode => Object.hash(
Object.hashAll(included),
Object.hashAll(excluded),
Object.hashAll([...?packageRoots?.keys, ...?packageRoots?.values]),
);
}
/// analysis.setAnalysisRoots result
///
/// Clients may not extend, implement or mix-in this class.
class AnalysisSetAnalysisRootsResult implements ResponseResult {
@override
Map<String, Object> toJson(
{required ClientUriConverter? clientUriConverter}) =>
{};
@override
Response toResponse(String id,
{required ClientUriConverter? clientUriConverter}) {
return Response(id);
}
@override
bool operator ==(other) => other is AnalysisSetAnalysisRootsResult;
@override
int get hashCode => 866004753;
}