Version 2.14.0-287.0.dev
Merge commit 'c2f5625fa714c16abd748024db7769402a97adf5' into 'dev'
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
index 3992b34..0688ab2 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -3455,7 +3455,7 @@
/// method takes the next token to be consumed rather than the last consumed
/// token and returns the token after the last consumed token rather than the
/// last consumed token.
- Token parseClassMember(Token token, String className) {
+ Token parseClassMember(Token token, String? className) {
return parseClassOrMixinOrExtensionMemberImpl(
syntheticPreviousToken(token), DeclarationKind.Class, className)
.next!;
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
index ce64454..455dfdf 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
@@ -504,6 +504,10 @@
/// Returns [null] if a [ParserRecovery] value is found, or [list] otherwise.
List<T?>? popList<T>(int count, List<T?> list, NullValue? nullValue);
+ /// Pops [count] elements from the stack and puts it into [list].
+ /// Returns [null] if a [ParserRecovery] value is found, or [list] otherwise.
+ List<T>? popNonNullableList<T>(int count, List<T> list);
+
void push(Object value);
/// Will return [null] instead of [NullValue].
@@ -583,6 +587,27 @@
return isParserRecovery ? null : list;
}
+ List<T>? popNonNullableList<T>(int count, List<T> list) {
+ assert(arrayLength >= count);
+ final List<Object?> array = this.array;
+ final int length = arrayLength;
+ final int startIndex = length - count;
+ bool isParserRecovery = false;
+ for (int i = 0; i < count; i++) {
+ int arrayIndex = startIndex + i;
+ final Object? value = array[arrayIndex];
+ array[arrayIndex] = null;
+ if (value is ParserRecovery) {
+ isParserRecovery = true;
+ } else {
+ list[i] = value as T;
+ }
+ }
+ arrayLength -= count;
+
+ return isParserRecovery ? null : list;
+ }
+
List<Object?> get values {
final int length = arrayLength;
final List<Object?> list = new List<Object?>.filled(length, null);
@@ -642,6 +667,14 @@
}
@override
+ List<T>? popNonNullableList<T>(int count, List<T> list) {
+ List<T>? result = realStack.popNonNullableList(count, list);
+ latestStacktraces.length = count;
+ stackTraceStack.popList(count, latestStacktraces, /* nullValue = */ null);
+ return result;
+ }
+
+ @override
void push(Object value) {
realStack.push(value);
stackTraceStack.push(StackTrace.current);
@@ -662,12 +695,25 @@
return stack.popList(count, new List<T?>.filled(count, null), nullValue);
}
+ List<T>? popNonNullable(Stack stack, int count, T dummyValue) {
+ if (count == 0) return null;
+ return stack.popNonNullableList(
+ count, new List<T>.filled(count, dummyValue));
+ }
+
List<T?>? popPadded(Stack stack, int count, int padding,
[NullValue? nullValue]) {
if (count + padding == 0) return null;
return stack.popList(
count, new List<T?>.filled(count + padding, null), nullValue);
}
+
+ List<T>? popPaddedNonNullable(
+ Stack stack, int count, int padding, T dummyValue) {
+ if (count + padding == 0) return null;
+ return stack.popNonNullableList(
+ count, new List<T>.filled(count + padding, dummyValue));
+ }
}
/// Helper constant for popping a list of the top of a [Stack]. This helper
@@ -681,6 +727,12 @@
new List<T?>.filled(count, /* fill = */ null, growable: true),
nullValue);
}
+
+ List<T>? popNonNullable(Stack stack, int count, T dummyValue) {
+ if (count == 0) return null;
+ return stack.popNonNullableList(
+ count, new List<T>.filled(count, dummyValue, growable: true));
+ }
}
class ParserRecovery {
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
index 03f9e6a..7c0603b 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
@@ -25,32 +25,34 @@
AnalyzerStatusParams.canParse, AnalyzerStatusParams.fromJson);
AnalyzerStatusParams({required this.isAnalyzing});
- static AnalyzerStatusParams fromJson(Map<String, dynamic> json) {
- final isAnalyzing = json['isAnalyzing'];
+ static AnalyzerStatusParams fromJson(Map<String, Object?> json) {
+ final isAnalyzingJson = json['isAnalyzing'];
+ final isAnalyzing = isAnalyzingJson as bool;
return AnalyzerStatusParams(isAnalyzing: isAnalyzing);
}
final bool isAnalyzing;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['isAnalyzing'] = isAnalyzing;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('isAnalyzing');
try {
if (!obj.containsKey('isAnalyzing')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['isAnalyzing'] == null) {
+ final isAnalyzing = obj['isAnalyzing'];
+ if (isAnalyzing == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['isAnalyzing'] is bool)) {
+ if (!(isAnalyzing is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -89,35 +91,38 @@
LspJsonHandler(ClosingLabel.canParse, ClosingLabel.fromJson);
ClosingLabel({required this.range, required this.label});
- static ClosingLabel fromJson(Map<String, dynamic> json) {
- final range = Range.fromJson(json['range']);
- final label = json['label'];
+ static ClosingLabel fromJson(Map<String, Object?> json) {
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final labelJson = json['label'];
+ final label = labelJson as String;
return ClosingLabel(range: range, label: label);
}
final String label;
final Range range;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['range'] = range.toJson();
__result['label'] = label;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('range');
try {
if (!obj.containsKey('range')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -130,11 +135,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['label'] == null) {
+ final label = obj['label'];
+ if (label == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['label'] is String)) {
+ if (!(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -174,7 +180,7 @@
CompletionItemResolutionInfo.fromJson);
CompletionItemResolutionInfo({required this.file, required this.offset});
- static CompletionItemResolutionInfo fromJson(Map<String, dynamic> json) {
+ static CompletionItemResolutionInfo fromJson(Map<String, Object?> json) {
if (DartCompletionItemResolutionInfo.canParse(json, nullLspJsonReporter)) {
return DartCompletionItemResolutionInfo.fromJson(json);
}
@@ -182,34 +188,37 @@
json, nullLspJsonReporter)) {
return PubPackageCompletionItemResolutionInfo.fromJson(json);
}
- final file = json['file'];
- final offset = json['offset'];
+ final fileJson = json['file'];
+ final file = fileJson as String;
+ final offsetJson = json['offset'];
+ final offset = offsetJson as int;
return CompletionItemResolutionInfo(file: file, offset: offset);
}
final String file;
final int offset;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['file'] = file;
__result['offset'] = offset;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('file');
try {
if (!obj.containsKey('file')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['file'] == null) {
+ final file = obj['file'];
+ if (file == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['file'] is String)) {
+ if (!(file is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -222,11 +231,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['offset'] == null) {
+ final offset = obj['offset'];
+ if (offset == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['offset'] is int)) {
+ if (!(offset is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -275,14 +285,21 @@
required this.rLength,
required this.file,
required this.offset});
- static DartCompletionItemResolutionInfo fromJson(Map<String, dynamic> json) {
- final libId = json['libId'];
- final displayUri = json['displayUri'];
- final rOffset = json['rOffset'];
- final iLength = json['iLength'];
- final rLength = json['rLength'];
- final file = json['file'];
- final offset = json['offset'];
+ static DartCompletionItemResolutionInfo fromJson(Map<String, Object?> json) {
+ final libIdJson = json['libId'];
+ final libId = libIdJson as int;
+ final displayUriJson = json['displayUri'];
+ final displayUri = displayUriJson as String;
+ final rOffsetJson = json['rOffset'];
+ final rOffset = rOffsetJson as int;
+ final iLengthJson = json['iLength'];
+ final iLength = iLengthJson as int;
+ final rLengthJson = json['rLength'];
+ final rLength = rLengthJson as int;
+ final fileJson = json['file'];
+ final file = fileJson as String;
+ final offsetJson = json['offset'];
+ final offset = offsetJson as int;
return DartCompletionItemResolutionInfo(
libId: libId,
displayUri: displayUri,
@@ -301,8 +318,8 @@
final int rLength;
final int rOffset;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['libId'] = libId;
__result['displayUri'] = displayUri;
__result['rOffset'] = rOffset;
@@ -314,18 +331,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('libId');
try {
if (!obj.containsKey('libId')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['libId'] == null) {
+ final libId = obj['libId'];
+ if (libId == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['libId'] is int)) {
+ if (!(libId is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -338,11 +356,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['displayUri'] == null) {
+ final displayUri = obj['displayUri'];
+ if (displayUri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['displayUri'] is String)) {
+ if (!(displayUri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -355,11 +374,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['rOffset'] == null) {
+ final rOffset = obj['rOffset'];
+ if (rOffset == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['rOffset'] is int)) {
+ if (!(rOffset is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -372,11 +392,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['iLength'] == null) {
+ final iLength = obj['iLength'];
+ if (iLength == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['iLength'] is int)) {
+ if (!(iLength is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -389,11 +410,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['rLength'] == null) {
+ final rLength = obj['rLength'];
+ if (rLength == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['rLength'] is int)) {
+ if (!(rLength is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -406,11 +428,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['file'] == null) {
+ final file = obj['file'];
+ if (file == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['file'] is String)) {
+ if (!(file is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -423,11 +446,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['offset'] == null) {
+ final offset = obj['offset'];
+ if (offset == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['offset'] is int)) {
+ if (!(offset is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -479,32 +503,34 @@
DartDiagnosticServer.canParse, DartDiagnosticServer.fromJson);
DartDiagnosticServer({required this.port});
- static DartDiagnosticServer fromJson(Map<String, dynamic> json) {
- final port = json['port'];
+ static DartDiagnosticServer fromJson(Map<String, Object?> json) {
+ final portJson = json['port'];
+ final port = portJson as int;
return DartDiagnosticServer(port: port);
}
final int port;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['port'] = port;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('port');
try {
if (!obj.containsKey('port')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['port'] == null) {
+ final port = obj['port'];
+ if (port == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['port'] is int)) {
+ if (!(port is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -548,13 +574,21 @@
this.parameters,
this.typeParameters,
this.returnType});
- static Element fromJson(Map<String, dynamic> json) {
- final range = json['range'] != null ? Range.fromJson(json['range']) : null;
- final name = json['name'];
- final kind = json['kind'];
- final parameters = json['parameters'];
- final typeParameters = json['typeParameters'];
- final returnType = json['returnType'];
+ static Element fromJson(Map<String, Object?> json) {
+ final rangeJson = json['range'];
+ final range = rangeJson != null
+ ? Range.fromJson(rangeJson as Map<String, Object?>)
+ : null;
+ final nameJson = json['name'];
+ final name = nameJson as String;
+ final kindJson = json['kind'];
+ final kind = kindJson as String;
+ final parametersJson = json['parameters'];
+ final parameters = parametersJson as String?;
+ final typeParametersJson = json['typeParameters'];
+ final typeParameters = typeParametersJson as String?;
+ final returnTypeJson = json['returnType'];
+ final returnType = returnTypeJson as String?;
return Element(
range: range,
name: name,
@@ -571,8 +605,8 @@
final String? returnType;
final String? typeParameters;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (range != null) {
__result['range'] = range?.toJson();
}
@@ -591,10 +625,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('range');
try {
- if (obj['range'] != null && !(Range.canParse(obj['range'], reporter))) {
+ final range = obj['range'];
+ if (range != null && !(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -607,11 +642,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['name'] == null) {
+ final name = obj['name'];
+ if (name == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['name'] is String)) {
+ if (!(name is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -624,11 +660,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['kind'] == null) {
+ final kind = obj['kind'];
+ if (kind == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['kind'] is String)) {
+ if (!(kind is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -637,7 +674,8 @@
}
reporter.push('parameters');
try {
- if (obj['parameters'] != null && !(obj['parameters'] is String)) {
+ final parameters = obj['parameters'];
+ if (parameters != null && !(parameters is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -646,8 +684,8 @@
}
reporter.push('typeParameters');
try {
- if (obj['typeParameters'] != null &&
- !(obj['typeParameters'] is String)) {
+ final typeParameters = obj['typeParameters'];
+ if (typeParameters != null && !(typeParameters is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -656,7 +694,8 @@
}
reporter.push('returnType');
try {
- if (obj['returnType'] != null && !(obj['returnType'] is String)) {
+ final returnType = obj['returnType'];
+ if (returnType != null && !(returnType is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -714,25 +753,32 @@
required this.range,
required this.codeRange,
this.children});
- static FlutterOutline fromJson(Map<String, dynamic> json) {
- final kind = json['kind'];
- final label = json['label'];
- final className = json['className'];
- final variableName = json['variableName'];
- final attributes = json['attributes']
+ static FlutterOutline fromJson(Map<String, Object?> json) {
+ final kindJson = json['kind'];
+ final kind = kindJson as String;
+ final labelJson = json['label'];
+ final label = labelJson as String?;
+ final classNameJson = json['className'];
+ final className = classNameJson as String?;
+ final variableNameJson = json['variableName'];
+ final variableName = variableNameJson as String?;
+ final attributesJson = json['attributes'];
+ final attributes = (attributesJson as List<Object?>?)
?.map((item) =>
- item != null ? FlutterOutlineAttribute.fromJson(item) : null)
- ?.cast<FlutterOutlineAttribute>()
- ?.toList();
- final dartElement = json['dartElement'] != null
- ? Element.fromJson(json['dartElement'])
+ FlutterOutlineAttribute.fromJson(item as Map<String, Object?>))
+ .toList();
+ final dartElementJson = json['dartElement'];
+ final dartElement = dartElementJson != null
+ ? Element.fromJson(dartElementJson as Map<String, Object?>)
: null;
- final range = Range.fromJson(json['range']);
- final codeRange = Range.fromJson(json['codeRange']);
- final children = json['children']
- ?.map((item) => item != null ? FlutterOutline.fromJson(item) : null)
- ?.cast<FlutterOutline>()
- ?.toList();
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final codeRangeJson = json['codeRange'];
+ final codeRange = Range.fromJson(codeRangeJson as Map<String, Object?>);
+ final childrenJson = json['children'];
+ final children = (childrenJson as List<Object?>?)
+ ?.map((item) => FlutterOutline.fromJson(item as Map<String, Object?>))
+ .toList();
return FlutterOutline(
kind: kind,
label: label,
@@ -755,8 +801,8 @@
final Range range;
final String? variableName;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['kind'] = kind;
if (label != null) {
__result['label'] = label;
@@ -783,18 +829,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('kind');
try {
if (!obj.containsKey('kind')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['kind'] == null) {
+ final kind = obj['kind'];
+ if (kind == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['kind'] is String)) {
+ if (!(kind is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -803,7 +850,8 @@
}
reporter.push('label');
try {
- if (obj['label'] != null && !(obj['label'] is String)) {
+ final label = obj['label'];
+ if (label != null && !(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -812,7 +860,8 @@
}
reporter.push('className');
try {
- if (obj['className'] != null && !(obj['className'] is String)) {
+ final className = obj['className'];
+ if (className != null && !(className is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -821,7 +870,8 @@
}
reporter.push('variableName');
try {
- if (obj['variableName'] != null && !(obj['variableName'] is String)) {
+ final variableName = obj['variableName'];
+ if (variableName != null && !(variableName is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -830,9 +880,10 @@
}
reporter.push('attributes');
try {
- if (obj['attributes'] != null &&
- !((obj['attributes'] is List &&
- (obj['attributes'].every((item) =>
+ final attributes = obj['attributes'];
+ if (attributes != null &&
+ !((attributes is List &&
+ (attributes.every((item) =>
FlutterOutlineAttribute.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FlutterOutlineAttribute>');
return false;
@@ -842,8 +893,8 @@
}
reporter.push('dartElement');
try {
- if (obj['dartElement'] != null &&
- !(Element.canParse(obj['dartElement'], reporter))) {
+ final dartElement = obj['dartElement'];
+ if (dartElement != null && !(Element.canParse(dartElement, reporter))) {
reporter.reportError('must be of type Element');
return false;
}
@@ -856,11 +907,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -873,11 +925,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['codeRange'] == null) {
+ final codeRange = obj['codeRange'];
+ if (codeRange == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['codeRange'], reporter))) {
+ if (!(Range.canParse(codeRange, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -886,9 +939,10 @@
}
reporter.push('children');
try {
- if (obj['children'] != null &&
- !((obj['children'] is List &&
- (obj['children'].every(
+ final children = obj['children'];
+ if (children != null &&
+ !((children is List &&
+ (children.every(
(item) => FlutterOutline.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FlutterOutline>');
return false;
@@ -950,11 +1004,15 @@
FlutterOutlineAttribute(
{required this.name, required this.label, this.valueRange});
- static FlutterOutlineAttribute fromJson(Map<String, dynamic> json) {
- final name = json['name'];
- final label = json['label'];
- final valueRange =
- json['valueRange'] != null ? Range.fromJson(json['valueRange']) : null;
+ static FlutterOutlineAttribute fromJson(Map<String, Object?> json) {
+ final nameJson = json['name'];
+ final name = nameJson as String;
+ final labelJson = json['label'];
+ final label = labelJson as String;
+ final valueRangeJson = json['valueRange'];
+ final valueRange = valueRangeJson != null
+ ? Range.fromJson(valueRangeJson as Map<String, Object?>)
+ : null;
return FlutterOutlineAttribute(
name: name, label: label, valueRange: valueRange);
}
@@ -963,8 +1021,8 @@
final String name;
final Range? valueRange;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['name'] = name;
__result['label'] = label;
if (valueRange != null) {
@@ -974,18 +1032,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('name');
try {
if (!obj.containsKey('name')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['name'] == null) {
+ final name = obj['name'];
+ if (name == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['name'] is String)) {
+ if (!(name is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -998,11 +1057,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['label'] == null) {
+ final label = obj['label'];
+ if (label == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['label'] is String)) {
+ if (!(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -1011,8 +1071,8 @@
}
reporter.push('valueRange');
try {
- if (obj['valueRange'] != null &&
- !(Range.canParse(obj['valueRange'], reporter))) {
+ final valueRange = obj['valueRange'];
+ if (valueRange != null && !(Range.canParse(valueRange, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -1059,14 +1119,17 @@
required this.range,
required this.codeRange,
this.children});
- static Outline fromJson(Map<String, dynamic> json) {
- final element = Element.fromJson(json['element']);
- final range = Range.fromJson(json['range']);
- final codeRange = Range.fromJson(json['codeRange']);
- final children = json['children']
- ?.map((item) => item != null ? Outline.fromJson(item) : null)
- ?.cast<Outline>()
- ?.toList();
+ static Outline fromJson(Map<String, Object?> json) {
+ final elementJson = json['element'];
+ final element = Element.fromJson(elementJson as Map<String, Object?>);
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final codeRangeJson = json['codeRange'];
+ final codeRange = Range.fromJson(codeRangeJson as Map<String, Object?>);
+ final childrenJson = json['children'];
+ final children = (childrenJson as List<Object?>?)
+ ?.map((item) => Outline.fromJson(item as Map<String, Object?>))
+ .toList();
return Outline(
element: element,
range: range,
@@ -1079,8 +1142,8 @@
final Element element;
final Range range;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['element'] = element.toJson();
__result['range'] = range.toJson();
__result['codeRange'] = codeRange.toJson();
@@ -1091,18 +1154,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('element');
try {
if (!obj.containsKey('element')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['element'] == null) {
+ final element = obj['element'];
+ if (element == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Element.canParse(obj['element'], reporter))) {
+ if (!(Element.canParse(element, reporter))) {
reporter.reportError('must be of type Element');
return false;
}
@@ -1115,11 +1179,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -1132,11 +1197,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['codeRange'] == null) {
+ final codeRange = obj['codeRange'];
+ if (codeRange == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['codeRange'], reporter))) {
+ if (!(Range.canParse(codeRange, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -1145,9 +1211,10 @@
}
reporter.push('children');
try {
- if (obj['children'] != null &&
- !((obj['children'] is List &&
- (obj['children']
+ final children = obj['children'];
+ if (children != null &&
+ !((children is List &&
+ (children
.every((item) => Outline.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Outline>');
return false;
@@ -1198,10 +1265,13 @@
PubPackageCompletionItemResolutionInfo(
{required this.packageName, required this.file, required this.offset});
static PubPackageCompletionItemResolutionInfo fromJson(
- Map<String, dynamic> json) {
- final packageName = json['packageName'];
- final file = json['file'];
- final offset = json['offset'];
+ Map<String, Object?> json) {
+ final packageNameJson = json['packageName'];
+ final packageName = packageNameJson as String;
+ final fileJson = json['file'];
+ final file = fileJson as String;
+ final offsetJson = json['offset'];
+ final offset = offsetJson as int;
return PubPackageCompletionItemResolutionInfo(
packageName: packageName, file: file, offset: offset);
}
@@ -1210,8 +1280,8 @@
final int offset;
final String packageName;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['packageName'] = packageName;
__result['file'] = file;
__result['offset'] = offset;
@@ -1219,18 +1289,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('packageName');
try {
if (!obj.containsKey('packageName')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['packageName'] == null) {
+ final packageName = obj['packageName'];
+ if (packageName == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['packageName'] is String)) {
+ if (!(packageName is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -1243,11 +1314,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['file'] == null) {
+ final file = obj['file'];
+ if (file == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['file'] is String)) {
+ if (!(file is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -1260,11 +1332,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['offset'] == null) {
+ final offset = obj['offset'];
+ if (offset == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['offset'] is int)) {
+ if (!(offset is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -1309,38 +1382,40 @@
PublishClosingLabelsParams.canParse, PublishClosingLabelsParams.fromJson);
PublishClosingLabelsParams({required this.uri, required this.labels});
- static PublishClosingLabelsParams fromJson(Map<String, dynamic> json) {
- final uri = json['uri'];
- final labels = json['labels']
- ?.map((item) => ClosingLabel.fromJson(item))
- ?.cast<ClosingLabel>()
- ?.toList();
+ static PublishClosingLabelsParams fromJson(Map<String, Object?> json) {
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
+ final labelsJson = json['labels'];
+ final labels = (labelsJson as List<Object?>)
+ .map((item) => ClosingLabel.fromJson(item as Map<String, Object?>))
+ .toList();
return PublishClosingLabelsParams(uri: uri, labels: labels);
}
final List<ClosingLabel> labels;
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['uri'] = uri;
__result['labels'] = labels.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('uri');
try {
if (!obj.containsKey('uri')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -1353,13 +1428,13 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['labels'] == null) {
+ final labels = obj['labels'];
+ if (labels == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['labels'] is List &&
- (obj['labels']
- .every((item) => ClosingLabel.canParse(item, reporter)))))) {
+ if (!((labels is List &&
+ (labels.every((item) => ClosingLabel.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<ClosingLabel>');
return false;
}
@@ -1403,35 +1478,39 @@
PublishFlutterOutlineParams.fromJson);
PublishFlutterOutlineParams({required this.uri, required this.outline});
- static PublishFlutterOutlineParams fromJson(Map<String, dynamic> json) {
- final uri = json['uri'];
- final outline = FlutterOutline.fromJson(json['outline']);
+ static PublishFlutterOutlineParams fromJson(Map<String, Object?> json) {
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
+ final outlineJson = json['outline'];
+ final outline =
+ FlutterOutline.fromJson(outlineJson as Map<String, Object?>);
return PublishFlutterOutlineParams(uri: uri, outline: outline);
}
final FlutterOutline outline;
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['uri'] = uri;
__result['outline'] = outline.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('uri');
try {
if (!obj.containsKey('uri')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -1444,11 +1523,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['outline'] == null) {
+ final outline = obj['outline'];
+ if (outline == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(FlutterOutline.canParse(obj['outline'], reporter))) {
+ if (!(FlutterOutline.canParse(outline, reporter))) {
reporter.reportError('must be of type FlutterOutline');
return false;
}
@@ -1488,35 +1568,38 @@
PublishOutlineParams.canParse, PublishOutlineParams.fromJson);
PublishOutlineParams({required this.uri, required this.outline});
- static PublishOutlineParams fromJson(Map<String, dynamic> json) {
- final uri = json['uri'];
- final outline = Outline.fromJson(json['outline']);
+ static PublishOutlineParams fromJson(Map<String, Object?> json) {
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
+ final outlineJson = json['outline'];
+ final outline = Outline.fromJson(outlineJson as Map<String, Object?>);
return PublishOutlineParams(uri: uri, outline: outline);
}
final Outline outline;
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['uri'] = uri;
__result['outline'] = outline.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('uri');
try {
if (!obj.containsKey('uri')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -1529,11 +1612,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['outline'] == null) {
+ final outline = obj['outline'];
+ if (outline == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Outline.canParse(obj['outline'], reporter))) {
+ if (!(Outline.canParse(outline, reporter))) {
reporter.reportError('must be of type Outline');
return false;
}
@@ -1576,11 +1660,14 @@
{required this.insertTextFormat,
required this.range,
required this.newText});
- static SnippetTextEdit fromJson(Map<String, dynamic> json) {
+ static SnippetTextEdit fromJson(Map<String, Object?> json) {
+ final insertTextFormatJson = json['insertTextFormat'];
final insertTextFormat =
- InsertTextFormat.fromJson(json['insertTextFormat']);
- final range = Range.fromJson(json['range']);
- final newText = json['newText'];
+ InsertTextFormat.fromJson(insertTextFormatJson as int);
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final newTextJson = json['newText'];
+ final newText = newTextJson as String;
return SnippetTextEdit(
insertTextFormat: insertTextFormat, range: range, newText: newText);
}
@@ -1594,8 +1681,8 @@
/// document create a range where start === end.
final Range range;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['insertTextFormat'] = insertTextFormat.toJson();
__result['range'] = range.toJson();
__result['newText'] = newText;
@@ -1603,18 +1690,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('insertTextFormat');
try {
if (!obj.containsKey('insertTextFormat')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['insertTextFormat'] == null) {
+ final insertTextFormat = obj['insertTextFormat'];
+ if (insertTextFormat == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(InsertTextFormat.canParse(obj['insertTextFormat'], reporter))) {
+ if (!(InsertTextFormat.canParse(insertTextFormat, reporter))) {
reporter.reportError('must be of type InsertTextFormat');
return false;
}
@@ -1627,11 +1715,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -1644,11 +1733,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['newText'] == null) {
+ final newText = obj['newText'];
+ if (newText == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['newText'] is String)) {
+ if (!(newText is String)) {
reporter.reportError('must be of type String');
return false;
}
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
index 99fa136..f40ac85 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
@@ -28,10 +28,13 @@
AnnotatedTextEdit(
{required this.annotationId, required this.range, required this.newText});
- static AnnotatedTextEdit fromJson(Map<String, dynamic> json) {
- final annotationId = json['annotationId'];
- final range = Range.fromJson(json['range']);
- final newText = json['newText'];
+ static AnnotatedTextEdit fromJson(Map<String, Object?> json) {
+ final annotationIdJson = json['annotationId'];
+ final annotationId = annotationIdJson as String;
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final newTextJson = json['newText'];
+ final newText = newTextJson as String;
return AnnotatedTextEdit(
annotationId: annotationId, range: range, newText: newText);
}
@@ -46,8 +49,8 @@
/// document create a range where start === end.
final Range range;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['annotationId'] = annotationId;
__result['range'] = range.toJson();
__result['newText'] = newText;
@@ -55,18 +58,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('annotationId');
try {
if (!obj.containsKey('annotationId')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['annotationId'] == null) {
+ final annotationId = obj['annotationId'];
+ if (annotationId == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['annotationId'] is String)) {
+ if (!(annotationId is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -79,11 +83,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -96,11 +101,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['newText'] == null) {
+ final newText = obj['newText'];
+ if (newText == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['newText'] is String)) {
+ if (!(newText is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -143,9 +149,11 @@
ApplyWorkspaceEditParams.canParse, ApplyWorkspaceEditParams.fromJson);
ApplyWorkspaceEditParams({this.label, required this.edit});
- static ApplyWorkspaceEditParams fromJson(Map<String, dynamic> json) {
- final label = json['label'];
- final edit = WorkspaceEdit.fromJson(json['edit']);
+ static ApplyWorkspaceEditParams fromJson(Map<String, Object?> json) {
+ final labelJson = json['label'];
+ final label = labelJson as String?;
+ final editJson = json['edit'];
+ final edit = WorkspaceEdit.fromJson(editJson as Map<String, Object?>);
return ApplyWorkspaceEditParams(label: label, edit: edit);
}
@@ -156,8 +164,8 @@
/// user interface for example on an undo stack to undo the workspace edit.
final String? label;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (label != null) {
__result['label'] = label;
}
@@ -166,10 +174,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('label');
try {
- if (obj['label'] != null && !(obj['label'] is String)) {
+ final label = obj['label'];
+ if (label != null && !(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -182,11 +191,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['edit'] == null) {
+ final edit = obj['edit'];
+ if (edit == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(WorkspaceEdit.canParse(obj['edit'], reporter))) {
+ if (!(WorkspaceEdit.canParse(edit, reporter))) {
reporter.reportError('must be of type WorkspaceEdit');
return false;
}
@@ -227,10 +237,13 @@
ApplyWorkspaceEditResponse(
{required this.applied, this.failureReason, this.failedChange});
- static ApplyWorkspaceEditResponse fromJson(Map<String, dynamic> json) {
- final applied = json['applied'];
- final failureReason = json['failureReason'];
- final failedChange = json['failedChange'];
+ static ApplyWorkspaceEditResponse fromJson(Map<String, Object?> json) {
+ final appliedJson = json['applied'];
+ final applied = appliedJson as bool;
+ final failureReasonJson = json['failureReason'];
+ final failureReason = failureReasonJson as String?;
+ final failedChangeJson = json['failedChange'];
+ final failedChange = failedChangeJson as int?;
return ApplyWorkspaceEditResponse(
applied: applied,
failureReason: failureReason,
@@ -251,8 +264,8 @@
/// error for a request that triggered the edit.
final String? failureReason;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['applied'] = applied;
if (failureReason != null) {
__result['failureReason'] = failureReason;
@@ -264,18 +277,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('applied');
try {
if (!obj.containsKey('applied')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['applied'] == null) {
+ final applied = obj['applied'];
+ if (applied == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['applied'] is bool)) {
+ if (!(applied is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -284,7 +298,8 @@
}
reporter.push('failureReason');
try {
- if (obj['failureReason'] != null && !(obj['failureReason'] is String)) {
+ final failureReason = obj['failureReason'];
+ if (failureReason != null && !(failureReason is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -293,7 +308,8 @@
}
reporter.push('failedChange');
try {
- if (obj['failedChange'] != null && !(obj['failedChange'] is int)) {
+ final failedChange = obj['failedChange'];
+ if (failedChange != null && !(failedChange is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -338,8 +354,9 @@
CallHierarchyClientCapabilities.fromJson);
CallHierarchyClientCapabilities({this.dynamicRegistration});
- static CallHierarchyClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ static CallHierarchyClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return CallHierarchyClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -350,8 +367,8 @@
/// capability as well.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -359,11 +376,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -402,12 +419,13 @@
CallHierarchyIncomingCall.canParse, CallHierarchyIncomingCall.fromJson);
CallHierarchyIncomingCall({required this.from, required this.fromRanges});
- static CallHierarchyIncomingCall fromJson(Map<String, dynamic> json) {
- final from = CallHierarchyItem.fromJson(json['from']);
- final fromRanges = json['fromRanges']
- ?.map((item) => Range.fromJson(item))
- ?.cast<Range>()
- ?.toList();
+ static CallHierarchyIncomingCall fromJson(Map<String, Object?> json) {
+ final fromJson = json['from'];
+ final from = CallHierarchyItem.fromJson(fromJson as Map<String, Object?>);
+ final fromRangesJson = json['fromRanges'];
+ final fromRanges = (fromRangesJson as List<Object?>)
+ .map((item) => Range.fromJson(item as Map<String, Object?>))
+ .toList();
return CallHierarchyIncomingCall(from: from, fromRanges: fromRanges);
}
@@ -418,26 +436,27 @@
/// denoted by [`this.from`](#CallHierarchyIncomingCall.from).
final List<Range> fromRanges;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['from'] = from.toJson();
__result['fromRanges'] = fromRanges.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('from');
try {
if (!obj.containsKey('from')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['from'] == null) {
+ final from = obj['from'];
+ if (from == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(CallHierarchyItem.canParse(obj['from'], reporter))) {
+ if (!(CallHierarchyItem.canParse(from, reporter))) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
@@ -450,13 +469,13 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['fromRanges'] == null) {
+ final fromRanges = obj['fromRanges'];
+ if (fromRanges == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['fromRanges'] is List &&
- (obj['fromRanges']
- .every((item) => Range.canParse(item, reporter)))))) {
+ if (!((fromRanges is List &&
+ (fromRanges.every((item) => Range.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Range>');
return false;
}
@@ -502,22 +521,25 @@
CallHierarchyIncomingCallsParams(
{required this.item, this.workDoneToken, this.partialResultToken});
- static CallHierarchyIncomingCallsParams fromJson(Map<String, dynamic> json) {
- final item = CallHierarchyItem.fromJson(json['item']);
- final workDoneToken = json['workDoneToken'] == null
+ static CallHierarchyIncomingCallsParams fromJson(Map<String, Object?> json) {
+ final itemJson = json['item'];
+ final item = CallHierarchyItem.fromJson(itemJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return CallHierarchyIncomingCallsParams(
item: item,
workDoneToken: workDoneToken,
@@ -533,8 +555,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['item'] = item.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
@@ -546,18 +568,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('item');
try {
if (!obj.containsKey('item')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['item'] == null) {
+ final item = obj['item'];
+ if (item == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(CallHierarchyItem.canParse(obj['item'], reporter))) {
+ if (!(CallHierarchyItem.canParse(item, reporter))) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
@@ -566,9 +589,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -577,9 +600,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -631,18 +654,26 @@
required this.range,
required this.selectionRange,
this.data});
- static CallHierarchyItem fromJson(Map<String, dynamic> json) {
- final name = json['name'];
- final kind = SymbolKind.fromJson(json['kind']);
- final tags = json['tags']
- ?.map((item) => item != null ? SymbolTag.fromJson(item) : null)
- ?.cast<SymbolTag>()
- ?.toList();
- final detail = json['detail'];
- final uri = json['uri'];
- final range = Range.fromJson(json['range']);
- final selectionRange = Range.fromJson(json['selectionRange']);
- final data = json['data'];
+ static CallHierarchyItem fromJson(Map<String, Object?> json) {
+ final nameJson = json['name'];
+ final name = nameJson as String;
+ final kindJson = json['kind'];
+ final kind = SymbolKind.fromJson(kindJson as int);
+ final tagsJson = json['tags'];
+ final tags = (tagsJson as List<Object?>?)
+ ?.map((item) => SymbolTag.fromJson(item as num))
+ .toList();
+ final detailJson = json['detail'];
+ final detail = detailJson as String?;
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final selectionRangeJson = json['selectionRange'];
+ final selectionRange =
+ Range.fromJson(selectionRangeJson as Map<String, Object?>);
+ final dataJson = json['data'];
+ final data = dataJson;
return CallHierarchyItem(
name: name,
kind: kind,
@@ -656,7 +687,7 @@
/// A data entry field that is preserved between a call hierarchy prepare and
/// incoming calls or outgoing calls requests.
- final dynamic data;
+ final Object? data;
/// More detail for this item, e.g. the signature of a function.
final String? detail;
@@ -682,8 +713,8 @@
/// The resource identifier of this item.
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['name'] = name;
__result['kind'] = kind.toJson();
if (tags != null) {
@@ -702,18 +733,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('name');
try {
if (!obj.containsKey('name')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['name'] == null) {
+ final name = obj['name'];
+ if (name == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['name'] is String)) {
+ if (!(name is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -726,11 +758,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['kind'] == null) {
+ final kind = obj['kind'];
+ if (kind == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(SymbolKind.canParse(obj['kind'], reporter))) {
+ if (!(SymbolKind.canParse(kind, reporter))) {
reporter.reportError('must be of type SymbolKind');
return false;
}
@@ -739,10 +772,10 @@
}
reporter.push('tags');
try {
- if (obj['tags'] != null &&
- !((obj['tags'] is List &&
- (obj['tags']
- .every((item) => SymbolTag.canParse(item, reporter)))))) {
+ final tags = obj['tags'];
+ if (tags != null &&
+ !((tags is List &&
+ (tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -751,7 +784,8 @@
}
reporter.push('detail');
try {
- if (obj['detail'] != null && !(obj['detail'] is String)) {
+ final detail = obj['detail'];
+ if (detail != null && !(detail is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -764,11 +798,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -781,11 +816,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -798,11 +834,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['selectionRange'] == null) {
+ final selectionRange = obj['selectionRange'];
+ if (selectionRange == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['selectionRange'], reporter))) {
+ if (!(Range.canParse(selectionRange, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -855,18 +892,19 @@
CallHierarchyOptions.canParse, CallHierarchyOptions.fromJson);
CallHierarchyOptions({this.workDoneProgress});
- static CallHierarchyOptions fromJson(Map<String, dynamic> json) {
+ static CallHierarchyOptions fromJson(Map<String, Object?> json) {
if (CallHierarchyRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return CallHierarchyRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return CallHierarchyOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -874,11 +912,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -917,12 +955,13 @@
CallHierarchyOutgoingCall.canParse, CallHierarchyOutgoingCall.fromJson);
CallHierarchyOutgoingCall({required this.to, required this.fromRanges});
- static CallHierarchyOutgoingCall fromJson(Map<String, dynamic> json) {
- final to = CallHierarchyItem.fromJson(json['to']);
- final fromRanges = json['fromRanges']
- ?.map((item) => Range.fromJson(item))
- ?.cast<Range>()
- ?.toList();
+ static CallHierarchyOutgoingCall fromJson(Map<String, Object?> json) {
+ final toJson = json['to'];
+ final to = CallHierarchyItem.fromJson(toJson as Map<String, Object?>);
+ final fromRangesJson = json['fromRanges'];
+ final fromRanges = (fromRangesJson as List<Object?>)
+ .map((item) => Range.fromJson(item as Map<String, Object?>))
+ .toList();
return CallHierarchyOutgoingCall(to: to, fromRanges: fromRanges);
}
@@ -933,26 +972,27 @@
/// The item that is called.
final CallHierarchyItem to;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['to'] = to.toJson();
__result['fromRanges'] = fromRanges.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('to');
try {
if (!obj.containsKey('to')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['to'] == null) {
+ final to = obj['to'];
+ if (to == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(CallHierarchyItem.canParse(obj['to'], reporter))) {
+ if (!(CallHierarchyItem.canParse(to, reporter))) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
@@ -965,13 +1005,13 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['fromRanges'] == null) {
+ final fromRanges = obj['fromRanges'];
+ if (fromRanges == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['fromRanges'] is List &&
- (obj['fromRanges']
- .every((item) => Range.canParse(item, reporter)))))) {
+ if (!((fromRanges is List &&
+ (fromRanges.every((item) => Range.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Range>');
return false;
}
@@ -1017,22 +1057,25 @@
CallHierarchyOutgoingCallsParams(
{required this.item, this.workDoneToken, this.partialResultToken});
- static CallHierarchyOutgoingCallsParams fromJson(Map<String, dynamic> json) {
- final item = CallHierarchyItem.fromJson(json['item']);
- final workDoneToken = json['workDoneToken'] == null
+ static CallHierarchyOutgoingCallsParams fromJson(Map<String, Object?> json) {
+ final itemJson = json['item'];
+ final item = CallHierarchyItem.fromJson(itemJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return CallHierarchyOutgoingCallsParams(
item: item,
workDoneToken: workDoneToken,
@@ -1048,8 +1091,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['item'] = item.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
@@ -1061,18 +1104,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('item');
try {
if (!obj.containsKey('item')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['item'] == null) {
+ final item = obj['item'];
+ if (item == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(CallHierarchyItem.canParse(obj['item'], reporter))) {
+ if (!(CallHierarchyItem.canParse(item, reporter))) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
@@ -1081,9 +1125,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -1092,9 +1136,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -1140,16 +1184,20 @@
CallHierarchyPrepareParams(
{required this.textDocument, required this.position, this.workDoneToken});
- static CallHierarchyPrepareParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
- final workDoneToken = json['workDoneToken'] == null
+ static CallHierarchyPrepareParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
return CallHierarchyPrepareParams(
textDocument: textDocument,
position: position,
@@ -1165,8 +1213,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
if (workDoneToken != null) {
@@ -1176,18 +1224,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -1200,11 +1249,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -1213,9 +1263,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -1266,13 +1316,15 @@
CallHierarchyRegistrationOptions(
{this.documentSelector, this.workDoneProgress, this.id});
- static CallHierarchyRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
- final id = json['id'];
+ static CallHierarchyRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
+ final idJson = json['id'];
+ final id = idJson as String?;
return CallHierarchyRegistrationOptions(
documentSelector: documentSelector,
workDoneProgress: workDoneProgress,
@@ -1288,8 +1340,8 @@
final String? id;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -1301,16 +1353,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -1320,8 +1373,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1330,7 +1383,8 @@
}
reporter.push('id');
try {
- if (obj['id'] != null && !(obj['id'] is String)) {
+ final id = obj['id'];
+ if (id != null && !(id is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -1375,37 +1429,39 @@
LspJsonHandler(CancelParams.canParse, CancelParams.fromJson);
CancelParams({required this.id});
- static CancelParams fromJson(Map<String, dynamic> json) {
- final id = json['id'] is int
- ? Either2<int, String>.t1(json['id'])
- : (json['id'] is String
- ? Either2<int, String>.t2(json['id'])
- : (throw '''${json['id']} was not one of (int, String)'''));
+ static CancelParams fromJson(Map<String, Object?> json) {
+ final idJson = json['id'];
+ final id = idJson is int
+ ? Either2<int, String>.t1(idJson)
+ : (idJson is String
+ ? Either2<int, String>.t2(idJson)
+ : (throw '''$idJson was not one of (int, String)'''));
return CancelParams(id: id);
}
/// The request id to cancel.
final Either2<int, String> id;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['id'] = id;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('id');
try {
if (!obj.containsKey('id')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['id'] == null) {
+ final id = obj['id'];
+ if (id == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['id'] is int || obj['id'] is String))) {
+ if (!((id is int || id is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -1446,10 +1502,13 @@
ChangeAnnotation(
{required this.label, this.needsConfirmation, this.description});
- static ChangeAnnotation fromJson(Map<String, dynamic> json) {
- final label = json['label'];
- final needsConfirmation = json['needsConfirmation'];
- final description = json['description'];
+ static ChangeAnnotation fromJson(Map<String, Object?> json) {
+ final labelJson = json['label'];
+ final label = labelJson as String;
+ final needsConfirmationJson = json['needsConfirmation'];
+ final needsConfirmation = needsConfirmationJson as bool?;
+ final descriptionJson = json['description'];
+ final description = descriptionJson as String?;
return ChangeAnnotation(
label: label,
needsConfirmation: needsConfirmation,
@@ -1468,8 +1527,8 @@
/// the change.
final bool? needsConfirmation;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['label'] = label;
if (needsConfirmation != null) {
__result['needsConfirmation'] = needsConfirmation;
@@ -1481,18 +1540,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('label');
try {
if (!obj.containsKey('label')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['label'] == null) {
+ final label = obj['label'];
+ if (label == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['label'] is String)) {
+ if (!(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -1501,8 +1561,8 @@
}
reporter.push('needsConfirmation');
try {
- if (obj['needsConfirmation'] != null &&
- !(obj['needsConfirmation'] is bool)) {
+ final needsConfirmation = obj['needsConfirmation'];
+ if (needsConfirmation != null && !(needsConfirmation is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1511,7 +1571,8 @@
}
reporter.push('description');
try {
- if (obj['description'] != null && !(obj['description'] is String)) {
+ final description = obj['description'];
+ if (description != null && !(description is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -1559,20 +1620,28 @@
this.window,
this.general,
this.experimental});
- static ClientCapabilities fromJson(Map<String, dynamic> json) {
- final workspace = json['workspace'] != null
- ? ClientCapabilitiesWorkspace.fromJson(json['workspace'])
+ static ClientCapabilities fromJson(Map<String, Object?> json) {
+ final workspaceJson = json['workspace'];
+ final workspace = workspaceJson != null
+ ? ClientCapabilitiesWorkspace.fromJson(
+ workspaceJson as Map<String, Object?>)
: null;
- final textDocument = json['textDocument'] != null
- ? TextDocumentClientCapabilities.fromJson(json['textDocument'])
+ final textDocumentJson = json['textDocument'];
+ final textDocument = textDocumentJson != null
+ ? TextDocumentClientCapabilities.fromJson(
+ textDocumentJson as Map<String, Object?>)
: null;
- final window = json['window'] != null
- ? ClientCapabilitiesWindow.fromJson(json['window'])
+ final windowJson = json['window'];
+ final window = windowJson != null
+ ? ClientCapabilitiesWindow.fromJson(windowJson as Map<String, Object?>)
: null;
- final general = json['general'] != null
- ? ClientCapabilitiesGeneral.fromJson(json['general'])
+ final generalJson = json['general'];
+ final general = generalJson != null
+ ? ClientCapabilitiesGeneral.fromJson(
+ generalJson as Map<String, Object?>)
: null;
- final experimental = json['experimental'];
+ final experimentalJson = json['experimental'];
+ final experimental = experimentalJson;
return ClientCapabilities(
workspace: workspace,
textDocument: textDocument,
@@ -1582,7 +1651,7 @@
}
/// Experimental client capabilities.
- final dynamic experimental;
+ final Object? experimental;
/// General client capabilities.
/// @since 3.16.0
@@ -1597,8 +1666,8 @@
/// Workspace specific client capabilities.
final ClientCapabilitiesWorkspace? workspace;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workspace != null) {
__result['workspace'] = workspace?.toJson();
}
@@ -1618,12 +1687,12 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workspace');
try {
- if (obj['workspace'] != null &&
- !(ClientCapabilitiesWorkspace.canParse(
- obj['workspace'], reporter))) {
+ final workspace = obj['workspace'];
+ if (workspace != null &&
+ !(ClientCapabilitiesWorkspace.canParse(workspace, reporter))) {
reporter.reportError('must be of type ClientCapabilitiesWorkspace');
return false;
}
@@ -1632,9 +1701,10 @@
}
reporter.push('textDocument');
try {
- if (obj['textDocument'] != null &&
+ final textDocument = obj['textDocument'];
+ if (textDocument != null &&
!(TextDocumentClientCapabilities.canParse(
- obj['textDocument'], reporter))) {
+ textDocument, reporter))) {
reporter
.reportError('must be of type TextDocumentClientCapabilities');
return false;
@@ -1644,8 +1714,9 @@
}
reporter.push('window');
try {
- if (obj['window'] != null &&
- !(ClientCapabilitiesWindow.canParse(obj['window'], reporter))) {
+ final window = obj['window'];
+ if (window != null &&
+ !(ClientCapabilitiesWindow.canParse(window, reporter))) {
reporter.reportError('must be of type ClientCapabilitiesWindow');
return false;
}
@@ -1654,8 +1725,9 @@
}
reporter.push('general');
try {
- if (obj['general'] != null &&
- !(ClientCapabilitiesGeneral.canParse(obj['general'], reporter))) {
+ final general = obj['general'];
+ if (general != null &&
+ !(ClientCapabilitiesGeneral.canParse(general, reporter))) {
reporter.reportError('must be of type ClientCapabilitiesGeneral');
return false;
}
@@ -1711,14 +1783,21 @@
this.willRename,
this.didDelete,
this.willDelete});
- static ClientCapabilitiesFileOperations fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final didCreate = json['didCreate'];
- final willCreate = json['willCreate'];
- final didRename = json['didRename'];
- final willRename = json['willRename'];
- final didDelete = json['didDelete'];
- final willDelete = json['willDelete'];
+ static ClientCapabilitiesFileOperations fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final didCreateJson = json['didCreate'];
+ final didCreate = didCreateJson as bool?;
+ final willCreateJson = json['willCreate'];
+ final willCreate = willCreateJson as bool?;
+ final didRenameJson = json['didRename'];
+ final didRename = didRenameJson as bool?;
+ final willRenameJson = json['willRename'];
+ final willRename = willRenameJson as bool?;
+ final didDeleteJson = json['didDelete'];
+ final didDelete = didDeleteJson as bool?;
+ final willDeleteJson = json['willDelete'];
+ final willDelete = willDeleteJson as bool?;
return ClientCapabilitiesFileOperations(
dynamicRegistration: dynamicRegistration,
didCreate: didCreate,
@@ -1751,8 +1830,8 @@
/// The client has support for sending willRenameFiles requests.
final bool? willRename;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -1778,11 +1857,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1791,7 +1870,8 @@
}
reporter.push('didCreate');
try {
- if (obj['didCreate'] != null && !(obj['didCreate'] is bool)) {
+ final didCreate = obj['didCreate'];
+ if (didCreate != null && !(didCreate is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1800,7 +1880,8 @@
}
reporter.push('willCreate');
try {
- if (obj['willCreate'] != null && !(obj['willCreate'] is bool)) {
+ final willCreate = obj['willCreate'];
+ if (willCreate != null && !(willCreate is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1809,7 +1890,8 @@
}
reporter.push('didRename');
try {
- if (obj['didRename'] != null && !(obj['didRename'] is bool)) {
+ final didRename = obj['didRename'];
+ if (didRename != null && !(didRename is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1818,7 +1900,8 @@
}
reporter.push('willRename');
try {
- if (obj['willRename'] != null && !(obj['willRename'] is bool)) {
+ final willRename = obj['willRename'];
+ if (willRename != null && !(willRename is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1827,7 +1910,8 @@
}
reporter.push('didDelete');
try {
- if (obj['didDelete'] != null && !(obj['didDelete'] is bool)) {
+ final didDelete = obj['didDelete'];
+ if (didDelete != null && !(didDelete is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1836,7 +1920,8 @@
}
reporter.push('willDelete');
try {
- if (obj['willDelete'] != null && !(obj['willDelete'] is bool)) {
+ final willDelete = obj['willDelete'];
+ if (willDelete != null && !(willDelete is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1888,13 +1973,16 @@
ClientCapabilitiesGeneral.canParse, ClientCapabilitiesGeneral.fromJson);
ClientCapabilitiesGeneral({this.regularExpressions, this.markdown});
- static ClientCapabilitiesGeneral fromJson(Map<String, dynamic> json) {
- final regularExpressions = json['regularExpressions'] != null
+ static ClientCapabilitiesGeneral fromJson(Map<String, Object?> json) {
+ final regularExpressionsJson = json['regularExpressions'];
+ final regularExpressions = regularExpressionsJson != null
? RegularExpressionsClientCapabilities.fromJson(
- json['regularExpressions'])
+ regularExpressionsJson as Map<String, Object?>)
: null;
- final markdown = json['markdown'] != null
- ? MarkdownClientCapabilities.fromJson(json['markdown'])
+ final markdownJson = json['markdown'];
+ final markdown = markdownJson != null
+ ? MarkdownClientCapabilities.fromJson(
+ markdownJson as Map<String, Object?>)
: null;
return ClientCapabilitiesGeneral(
regularExpressions: regularExpressions, markdown: markdown);
@@ -1908,8 +1996,8 @@
/// @since 3.16.0
final RegularExpressionsClientCapabilities? regularExpressions;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (regularExpressions != null) {
__result['regularExpressions'] = regularExpressions?.toJson();
}
@@ -1920,12 +2008,13 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('regularExpressions');
try {
- if (obj['regularExpressions'] != null &&
+ final regularExpressions = obj['regularExpressions'];
+ if (regularExpressions != null &&
!(RegularExpressionsClientCapabilities.canParse(
- obj['regularExpressions'], reporter))) {
+ regularExpressions, reporter))) {
reporter.reportError(
'must be of type RegularExpressionsClientCapabilities');
return false;
@@ -1935,8 +2024,9 @@
}
reporter.push('markdown');
try {
- if (obj['markdown'] != null &&
- !(MarkdownClientCapabilities.canParse(obj['markdown'], reporter))) {
+ final markdown = obj['markdown'];
+ if (markdown != null &&
+ !(MarkdownClientCapabilities.canParse(markdown, reporter))) {
reporter.reportError('must be of type MarkdownClientCapabilities');
return false;
}
@@ -1979,13 +2069,18 @@
ClientCapabilitiesWindow(
{this.workDoneProgress, this.showMessage, this.showDocument});
- static ClientCapabilitiesWindow fromJson(Map<String, dynamic> json) {
- final workDoneProgress = json['workDoneProgress'];
- final showMessage = json['showMessage'] != null
- ? ShowMessageRequestClientCapabilities.fromJson(json['showMessage'])
+ static ClientCapabilitiesWindow fromJson(Map<String, Object?> json) {
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
+ final showMessageJson = json['showMessage'];
+ final showMessage = showMessageJson != null
+ ? ShowMessageRequestClientCapabilities.fromJson(
+ showMessageJson as Map<String, Object?>)
: null;
- final showDocument = json['showDocument'] != null
- ? ShowDocumentClientCapabilities.fromJson(json['showDocument'])
+ final showDocumentJson = json['showDocument'];
+ final showDocument = showDocumentJson != null
+ ? ShowDocumentClientCapabilities.fromJson(
+ showDocumentJson as Map<String, Object?>)
: null;
return ClientCapabilitiesWindow(
workDoneProgress: workDoneProgress,
@@ -2007,8 +2102,8 @@
/// @since 3.15.0
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -2022,11 +2117,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2035,9 +2130,10 @@
}
reporter.push('showMessage');
try {
- if (obj['showMessage'] != null &&
+ final showMessage = obj['showMessage'];
+ if (showMessage != null &&
!(ShowMessageRequestClientCapabilities.canParse(
- obj['showMessage'], reporter))) {
+ showMessage, reporter))) {
reporter.reportError(
'must be of type ShowMessageRequestClientCapabilities');
return false;
@@ -2047,9 +2143,10 @@
}
reporter.push('showDocument');
try {
- if (obj['showDocument'] != null &&
+ final showDocument = obj['showDocument'];
+ if (showDocument != null &&
!(ShowDocumentClientCapabilities.canParse(
- obj['showDocument'], reporter))) {
+ showDocument, reporter))) {
reporter
.reportError('must be of type ShowDocumentClientCapabilities');
return false;
@@ -2106,36 +2203,52 @@
this.semanticTokens,
this.codeLens,
this.fileOperations});
- static ClientCapabilitiesWorkspace fromJson(Map<String, dynamic> json) {
- final applyEdit = json['applyEdit'];
- final workspaceEdit = json['workspaceEdit'] != null
- ? WorkspaceEditClientCapabilities.fromJson(json['workspaceEdit'])
+ static ClientCapabilitiesWorkspace fromJson(Map<String, Object?> json) {
+ final applyEditJson = json['applyEdit'];
+ final applyEdit = applyEditJson as bool?;
+ final workspaceEditJson = json['workspaceEdit'];
+ final workspaceEdit = workspaceEditJson != null
+ ? WorkspaceEditClientCapabilities.fromJson(
+ workspaceEditJson as Map<String, Object?>)
: null;
- final didChangeConfiguration = json['didChangeConfiguration'] != null
+ final didChangeConfigurationJson = json['didChangeConfiguration'];
+ final didChangeConfiguration = didChangeConfigurationJson != null
? DidChangeConfigurationClientCapabilities.fromJson(
- json['didChangeConfiguration'])
+ didChangeConfigurationJson as Map<String, Object?>)
: null;
- final didChangeWatchedFiles = json['didChangeWatchedFiles'] != null
+ final didChangeWatchedFilesJson = json['didChangeWatchedFiles'];
+ final didChangeWatchedFiles = didChangeWatchedFilesJson != null
? DidChangeWatchedFilesClientCapabilities.fromJson(
- json['didChangeWatchedFiles'])
+ didChangeWatchedFilesJson as Map<String, Object?>)
: null;
- final symbol = json['symbol'] != null
- ? WorkspaceSymbolClientCapabilities.fromJson(json['symbol'])
+ final symbolJson = json['symbol'];
+ final symbol = symbolJson != null
+ ? WorkspaceSymbolClientCapabilities.fromJson(
+ symbolJson as Map<String, Object?>)
: null;
- final executeCommand = json['executeCommand'] != null
- ? ExecuteCommandClientCapabilities.fromJson(json['executeCommand'])
+ final executeCommandJson = json['executeCommand'];
+ final executeCommand = executeCommandJson != null
+ ? ExecuteCommandClientCapabilities.fromJson(
+ executeCommandJson as Map<String, Object?>)
: null;
- final workspaceFolders = json['workspaceFolders'];
- final configuration = json['configuration'];
- final semanticTokens = json['semanticTokens'] != null
+ final workspaceFoldersJson = json['workspaceFolders'];
+ final workspaceFolders = workspaceFoldersJson as bool?;
+ final configurationJson = json['configuration'];
+ final configuration = configurationJson as bool?;
+ final semanticTokensJson = json['semanticTokens'];
+ final semanticTokens = semanticTokensJson != null
? SemanticTokensWorkspaceClientCapabilities.fromJson(
- json['semanticTokens'])
+ semanticTokensJson as Map<String, Object?>)
: null;
- final codeLens = json['codeLens'] != null
- ? CodeLensWorkspaceClientCapabilities.fromJson(json['codeLens'])
+ final codeLensJson = json['codeLens'];
+ final codeLens = codeLensJson != null
+ ? CodeLensWorkspaceClientCapabilities.fromJson(
+ codeLensJson as Map<String, Object?>)
: null;
- final fileOperations = json['fileOperations'] != null
- ? ClientCapabilitiesFileOperations.fromJson(json['fileOperations'])
+ final fileOperationsJson = json['fileOperations'];
+ final fileOperations = fileOperationsJson != null
+ ? ClientCapabilitiesFileOperations.fromJson(
+ fileOperationsJson as Map<String, Object?>)
: null;
return ClientCapabilitiesWorkspace(
applyEdit: applyEdit,
@@ -2193,8 +2306,8 @@
/// @since 3.6.0
final bool? workspaceFolders;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (applyEdit != null) {
__result['applyEdit'] = applyEdit;
}
@@ -2232,10 +2345,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('applyEdit');
try {
- if (obj['applyEdit'] != null && !(obj['applyEdit'] is bool)) {
+ final applyEdit = obj['applyEdit'];
+ if (applyEdit != null && !(applyEdit is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2244,9 +2358,10 @@
}
reporter.push('workspaceEdit');
try {
- if (obj['workspaceEdit'] != null &&
+ final workspaceEdit = obj['workspaceEdit'];
+ if (workspaceEdit != null &&
!(WorkspaceEditClientCapabilities.canParse(
- obj['workspaceEdit'], reporter))) {
+ workspaceEdit, reporter))) {
reporter
.reportError('must be of type WorkspaceEditClientCapabilities');
return false;
@@ -2256,9 +2371,10 @@
}
reporter.push('didChangeConfiguration');
try {
- if (obj['didChangeConfiguration'] != null &&
+ final didChangeConfiguration = obj['didChangeConfiguration'];
+ if (didChangeConfiguration != null &&
!(DidChangeConfigurationClientCapabilities.canParse(
- obj['didChangeConfiguration'], reporter))) {
+ didChangeConfiguration, reporter))) {
reporter.reportError(
'must be of type DidChangeConfigurationClientCapabilities');
return false;
@@ -2268,9 +2384,10 @@
}
reporter.push('didChangeWatchedFiles');
try {
- if (obj['didChangeWatchedFiles'] != null &&
+ final didChangeWatchedFiles = obj['didChangeWatchedFiles'];
+ if (didChangeWatchedFiles != null &&
!(DidChangeWatchedFilesClientCapabilities.canParse(
- obj['didChangeWatchedFiles'], reporter))) {
+ didChangeWatchedFiles, reporter))) {
reporter.reportError(
'must be of type DidChangeWatchedFilesClientCapabilities');
return false;
@@ -2280,9 +2397,9 @@
}
reporter.push('symbol');
try {
- if (obj['symbol'] != null &&
- !(WorkspaceSymbolClientCapabilities.canParse(
- obj['symbol'], reporter))) {
+ final symbol = obj['symbol'];
+ if (symbol != null &&
+ !(WorkspaceSymbolClientCapabilities.canParse(symbol, reporter))) {
reporter
.reportError('must be of type WorkspaceSymbolClientCapabilities');
return false;
@@ -2292,9 +2409,10 @@
}
reporter.push('executeCommand');
try {
- if (obj['executeCommand'] != null &&
+ final executeCommand = obj['executeCommand'];
+ if (executeCommand != null &&
!(ExecuteCommandClientCapabilities.canParse(
- obj['executeCommand'], reporter))) {
+ executeCommand, reporter))) {
reporter
.reportError('must be of type ExecuteCommandClientCapabilities');
return false;
@@ -2304,8 +2422,8 @@
}
reporter.push('workspaceFolders');
try {
- if (obj['workspaceFolders'] != null &&
- !(obj['workspaceFolders'] is bool)) {
+ final workspaceFolders = obj['workspaceFolders'];
+ if (workspaceFolders != null && !(workspaceFolders is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2314,7 +2432,8 @@
}
reporter.push('configuration');
try {
- if (obj['configuration'] != null && !(obj['configuration'] is bool)) {
+ final configuration = obj['configuration'];
+ if (configuration != null && !(configuration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2323,9 +2442,10 @@
}
reporter.push('semanticTokens');
try {
- if (obj['semanticTokens'] != null &&
+ final semanticTokens = obj['semanticTokens'];
+ if (semanticTokens != null &&
!(SemanticTokensWorkspaceClientCapabilities.canParse(
- obj['semanticTokens'], reporter))) {
+ semanticTokens, reporter))) {
reporter.reportError(
'must be of type SemanticTokensWorkspaceClientCapabilities');
return false;
@@ -2335,9 +2455,10 @@
}
reporter.push('codeLens');
try {
- if (obj['codeLens'] != null &&
+ final codeLens = obj['codeLens'];
+ if (codeLens != null &&
!(CodeLensWorkspaceClientCapabilities.canParse(
- obj['codeLens'], reporter))) {
+ codeLens, reporter))) {
reporter.reportError(
'must be of type CodeLensWorkspaceClientCapabilities');
return false;
@@ -2347,9 +2468,10 @@
}
reporter.push('fileOperations');
try {
- if (obj['fileOperations'] != null &&
+ final fileOperations = obj['fileOperations'];
+ if (fileOperations != null &&
!(ClientCapabilitiesFileOperations.canParse(
- obj['fileOperations'], reporter))) {
+ fileOperations, reporter))) {
reporter
.reportError('must be of type ClientCapabilitiesFileOperations');
return false;
@@ -2423,23 +2545,32 @@
this.edit,
this.command,
this.data});
- static CodeAction fromJson(Map<String, dynamic> json) {
- final title = json['title'];
+ static CodeAction fromJson(Map<String, Object?> json) {
+ final titleJson = json['title'];
+ final title = titleJson as String;
+ final kindJson = json['kind'];
final kind =
- json['kind'] != null ? CodeActionKind.fromJson(json['kind']) : null;
- final diagnostics = json['diagnostics']
- ?.map((item) => item != null ? Diagnostic.fromJson(item) : null)
- ?.cast<Diagnostic>()
- ?.toList();
- final isPreferred = json['isPreferred'];
- final disabled = json['disabled'] != null
- ? CodeActionDisabled.fromJson(json['disabled'])
+ kindJson != null ? CodeActionKind.fromJson(kindJson as String) : null;
+ final diagnosticsJson = json['diagnostics'];
+ final diagnostics = (diagnosticsJson as List<Object?>?)
+ ?.map((item) => Diagnostic.fromJson(item as Map<String, Object?>))
+ .toList();
+ final isPreferredJson = json['isPreferred'];
+ final isPreferred = isPreferredJson as bool?;
+ final disabledJson = json['disabled'];
+ final disabled = disabledJson != null
+ ? CodeActionDisabled.fromJson(disabledJson as Map<String, Object?>)
: null;
- final edit =
- json['edit'] != null ? WorkspaceEdit.fromJson(json['edit']) : null;
- final command =
- json['command'] != null ? Command.fromJson(json['command']) : null;
- final data = json['data'];
+ final editJson = json['edit'];
+ final edit = editJson != null
+ ? WorkspaceEdit.fromJson(editJson as Map<String, Object?>)
+ : null;
+ final commandJson = json['command'];
+ final command = commandJson != null
+ ? Command.fromJson(commandJson as Map<String, Object?>)
+ : null;
+ final dataJson = json['data'];
+ final data = dataJson;
return CodeAction(
title: title,
kind: kind,
@@ -2458,7 +2589,7 @@
/// A data entry field that is preserved on a code action between a
/// `textDocument/codeAction` and a `codeAction/resolve` request.
/// @since 3.16.0
- final dynamic data;
+ final Object? data;
/// The diagnostics that this code action resolves.
final List<Diagnostic>? diagnostics;
@@ -2501,8 +2632,8 @@
/// A short, human-readable, title for this code action.
final String title;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['title'] = title;
if (kind != null) {
__result['kind'] = kind?.toJson();
@@ -2530,18 +2661,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('title');
try {
if (!obj.containsKey('title')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['title'] == null) {
+ final title = obj['title'];
+ if (title == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['title'] is String)) {
+ if (!(title is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -2550,8 +2682,8 @@
}
reporter.push('kind');
try {
- if (obj['kind'] != null &&
- !(CodeActionKind.canParse(obj['kind'], reporter))) {
+ final kind = obj['kind'];
+ if (kind != null && !(CodeActionKind.canParse(kind, reporter))) {
reporter.reportError('must be of type CodeActionKind');
return false;
}
@@ -2560,9 +2692,10 @@
}
reporter.push('diagnostics');
try {
- if (obj['diagnostics'] != null &&
- !((obj['diagnostics'] is List &&
- (obj['diagnostics']
+ final diagnostics = obj['diagnostics'];
+ if (diagnostics != null &&
+ !((diagnostics is List &&
+ (diagnostics
.every((item) => Diagnostic.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Diagnostic>');
return false;
@@ -2572,7 +2705,8 @@
}
reporter.push('isPreferred');
try {
- if (obj['isPreferred'] != null && !(obj['isPreferred'] is bool)) {
+ final isPreferred = obj['isPreferred'];
+ if (isPreferred != null && !(isPreferred is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2581,8 +2715,9 @@
}
reporter.push('disabled');
try {
- if (obj['disabled'] != null &&
- !(CodeActionDisabled.canParse(obj['disabled'], reporter))) {
+ final disabled = obj['disabled'];
+ if (disabled != null &&
+ !(CodeActionDisabled.canParse(disabled, reporter))) {
reporter.reportError('must be of type CodeActionDisabled');
return false;
}
@@ -2591,8 +2726,8 @@
}
reporter.push('edit');
try {
- if (obj['edit'] != null &&
- !(WorkspaceEdit.canParse(obj['edit'], reporter))) {
+ final edit = obj['edit'];
+ if (edit != null && !(WorkspaceEdit.canParse(edit, reporter))) {
reporter.reportError('must be of type WorkspaceEdit');
return false;
}
@@ -2601,8 +2736,8 @@
}
reporter.push('command');
try {
- if (obj['command'] != null &&
- !(Command.canParse(obj['command'], reporter))) {
+ final command = obj['command'];
+ if (command != null && !(Command.canParse(command, reporter))) {
reporter.reportError('must be of type Command');
return false;
}
@@ -2664,20 +2799,27 @@
this.dataSupport,
this.resolveSupport,
this.honorsChangeAnnotations});
- static CodeActionClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final codeActionLiteralSupport = json['codeActionLiteralSupport'] != null
+ static CodeActionClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final codeActionLiteralSupportJson = json['codeActionLiteralSupport'];
+ final codeActionLiteralSupport = codeActionLiteralSupportJson != null
? CodeActionClientCapabilitiesCodeActionLiteralSupport.fromJson(
- json['codeActionLiteralSupport'])
+ codeActionLiteralSupportJson as Map<String, Object?>)
: null;
- final isPreferredSupport = json['isPreferredSupport'];
- final disabledSupport = json['disabledSupport'];
- final dataSupport = json['dataSupport'];
- final resolveSupport = json['resolveSupport'] != null
+ final isPreferredSupportJson = json['isPreferredSupport'];
+ final isPreferredSupport = isPreferredSupportJson as bool?;
+ final disabledSupportJson = json['disabledSupport'];
+ final disabledSupport = disabledSupportJson as bool?;
+ final dataSupportJson = json['dataSupport'];
+ final dataSupport = dataSupportJson as bool?;
+ final resolveSupportJson = json['resolveSupport'];
+ final resolveSupport = resolveSupportJson != null
? CodeActionClientCapabilitiesResolveSupport.fromJson(
- json['resolveSupport'])
+ resolveSupportJson as Map<String, Object?>)
: null;
- final honorsChangeAnnotations = json['honorsChangeAnnotations'];
+ final honorsChangeAnnotationsJson = json['honorsChangeAnnotations'];
+ final honorsChangeAnnotations = honorsChangeAnnotationsJson as bool?;
return CodeActionClientCapabilities(
dynamicRegistration: dynamicRegistration,
codeActionLiteralSupport: codeActionLiteralSupport,
@@ -2722,8 +2864,8 @@
/// @since 3.16.0
final CodeActionClientCapabilitiesResolveSupport? resolveSupport;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -2749,11 +2891,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2762,9 +2904,10 @@
}
reporter.push('codeActionLiteralSupport');
try {
- if (obj['codeActionLiteralSupport'] != null &&
+ final codeActionLiteralSupport = obj['codeActionLiteralSupport'];
+ if (codeActionLiteralSupport != null &&
!(CodeActionClientCapabilitiesCodeActionLiteralSupport.canParse(
- obj['codeActionLiteralSupport'], reporter))) {
+ codeActionLiteralSupport, reporter))) {
reporter.reportError(
'must be of type CodeActionClientCapabilitiesCodeActionLiteralSupport');
return false;
@@ -2774,8 +2917,8 @@
}
reporter.push('isPreferredSupport');
try {
- if (obj['isPreferredSupport'] != null &&
- !(obj['isPreferredSupport'] is bool)) {
+ final isPreferredSupport = obj['isPreferredSupport'];
+ if (isPreferredSupport != null && !(isPreferredSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2784,8 +2927,8 @@
}
reporter.push('disabledSupport');
try {
- if (obj['disabledSupport'] != null &&
- !(obj['disabledSupport'] is bool)) {
+ final disabledSupport = obj['disabledSupport'];
+ if (disabledSupport != null && !(disabledSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2794,7 +2937,8 @@
}
reporter.push('dataSupport');
try {
- if (obj['dataSupport'] != null && !(obj['dataSupport'] is bool)) {
+ final dataSupport = obj['dataSupport'];
+ if (dataSupport != null && !(dataSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2803,9 +2947,10 @@
}
reporter.push('resolveSupport');
try {
- if (obj['resolveSupport'] != null &&
+ final resolveSupport = obj['resolveSupport'];
+ if (resolveSupport != null &&
!(CodeActionClientCapabilitiesResolveSupport.canParse(
- obj['resolveSupport'], reporter))) {
+ resolveSupport, reporter))) {
reporter.reportError(
'must be of type CodeActionClientCapabilitiesResolveSupport');
return false;
@@ -2815,8 +2960,9 @@
}
reporter.push('honorsChangeAnnotations');
try {
- if (obj['honorsChangeAnnotations'] != null &&
- !(obj['honorsChangeAnnotations'] is bool)) {
+ final honorsChangeAnnotations = obj['honorsChangeAnnotations'];
+ if (honorsChangeAnnotations != null &&
+ !(honorsChangeAnnotations is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2870,11 +3016,11 @@
CodeActionClientCapabilitiesCodeActionKind({required this.valueSet});
static CodeActionClientCapabilitiesCodeActionKind fromJson(
- Map<String, dynamic> json) {
- final valueSet = json['valueSet']
- ?.map((item) => CodeActionKind.fromJson(item))
- ?.cast<CodeActionKind>()
- ?.toList();
+ Map<String, Object?> json) {
+ final valueSetJson = json['valueSet'];
+ final valueSet = (valueSetJson as List<Object?>)
+ .map((item) => CodeActionKind.fromJson(item as String))
+ .toList();
return CodeActionClientCapabilitiesCodeActionKind(valueSet: valueSet);
}
@@ -2883,26 +3029,27 @@
/// gracefully and falls back to a default value when unknown.
final List<CodeActionKind> valueSet;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('valueSet');
try {
if (!obj.containsKey('valueSet')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['valueSet'] == null) {
+ final valueSet = obj['valueSet'];
+ if (valueSet == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['valueSet'] is List &&
- (obj['valueSet']
+ if (!((valueSet is List &&
+ (valueSet
.every((item) => CodeActionKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CodeActionKind>');
return false;
@@ -2949,9 +3096,10 @@
CodeActionClientCapabilitiesCodeActionLiteralSupport(
{required this.codeActionKind});
static CodeActionClientCapabilitiesCodeActionLiteralSupport fromJson(
- Map<String, dynamic> json) {
+ Map<String, Object?> json) {
+ final codeActionKindJson = json['codeActionKind'];
final codeActionKind = CodeActionClientCapabilitiesCodeActionKind.fromJson(
- json['codeActionKind']);
+ codeActionKindJson as Map<String, Object?>);
return CodeActionClientCapabilitiesCodeActionLiteralSupport(
codeActionKind: codeActionKind);
}
@@ -2959,26 +3107,27 @@
/// The code action kind is supported with the following value set.
final CodeActionClientCapabilitiesCodeActionKind codeActionKind;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['codeActionKind'] = codeActionKind.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('codeActionKind');
try {
if (!obj.containsKey('codeActionKind')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['codeActionKind'] == null) {
+ final codeActionKind = obj['codeActionKind'];
+ if (codeActionKind == null) {
reporter.reportError('must not be null');
return false;
}
if (!(CodeActionClientCapabilitiesCodeActionKind.canParse(
- obj['codeActionKind'], reporter))) {
+ codeActionKind, reporter))) {
reporter.reportError(
'must be of type CodeActionClientCapabilitiesCodeActionKind');
return false;
@@ -3022,35 +3171,38 @@
CodeActionClientCapabilitiesResolveSupport({required this.properties});
static CodeActionClientCapabilitiesResolveSupport fromJson(
- Map<String, dynamic> json) {
- final properties =
- json['properties']?.map((item) => item)?.cast<String>()?.toList();
+ Map<String, Object?> json) {
+ final propertiesJson = json['properties'];
+ final properties = (propertiesJson as List<Object?>)
+ .map((item) => item as String)
+ .toList();
return CodeActionClientCapabilitiesResolveSupport(properties: properties);
}
/// The properties that a client can resolve lazily.
final List<String> properties;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['properties'] = properties;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('properties');
try {
if (!obj.containsKey('properties')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['properties'] == null) {
+ final properties = obj['properties'];
+ if (properties == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['properties'] is List &&
- (obj['properties'].every((item) => item is String))))) {
+ if (!((properties is List &&
+ (properties.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -3094,15 +3246,15 @@
LspJsonHandler(CodeActionContext.canParse, CodeActionContext.fromJson);
CodeActionContext({required this.diagnostics, this.only});
- static CodeActionContext fromJson(Map<String, dynamic> json) {
- final diagnostics = json['diagnostics']
- ?.map((item) => Diagnostic.fromJson(item))
- ?.cast<Diagnostic>()
- ?.toList();
- final only = json['only']
- ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null)
- ?.cast<CodeActionKind>()
- ?.toList();
+ static CodeActionContext fromJson(Map<String, Object?> json) {
+ final diagnosticsJson = json['diagnostics'];
+ final diagnostics = (diagnosticsJson as List<Object?>)
+ .map((item) => Diagnostic.fromJson(item as Map<String, Object?>))
+ .toList();
+ final onlyJson = json['only'];
+ final only = (onlyJson as List<Object?>?)
+ ?.map((item) => CodeActionKind.fromJson(item as String))
+ .toList();
return CodeActionContext(diagnostics: diagnostics, only: only);
}
@@ -3120,8 +3272,8 @@
/// shown. So servers can omit computing them.
final List<CodeActionKind>? only;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['diagnostics'] = diagnostics.map((item) => item.toJson()).toList();
if (only != null) {
__result['only'] = only?.map((item) => item.toJson()).toList();
@@ -3130,19 +3282,20 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('diagnostics');
try {
if (!obj.containsKey('diagnostics')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['diagnostics'] == null) {
+ final diagnostics = obj['diagnostics'];
+ if (diagnostics == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['diagnostics'] is List &&
- (obj['diagnostics']
+ if (!((diagnostics is List &&
+ (diagnostics
.every((item) => Diagnostic.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Diagnostic>');
return false;
@@ -3152,9 +3305,10 @@
}
reporter.push('only');
try {
- if (obj['only'] != null &&
- !((obj['only'] is List &&
- (obj['only'].every(
+ final only = obj['only'];
+ if (only != null &&
+ !((only is List &&
+ (only.every(
(item) => CodeActionKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CodeActionKind>');
return false;
@@ -3198,8 +3352,9 @@
LspJsonHandler(CodeActionDisabled.canParse, CodeActionDisabled.fromJson);
CodeActionDisabled({required this.reason});
- static CodeActionDisabled fromJson(Map<String, dynamic> json) {
- final reason = json['reason'];
+ static CodeActionDisabled fromJson(Map<String, Object?> json) {
+ final reasonJson = json['reason'];
+ final reason = reasonJson as String;
return CodeActionDisabled(reason: reason);
}
@@ -3208,25 +3363,26 @@
/// This is displayed in the code actions UI.
final String reason;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['reason'] = reason;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('reason');
try {
if (!obj.containsKey('reason')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['reason'] == null) {
+ final reason = obj['reason'];
+ if (reason == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['reason'] is String)) {
+ if (!(reason is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -3338,16 +3494,18 @@
CodeActionOptions(
{this.codeActionKinds, this.resolveProvider, this.workDoneProgress});
- static CodeActionOptions fromJson(Map<String, dynamic> json) {
+ static CodeActionOptions fromJson(Map<String, Object?> json) {
if (CodeActionRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return CodeActionRegistrationOptions.fromJson(json);
}
- final codeActionKinds = json['codeActionKinds']
- ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null)
- ?.cast<CodeActionKind>()
- ?.toList();
- final resolveProvider = json['resolveProvider'];
- final workDoneProgress = json['workDoneProgress'];
+ final codeActionKindsJson = json['codeActionKinds'];
+ final codeActionKinds = (codeActionKindsJson as List<Object?>?)
+ ?.map((item) => CodeActionKind.fromJson(item as String))
+ .toList();
+ final resolveProviderJson = json['resolveProvider'];
+ final resolveProvider = resolveProviderJson as bool?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return CodeActionOptions(
codeActionKinds: codeActionKinds,
resolveProvider: resolveProvider,
@@ -3366,8 +3524,8 @@
final bool? resolveProvider;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (codeActionKinds != null) {
__result['codeActionKinds'] =
codeActionKinds?.map((item) => item.toJson()).toList();
@@ -3382,12 +3540,13 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('codeActionKinds');
try {
- if (obj['codeActionKinds'] != null &&
- !((obj['codeActionKinds'] is List &&
- (obj['codeActionKinds'].every(
+ final codeActionKinds = obj['codeActionKinds'];
+ if (codeActionKinds != null &&
+ !((codeActionKinds is List &&
+ (codeActionKinds.every(
(item) => CodeActionKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CodeActionKind>');
return false;
@@ -3397,8 +3556,8 @@
}
reporter.push('resolveProvider');
try {
- if (obj['resolveProvider'] != null &&
- !(obj['resolveProvider'] is bool)) {
+ final resolveProvider = obj['resolveProvider'];
+ if (resolveProvider != null && !(resolveProvider is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3407,8 +3566,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3459,24 +3618,31 @@
required this.context,
this.workDoneToken,
this.partialResultToken});
- static CodeActionParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final range = Range.fromJson(json['range']);
- final context = CodeActionContext.fromJson(json['context']);
- final workDoneToken = json['workDoneToken'] == null
+ static CodeActionParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final contextJson = json['context'];
+ final context =
+ CodeActionContext.fromJson(contextJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return CodeActionParams(
textDocument: textDocument,
range: range,
@@ -3501,8 +3667,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['range'] = range.toJson();
__result['context'] = context.toJson();
@@ -3516,18 +3682,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -3540,11 +3707,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -3557,11 +3725,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['context'] == null) {
+ final context = obj['context'];
+ if (context == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(CodeActionContext.canParse(obj['context'], reporter))) {
+ if (!(CodeActionContext.canParse(context, reporter))) {
reporter.reportError('must be of type CodeActionContext');
return false;
}
@@ -3570,9 +3739,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -3581,9 +3750,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -3636,17 +3805,19 @@
this.codeActionKinds,
this.resolveProvider,
this.workDoneProgress});
- static CodeActionRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final codeActionKinds = json['codeActionKinds']
- ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null)
- ?.cast<CodeActionKind>()
- ?.toList();
- final resolveProvider = json['resolveProvider'];
- final workDoneProgress = json['workDoneProgress'];
+ static CodeActionRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final codeActionKindsJson = json['codeActionKinds'];
+ final codeActionKinds = (codeActionKindsJson as List<Object?>?)
+ ?.map((item) => CodeActionKind.fromJson(item as String))
+ .toList();
+ final resolveProviderJson = json['resolveProvider'];
+ final resolveProvider = resolveProviderJson as bool?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return CodeActionRegistrationOptions(
documentSelector: documentSelector,
codeActionKinds: codeActionKinds,
@@ -3670,8 +3841,8 @@
final bool? resolveProvider;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (codeActionKinds != null) {
__result['codeActionKinds'] =
@@ -3687,16 +3858,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -3706,9 +3878,10 @@
}
reporter.push('codeActionKinds');
try {
- if (obj['codeActionKinds'] != null &&
- !((obj['codeActionKinds'] is List &&
- (obj['codeActionKinds'].every(
+ final codeActionKinds = obj['codeActionKinds'];
+ if (codeActionKinds != null &&
+ !((codeActionKinds is List &&
+ (codeActionKinds.every(
(item) => CodeActionKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CodeActionKind>');
return false;
@@ -3718,8 +3891,8 @@
}
reporter.push('resolveProvider');
try {
- if (obj['resolveProvider'] != null &&
- !(obj['resolveProvider'] is bool)) {
+ final resolveProvider = obj['resolveProvider'];
+ if (resolveProvider != null && !(resolveProvider is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3728,8 +3901,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3779,33 +3952,35 @@
LspJsonHandler(CodeDescription.canParse, CodeDescription.fromJson);
CodeDescription({required this.href});
- static CodeDescription fromJson(Map<String, dynamic> json) {
- final href = json['href'];
+ static CodeDescription fromJson(Map<String, Object?> json) {
+ final hrefJson = json['href'];
+ final href = hrefJson as String;
return CodeDescription(href: href);
}
/// An URI to open with more information about the diagnostic error.
final String href;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['href'] = href;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('href');
try {
if (!obj.containsKey('href')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['href'] == null) {
+ final href = obj['href'];
+ if (href == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['href'] is String)) {
+ if (!(href is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -3849,11 +4024,15 @@
LspJsonHandler(CodeLens.canParse, CodeLens.fromJson);
CodeLens({required this.range, this.command, this.data});
- static CodeLens fromJson(Map<String, dynamic> json) {
- final range = Range.fromJson(json['range']);
- final command =
- json['command'] != null ? Command.fromJson(json['command']) : null;
- final data = json['data'];
+ static CodeLens fromJson(Map<String, Object?> json) {
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final commandJson = json['command'];
+ final command = commandJson != null
+ ? Command.fromJson(commandJson as Map<String, Object?>)
+ : null;
+ final dataJson = json['data'];
+ final data = dataJson;
return CodeLens(range: range, command: command, data: data);
}
@@ -3862,14 +4041,14 @@
/// A data entry field that is preserved on a code lens item between a code
/// lens and a code lens resolve request.
- final dynamic data;
+ final Object? data;
/// The range in which this code lens is valid. Should only span a single
/// line.
final Range range;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['range'] = range.toJson();
if (command != null) {
__result['command'] = command?.toJson();
@@ -3881,18 +4060,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('range');
try {
if (!obj.containsKey('range')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -3901,8 +4081,8 @@
}
reporter.push('command');
try {
- if (obj['command'] != null &&
- !(Command.canParse(obj['command'], reporter))) {
+ final command = obj['command'];
+ if (command != null && !(Command.canParse(command, reporter))) {
reporter.reportError('must be of type Command');
return false;
}
@@ -3945,16 +4125,17 @@
CodeLensClientCapabilities.canParse, CodeLensClientCapabilities.fromJson);
CodeLensClientCapabilities({this.dynamicRegistration});
- static CodeLensClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ static CodeLensClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return CodeLensClientCapabilities(dynamicRegistration: dynamicRegistration);
}
/// Whether code lens supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -3962,11 +4143,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -4005,12 +4186,14 @@
LspJsonHandler(CodeLensOptions.canParse, CodeLensOptions.fromJson);
CodeLensOptions({this.resolveProvider, this.workDoneProgress});
- static CodeLensOptions fromJson(Map<String, dynamic> json) {
+ static CodeLensOptions fromJson(Map<String, Object?> json) {
if (CodeLensRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return CodeLensRegistrationOptions.fromJson(json);
}
- final resolveProvider = json['resolveProvider'];
- final workDoneProgress = json['workDoneProgress'];
+ final resolveProviderJson = json['resolveProvider'];
+ final resolveProvider = resolveProviderJson as bool?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return CodeLensOptions(
resolveProvider: resolveProvider, workDoneProgress: workDoneProgress);
}
@@ -4019,8 +4202,8 @@
final bool? resolveProvider;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (resolveProvider != null) {
__result['resolveProvider'] = resolveProvider;
}
@@ -4031,11 +4214,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('resolveProvider');
try {
- if (obj['resolveProvider'] != null &&
- !(obj['resolveProvider'] is bool)) {
+ final resolveProvider = obj['resolveProvider'];
+ if (resolveProvider != null && !(resolveProvider is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -4044,8 +4227,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -4090,22 +4273,26 @@
{required this.textDocument,
this.workDoneToken,
this.partialResultToken});
- static CodeLensParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final workDoneToken = json['workDoneToken'] == null
+ static CodeLensParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return CodeLensParams(
textDocument: textDocument,
workDoneToken: workDoneToken,
@@ -4122,8 +4309,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
@@ -4135,18 +4322,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -4155,9 +4343,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -4166,9 +4354,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -4214,13 +4402,15 @@
CodeLensRegistrationOptions(
{this.documentSelector, this.resolveProvider, this.workDoneProgress});
- static CodeLensRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final resolveProvider = json['resolveProvider'];
- final workDoneProgress = json['workDoneProgress'];
+ static CodeLensRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final resolveProviderJson = json['resolveProvider'];
+ final resolveProvider = resolveProviderJson as bool?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return CodeLensRegistrationOptions(
documentSelector: documentSelector,
resolveProvider: resolveProvider,
@@ -4235,8 +4425,8 @@
final bool? resolveProvider;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (resolveProvider != null) {
__result['resolveProvider'] = resolveProvider;
@@ -4248,16 +4438,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -4267,8 +4458,8 @@
}
reporter.push('resolveProvider');
try {
- if (obj['resolveProvider'] != null &&
- !(obj['resolveProvider'] is bool)) {
+ final resolveProvider = obj['resolveProvider'];
+ if (resolveProvider != null && !(resolveProvider is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -4277,8 +4468,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -4325,8 +4516,9 @@
CodeLensWorkspaceClientCapabilities({this.refreshSupport});
static CodeLensWorkspaceClientCapabilities fromJson(
- Map<String, dynamic> json) {
- final refreshSupport = json['refreshSupport'];
+ Map<String, Object?> json) {
+ final refreshSupportJson = json['refreshSupport'];
+ final refreshSupport = refreshSupportJson as bool?;
return CodeLensWorkspaceClientCapabilities(refreshSupport: refreshSupport);
}
@@ -4339,8 +4531,8 @@
/// change that requires such a calculation.
final bool? refreshSupport;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (refreshSupport != null) {
__result['refreshSupport'] = refreshSupport;
}
@@ -4348,10 +4540,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('refreshSupport');
try {
- if (obj['refreshSupport'] != null && !(obj['refreshSupport'] is bool)) {
+ final refreshSupport = obj['refreshSupport'];
+ if (refreshSupport != null && !(refreshSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -4395,11 +4588,15 @@
required this.green,
required this.blue,
required this.alpha});
- static Color fromJson(Map<String, dynamic> json) {
- final red = json['red'];
- final green = json['green'];
- final blue = json['blue'];
- final alpha = json['alpha'];
+ static Color fromJson(Map<String, Object?> json) {
+ final redJson = json['red'];
+ final red = redJson as num;
+ final greenJson = json['green'];
+ final green = greenJson as num;
+ final blueJson = json['blue'];
+ final blue = blueJson as num;
+ final alphaJson = json['alpha'];
+ final alpha = alphaJson as num;
return Color(red: red, green: green, blue: blue, alpha: alpha);
}
@@ -4415,8 +4612,8 @@
/// The red component of this color in the range [0-1].
final num red;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['red'] = red;
__result['green'] = green;
__result['blue'] = blue;
@@ -4425,18 +4622,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('red');
try {
if (!obj.containsKey('red')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['red'] == null) {
+ final red = obj['red'];
+ if (red == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['red'] is num)) {
+ if (!(red is num)) {
reporter.reportError('must be of type num');
return false;
}
@@ -4449,11 +4647,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['green'] == null) {
+ final green = obj['green'];
+ if (green == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['green'] is num)) {
+ if (!(green is num)) {
reporter.reportError('must be of type num');
return false;
}
@@ -4466,11 +4665,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['blue'] == null) {
+ final blue = obj['blue'];
+ if (blue == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['blue'] is num)) {
+ if (!(blue is num)) {
reporter.reportError('must be of type num');
return false;
}
@@ -4483,11 +4683,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['alpha'] == null) {
+ final alpha = obj['alpha'];
+ if (alpha == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['alpha'] is num)) {
+ if (!(alpha is num)) {
reporter.reportError('must be of type num');
return false;
}
@@ -4532,9 +4733,11 @@
LspJsonHandler(ColorInformation.canParse, ColorInformation.fromJson);
ColorInformation({required this.range, required this.color});
- static ColorInformation fromJson(Map<String, dynamic> json) {
- final range = Range.fromJson(json['range']);
- final color = Color.fromJson(json['color']);
+ static ColorInformation fromJson(Map<String, Object?> json) {
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final colorJson = json['color'];
+ final color = Color.fromJson(colorJson as Map<String, Object?>);
return ColorInformation(range: range, color: color);
}
@@ -4544,26 +4747,27 @@
/// The range in the document where this color appears.
final Range range;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['range'] = range.toJson();
__result['color'] = color.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('range');
try {
if (!obj.containsKey('range')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -4576,11 +4780,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['color'] == null) {
+ final color = obj['color'];
+ if (color == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Color.canParse(obj['color'], reporter))) {
+ if (!(Color.canParse(color, reporter))) {
reporter.reportError('must be of type Color');
return false;
}
@@ -4620,14 +4825,17 @@
ColorPresentation(
{required this.label, this.textEdit, this.additionalTextEdits});
- static ColorPresentation fromJson(Map<String, dynamic> json) {
- final label = json['label'];
- final textEdit =
- json['textEdit'] != null ? TextEdit.fromJson(json['textEdit']) : null;
- final additionalTextEdits = json['additionalTextEdits']
- ?.map((item) => item != null ? TextEdit.fromJson(item) : null)
- ?.cast<TextEdit>()
- ?.toList();
+ static ColorPresentation fromJson(Map<String, Object?> json) {
+ final labelJson = json['label'];
+ final label = labelJson as String;
+ final textEditJson = json['textEdit'];
+ final textEdit = textEditJson != null
+ ? TextEdit.fromJson(textEditJson as Map<String, Object?>)
+ : null;
+ final additionalTextEditsJson = json['additionalTextEdits'];
+ final additionalTextEdits = (additionalTextEditsJson as List<Object?>?)
+ ?.map((item) => TextEdit.fromJson(item as Map<String, Object?>))
+ .toList();
return ColorPresentation(
label: label,
textEdit: textEdit,
@@ -4649,8 +4857,8 @@
/// [label](#ColorPresentation.label) is used.
final TextEdit? textEdit;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['label'] = label;
if (textEdit != null) {
__result['textEdit'] = textEdit?.toJson();
@@ -4663,18 +4871,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('label');
try {
if (!obj.containsKey('label')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['label'] == null) {
+ final label = obj['label'];
+ if (label == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['label'] is String)) {
+ if (!(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -4683,8 +4892,8 @@
}
reporter.push('textEdit');
try {
- if (obj['textEdit'] != null &&
- !(TextEdit.canParse(obj['textEdit'], reporter))) {
+ final textEdit = obj['textEdit'];
+ if (textEdit != null && !(TextEdit.canParse(textEdit, reporter))) {
reporter.reportError('must be of type TextEdit');
return false;
}
@@ -4693,9 +4902,10 @@
}
reporter.push('additionalTextEdits');
try {
- if (obj['additionalTextEdits'] != null &&
- !((obj['additionalTextEdits'] is List &&
- (obj['additionalTextEdits']
+ final additionalTextEdits = obj['additionalTextEdits'];
+ if (additionalTextEdits != null &&
+ !((additionalTextEdits is List &&
+ (additionalTextEdits
.every((item) => TextEdit.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<TextEdit>');
return false;
@@ -4746,24 +4956,30 @@
required this.range,
this.workDoneToken,
this.partialResultToken});
- static ColorPresentationParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final color = Color.fromJson(json['color']);
- final range = Range.fromJson(json['range']);
- final workDoneToken = json['workDoneToken'] == null
+ static ColorPresentationParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final colorJson = json['color'];
+ final color = Color.fromJson(colorJson as Map<String, Object?>);
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return ColorPresentationParams(
textDocument: textDocument,
color: color,
@@ -4788,8 +5004,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['color'] = color.toJson();
__result['range'] = range.toJson();
@@ -4803,18 +5019,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -4827,11 +5044,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['color'] == null) {
+ final color = obj['color'];
+ if (color == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Color.canParse(obj['color'], reporter))) {
+ if (!(Color.canParse(color, reporter))) {
reporter.reportError('must be of type Color');
return false;
}
@@ -4844,11 +5062,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -4857,9 +5076,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -4868,9 +5087,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -4917,16 +5136,19 @@
static const jsonHandler = LspJsonHandler(Command.canParse, Command.fromJson);
Command({required this.title, required this.command, this.arguments});
- static Command fromJson(Map<String, dynamic> json) {
- final title = json['title'];
- final command = json['command'];
+ static Command fromJson(Map<String, Object?> json) {
+ final titleJson = json['title'];
+ final title = titleJson as String;
+ final commandJson = json['command'];
+ final command = commandJson as String;
+ final argumentsJson = json['arguments'];
final arguments =
- json['arguments']?.map((item) => item)?.cast<dynamic>()?.toList();
+ (argumentsJson as List<Object?>?)?.map((item) => item).toList();
return Command(title: title, command: command, arguments: arguments);
}
/// Arguments that the command handler should be invoked with.
- final List<dynamic>? arguments;
+ final List<Object?>? arguments;
/// The identifier of the actual command handler.
final String command;
@@ -4934,8 +5156,8 @@
/// Title of the command, like `save`.
final String title;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['title'] = title;
__result['command'] = command;
if (arguments != null) {
@@ -4945,18 +5167,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('title');
try {
if (!obj.containsKey('title')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['title'] == null) {
+ final title = obj['title'];
+ if (title == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['title'] is String)) {
+ if (!(title is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -4969,11 +5192,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['command'] == null) {
+ final command = obj['command'];
+ if (command == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['command'] is String)) {
+ if (!(command is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -4982,10 +5206,10 @@
}
reporter.push('arguments');
try {
- if (obj['arguments'] != null &&
- !((obj['arguments'] is List &&
- (obj['arguments'].every((item) => true))))) {
- reporter.reportError('must be of type List<dynamic>');
+ final arguments = obj['arguments'];
+ if (arguments != null &&
+ !((arguments is List && (arguments.every((item) => true))))) {
+ reporter.reportError('must be of type List<Object?>');
return false;
}
} finally {
@@ -5004,7 +5228,7 @@
return title == other.title &&
command == other.command &&
listEqual(
- arguments, other.arguments, (dynamic a, dynamic b) => a == b) &&
+ arguments, other.arguments, (Object? a, Object? b) => a == b) &&
true;
}
return false;
@@ -5033,17 +5257,21 @@
this.completionItem,
this.completionItemKind,
this.contextSupport});
- static CompletionClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final completionItem = json['completionItem'] != null
+ static CompletionClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final completionItemJson = json['completionItem'];
+ final completionItem = completionItemJson != null
? CompletionClientCapabilitiesCompletionItem.fromJson(
- json['completionItem'])
+ completionItemJson as Map<String, Object?>)
: null;
- final completionItemKind = json['completionItemKind'] != null
+ final completionItemKindJson = json['completionItemKind'];
+ final completionItemKind = completionItemKindJson != null
? CompletionClientCapabilitiesCompletionItemKind.fromJson(
- json['completionItemKind'])
+ completionItemKindJson as Map<String, Object?>)
: null;
- final contextSupport = json['contextSupport'];
+ final contextSupportJson = json['contextSupport'];
+ final contextSupport = contextSupportJson as bool?;
return CompletionClientCapabilities(
dynamicRegistration: dynamicRegistration,
completionItem: completionItem,
@@ -5062,8 +5290,8 @@
/// Whether completion supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -5080,11 +5308,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5093,9 +5321,10 @@
}
reporter.push('completionItem');
try {
- if (obj['completionItem'] != null &&
+ final completionItem = obj['completionItem'];
+ if (completionItem != null &&
!(CompletionClientCapabilitiesCompletionItem.canParse(
- obj['completionItem'], reporter))) {
+ completionItem, reporter))) {
reporter.reportError(
'must be of type CompletionClientCapabilitiesCompletionItem');
return false;
@@ -5105,9 +5334,10 @@
}
reporter.push('completionItemKind');
try {
- if (obj['completionItemKind'] != null &&
+ final completionItemKind = obj['completionItemKind'];
+ if (completionItemKind != null &&
!(CompletionClientCapabilitiesCompletionItemKind.canParse(
- obj['completionItemKind'], reporter))) {
+ completionItemKind, reporter))) {
reporter.reportError(
'must be of type CompletionClientCapabilitiesCompletionItemKind');
return false;
@@ -5117,7 +5347,8 @@
}
reporter.push('contextSupport');
try {
- if (obj['contextSupport'] != null && !(obj['contextSupport'] is bool)) {
+ final contextSupport = obj['contextSupport'];
+ if (contextSupport != null && !(contextSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5174,26 +5405,35 @@
this.resolveSupport,
this.insertTextModeSupport});
static CompletionClientCapabilitiesCompletionItem fromJson(
- Map<String, dynamic> json) {
- final snippetSupport = json['snippetSupport'];
- final commitCharactersSupport = json['commitCharactersSupport'];
- final documentationFormat = json['documentationFormat']
- ?.map((item) => item != null ? MarkupKind.fromJson(item) : null)
- ?.cast<MarkupKind>()
- ?.toList();
- final deprecatedSupport = json['deprecatedSupport'];
- final preselectSupport = json['preselectSupport'];
- final tagSupport = json['tagSupport'] != null
- ? CompletionClientCapabilitiesTagSupport.fromJson(json['tagSupport'])
+ Map<String, Object?> json) {
+ final snippetSupportJson = json['snippetSupport'];
+ final snippetSupport = snippetSupportJson as bool?;
+ final commitCharactersSupportJson = json['commitCharactersSupport'];
+ final commitCharactersSupport = commitCharactersSupportJson as bool?;
+ final documentationFormatJson = json['documentationFormat'];
+ final documentationFormat = (documentationFormatJson as List<Object?>?)
+ ?.map((item) => MarkupKind.fromJson(item as String))
+ .toList();
+ final deprecatedSupportJson = json['deprecatedSupport'];
+ final deprecatedSupport = deprecatedSupportJson as bool?;
+ final preselectSupportJson = json['preselectSupport'];
+ final preselectSupport = preselectSupportJson as bool?;
+ final tagSupportJson = json['tagSupport'];
+ final tagSupport = tagSupportJson != null
+ ? CompletionClientCapabilitiesTagSupport.fromJson(
+ tagSupportJson as Map<String, Object?>)
: null;
- final insertReplaceSupport = json['insertReplaceSupport'];
- final resolveSupport = json['resolveSupport'] != null
+ final insertReplaceSupportJson = json['insertReplaceSupport'];
+ final insertReplaceSupport = insertReplaceSupportJson as bool?;
+ final resolveSupportJson = json['resolveSupport'];
+ final resolveSupport = resolveSupportJson != null
? CompletionClientCapabilitiesResolveSupport.fromJson(
- json['resolveSupport'])
+ resolveSupportJson as Map<String, Object?>)
: null;
- final insertTextModeSupport = json['insertTextModeSupport'] != null
+ final insertTextModeSupportJson = json['insertTextModeSupport'];
+ final insertTextModeSupport = insertTextModeSupportJson != null
? CompletionClientCapabilitiesInsertTextModeSupport.fromJson(
- json['insertTextModeSupport'])
+ insertTextModeSupportJson as Map<String, Object?>)
: null;
return CompletionClientCapabilitiesCompletionItem(
snippetSupport: snippetSupport,
@@ -5253,8 +5493,8 @@
/// @since 3.15.0
final CompletionClientCapabilitiesTagSupport? tagSupport;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (snippetSupport != null) {
__result['snippetSupport'] = snippetSupport;
}
@@ -5287,10 +5527,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('snippetSupport');
try {
- if (obj['snippetSupport'] != null && !(obj['snippetSupport'] is bool)) {
+ final snippetSupport = obj['snippetSupport'];
+ if (snippetSupport != null && !(snippetSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5299,8 +5540,9 @@
}
reporter.push('commitCharactersSupport');
try {
- if (obj['commitCharactersSupport'] != null &&
- !(obj['commitCharactersSupport'] is bool)) {
+ final commitCharactersSupport = obj['commitCharactersSupport'];
+ if (commitCharactersSupport != null &&
+ !(commitCharactersSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5309,9 +5551,10 @@
}
reporter.push('documentationFormat');
try {
- if (obj['documentationFormat'] != null &&
- !((obj['documentationFormat'] is List &&
- (obj['documentationFormat']
+ final documentationFormat = obj['documentationFormat'];
+ if (documentationFormat != null &&
+ !((documentationFormat is List &&
+ (documentationFormat
.every((item) => MarkupKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<MarkupKind>');
return false;
@@ -5321,8 +5564,8 @@
}
reporter.push('deprecatedSupport');
try {
- if (obj['deprecatedSupport'] != null &&
- !(obj['deprecatedSupport'] is bool)) {
+ final deprecatedSupport = obj['deprecatedSupport'];
+ if (deprecatedSupport != null && !(deprecatedSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5331,8 +5574,8 @@
}
reporter.push('preselectSupport');
try {
- if (obj['preselectSupport'] != null &&
- !(obj['preselectSupport'] is bool)) {
+ final preselectSupport = obj['preselectSupport'];
+ if (preselectSupport != null && !(preselectSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5341,9 +5584,10 @@
}
reporter.push('tagSupport');
try {
- if (obj['tagSupport'] != null &&
+ final tagSupport = obj['tagSupport'];
+ if (tagSupport != null &&
!(CompletionClientCapabilitiesTagSupport.canParse(
- obj['tagSupport'], reporter))) {
+ tagSupport, reporter))) {
reporter.reportError(
'must be of type CompletionClientCapabilitiesTagSupport');
return false;
@@ -5353,8 +5597,8 @@
}
reporter.push('insertReplaceSupport');
try {
- if (obj['insertReplaceSupport'] != null &&
- !(obj['insertReplaceSupport'] is bool)) {
+ final insertReplaceSupport = obj['insertReplaceSupport'];
+ if (insertReplaceSupport != null && !(insertReplaceSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5363,9 +5607,10 @@
}
reporter.push('resolveSupport');
try {
- if (obj['resolveSupport'] != null &&
+ final resolveSupport = obj['resolveSupport'];
+ if (resolveSupport != null &&
!(CompletionClientCapabilitiesResolveSupport.canParse(
- obj['resolveSupport'], reporter))) {
+ resolveSupport, reporter))) {
reporter.reportError(
'must be of type CompletionClientCapabilitiesResolveSupport');
return false;
@@ -5375,9 +5620,10 @@
}
reporter.push('insertTextModeSupport');
try {
- if (obj['insertTextModeSupport'] != null &&
+ final insertTextModeSupport = obj['insertTextModeSupport'];
+ if (insertTextModeSupport != null &&
!(CompletionClientCapabilitiesInsertTextModeSupport.canParse(
- obj['insertTextModeSupport'], reporter))) {
+ insertTextModeSupport, reporter))) {
reporter.reportError(
'must be of type CompletionClientCapabilitiesInsertTextModeSupport');
return false;
@@ -5438,11 +5684,11 @@
CompletionClientCapabilitiesCompletionItemKind({this.valueSet});
static CompletionClientCapabilitiesCompletionItemKind fromJson(
- Map<String, dynamic> json) {
- final valueSet = json['valueSet']
- ?.map((item) => item != null ? CompletionItemKind.fromJson(item) : null)
- ?.cast<CompletionItemKind>()
- ?.toList();
+ Map<String, Object?> json) {
+ final valueSetJson = json['valueSet'];
+ final valueSet = (valueSetJson as List<Object?>?)
+ ?.map((item) => CompletionItemKind.fromJson(item as int))
+ .toList();
return CompletionClientCapabilitiesCompletionItemKind(valueSet: valueSet);
}
@@ -5455,8 +5701,8 @@
/// of the protocol.
final List<CompletionItemKind>? valueSet;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (valueSet != null) {
__result['valueSet'] = valueSet?.map((item) => item.toJson()).toList();
}
@@ -5464,12 +5710,13 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('valueSet');
try {
- if (obj['valueSet'] != null &&
- !((obj['valueSet'] is List &&
- (obj['valueSet'].every(
+ final valueSet = obj['valueSet'];
+ if (valueSet != null &&
+ !((valueSet is List &&
+ (valueSet.every(
(item) => CompletionItemKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CompletionItemKind>');
return false;
@@ -5514,37 +5761,38 @@
CompletionClientCapabilitiesInsertTextModeSupport({required this.valueSet});
static CompletionClientCapabilitiesInsertTextModeSupport fromJson(
- Map<String, dynamic> json) {
- final valueSet = json['valueSet']
- ?.map((item) => InsertTextMode.fromJson(item))
- ?.cast<InsertTextMode>()
- ?.toList();
+ Map<String, Object?> json) {
+ final valueSetJson = json['valueSet'];
+ final valueSet = (valueSetJson as List<Object?>)
+ .map((item) => InsertTextMode.fromJson(item as num))
+ .toList();
return CompletionClientCapabilitiesInsertTextModeSupport(
valueSet: valueSet);
}
final List<InsertTextMode> valueSet;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('valueSet');
try {
if (!obj.containsKey('valueSet')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['valueSet'] == null) {
+ final valueSet = obj['valueSet'];
+ if (valueSet == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['valueSet'] is List &&
- (obj['valueSet']
+ if (!((valueSet is List &&
+ (valueSet
.every((item) => InsertTextMode.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<InsertTextMode>');
return false;
@@ -5590,35 +5838,38 @@
CompletionClientCapabilitiesResolveSupport({required this.properties});
static CompletionClientCapabilitiesResolveSupport fromJson(
- Map<String, dynamic> json) {
- final properties =
- json['properties']?.map((item) => item)?.cast<String>()?.toList();
+ Map<String, Object?> json) {
+ final propertiesJson = json['properties'];
+ final properties = (propertiesJson as List<Object?>)
+ .map((item) => item as String)
+ .toList();
return CompletionClientCapabilitiesResolveSupport(properties: properties);
}
/// The properties that a client can resolve lazily.
final List<String> properties;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['properties'] = properties;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('properties');
try {
if (!obj.containsKey('properties')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['properties'] == null) {
+ final properties = obj['properties'];
+ if (properties == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['properties'] is List &&
- (obj['properties'].every((item) => item is String))))) {
+ if (!((properties is List &&
+ (properties.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -5662,37 +5913,38 @@
CompletionClientCapabilitiesTagSupport({required this.valueSet});
static CompletionClientCapabilitiesTagSupport fromJson(
- Map<String, dynamic> json) {
- final valueSet = json['valueSet']
- ?.map((item) => CompletionItemTag.fromJson(item))
- ?.cast<CompletionItemTag>()
- ?.toList();
+ Map<String, Object?> json) {
+ final valueSetJson = json['valueSet'];
+ final valueSet = (valueSetJson as List<Object?>)
+ .map((item) => CompletionItemTag.fromJson(item as int))
+ .toList();
return CompletionClientCapabilitiesTagSupport(valueSet: valueSet);
}
/// The tags supported by the client.
final List<CompletionItemTag> valueSet;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('valueSet');
try {
if (!obj.containsKey('valueSet')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['valueSet'] == null) {
+ final valueSet = obj['valueSet'];
+ if (valueSet == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['valueSet'] is List &&
- (obj['valueSet'].every(
+ if (!((valueSet is List &&
+ (valueSet.every(
(item) => CompletionItemTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CompletionItemTag>');
return false;
@@ -5737,9 +5989,11 @@
LspJsonHandler(CompletionContext.canParse, CompletionContext.fromJson);
CompletionContext({required this.triggerKind, this.triggerCharacter});
- static CompletionContext fromJson(Map<String, dynamic> json) {
- final triggerKind = CompletionTriggerKind.fromJson(json['triggerKind']);
- final triggerCharacter = json['triggerCharacter'];
+ static CompletionContext fromJson(Map<String, Object?> json) {
+ final triggerKindJson = json['triggerKind'];
+ final triggerKind = CompletionTriggerKind.fromJson(triggerKindJson as num);
+ final triggerCharacterJson = json['triggerCharacter'];
+ final triggerCharacter = triggerCharacterJson as String?;
return CompletionContext(
triggerKind: triggerKind, triggerCharacter: triggerCharacter);
}
@@ -5751,8 +6005,8 @@
/// How the completion was triggered.
final CompletionTriggerKind triggerKind;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['triggerKind'] = triggerKind.toJson();
if (triggerCharacter != null) {
__result['triggerCharacter'] = triggerCharacter;
@@ -5761,18 +6015,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('triggerKind');
try {
if (!obj.containsKey('triggerKind')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['triggerKind'] == null) {
+ final triggerKind = obj['triggerKind'];
+ if (triggerKind == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(CompletionTriggerKind.canParse(obj['triggerKind'], reporter))) {
+ if (!(CompletionTriggerKind.canParse(triggerKind, reporter))) {
reporter.reportError('must be of type CompletionTriggerKind');
return false;
}
@@ -5781,8 +6036,8 @@
}
reporter.push('triggerCharacter');
try {
- if (obj['triggerCharacter'] != null &&
- !(obj['triggerCharacter'] is String)) {
+ final triggerCharacter = obj['triggerCharacter'];
+ if (triggerCharacter != null && !(triggerCharacter is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -5840,54 +6095,72 @@
this.commitCharacters,
this.command,
this.data});
- static CompletionItem fromJson(Map<String, dynamic> json) {
- final label = json['label'];
+ static CompletionItem fromJson(Map<String, Object?> json) {
+ final labelJson = json['label'];
+ final label = labelJson as String;
+ final kindJson = json['kind'];
final kind =
- json['kind'] != null ? CompletionItemKind.fromJson(json['kind']) : null;
- final tags = json['tags']
- ?.map((item) => item != null ? CompletionItemTag.fromJson(item) : null)
- ?.cast<CompletionItemTag>()
- ?.toList();
- final detail = json['detail'];
- final documentation = json['documentation'] == null
+ kindJson != null ? CompletionItemKind.fromJson(kindJson as int) : null;
+ final tagsJson = json['tags'];
+ final tags = (tagsJson as List<Object?>?)
+ ?.map((item) => CompletionItemTag.fromJson(item as int))
+ .toList();
+ final detailJson = json['detail'];
+ final detail = detailJson as String?;
+ final documentationJson = json['documentation'];
+ final documentation = documentationJson == null
? null
- : (json['documentation'] is String
- ? Either2<String, MarkupContent>.t1(json['documentation'])
- : (MarkupContent.canParse(
- json['documentation'], nullLspJsonReporter)
- ? Either2<String, MarkupContent>.t2(
- MarkupContent.fromJson(json['documentation']))
- : (throw '''${json['documentation']} was not one of (String, MarkupContent)''')));
- final deprecated = json['deprecated'];
- final preselect = json['preselect'];
- final sortText = json['sortText'];
- final filterText = json['filterText'];
- final insertText = json['insertText'];
- final insertTextFormat = json['insertTextFormat'] != null
- ? InsertTextFormat.fromJson(json['insertTextFormat'])
+ : (documentationJson is String
+ ? Either2<String, MarkupContent>.t1(documentationJson)
+ : (MarkupContent.canParse(documentationJson, nullLspJsonReporter)
+ ? Either2<String, MarkupContent>.t2(MarkupContent.fromJson(
+ documentationJson as Map<String, Object?>))
+ : (throw '''$documentationJson was not one of (String, MarkupContent)''')));
+ final deprecatedJson = json['deprecated'];
+ final deprecated = deprecatedJson as bool?;
+ final preselectJson = json['preselect'];
+ final preselect = preselectJson as bool?;
+ final sortTextJson = json['sortText'];
+ final sortText = sortTextJson as String?;
+ final filterTextJson = json['filterText'];
+ final filterText = filterTextJson as String?;
+ final insertTextJson = json['insertText'];
+ final insertText = insertTextJson as String?;
+ final insertTextFormatJson = json['insertTextFormat'];
+ final insertTextFormat = insertTextFormatJson != null
+ ? InsertTextFormat.fromJson(insertTextFormatJson as int)
: null;
- final insertTextMode = json['insertTextMode'] != null
- ? InsertTextMode.fromJson(json['insertTextMode'])
+ final insertTextModeJson = json['insertTextMode'];
+ final insertTextMode = insertTextModeJson != null
+ ? InsertTextMode.fromJson(insertTextModeJson as num)
: null;
- final textEdit = json['textEdit'] == null
+ final textEditJson = json['textEdit'];
+ final textEdit = textEditJson == null
? null
- : (TextEdit.canParse(json['textEdit'], nullLspJsonReporter)
+ : (TextEdit.canParse(textEditJson, nullLspJsonReporter)
? Either2<TextEdit, InsertReplaceEdit>.t1(
- TextEdit.fromJson(json['textEdit']))
- : (InsertReplaceEdit.canParse(json['textEdit'], nullLspJsonReporter)
+ TextEdit.fromJson(textEditJson as Map<String, Object?>))
+ : (InsertReplaceEdit.canParse(textEditJson, nullLspJsonReporter)
? Either2<TextEdit, InsertReplaceEdit>.t2(
- InsertReplaceEdit.fromJson(json['textEdit']))
- : (throw '''${json['textEdit']} was not one of (TextEdit, InsertReplaceEdit)''')));
- final additionalTextEdits = json['additionalTextEdits']
- ?.map((item) => item != null ? TextEdit.fromJson(item) : null)
- ?.cast<TextEdit>()
- ?.toList();
- final commitCharacters =
- json['commitCharacters']?.map((item) => item)?.cast<String>()?.toList();
- final command =
- json['command'] != null ? Command.fromJson(json['command']) : null;
- final data = json['data'] != null
- ? CompletionItemResolutionInfo.fromJson(json['data'])
+ InsertReplaceEdit.fromJson(
+ textEditJson as Map<String, Object?>))
+ : (throw '''$textEditJson was not one of (TextEdit, InsertReplaceEdit)''')));
+ final additionalTextEditsJson = json['additionalTextEdits'];
+ final additionalTextEdits = (additionalTextEditsJson as List<Object?>?)
+ ?.map((item) => TextEdit.fromJson(item as Map<String, Object?>))
+ .toList();
+ final commitCharactersJson = json['commitCharacters'];
+ final commitCharacters = (commitCharactersJson as List<Object?>?)
+ ?.map((item) => item as String)
+ .toList();
+ final commandJson = json['command'];
+ final command = commandJson != null
+ ? Command.fromJson(commandJson as Map<String, Object?>)
+ : null;
+ final dataJson = json['data'];
+ final data = dataJson != null
+ ? CompletionItemResolutionInfo.fromJson(
+ dataJson as Map<String, Object?>)
: null;
return CompletionItem(
label: label,
@@ -6016,8 +6289,8 @@
/// @since 3.16.0 additional type `InsertReplaceEdit`
final Either2<TextEdit, InsertReplaceEdit>? textEdit;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['label'] = label;
if (kind != null) {
__result['kind'] = kind?.toJson();
@@ -6072,18 +6345,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('label');
try {
if (!obj.containsKey('label')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['label'] == null) {
+ final label = obj['label'];
+ if (label == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['label'] is String)) {
+ if (!(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -6092,8 +6366,8 @@
}
reporter.push('kind');
try {
- if (obj['kind'] != null &&
- !(CompletionItemKind.canParse(obj['kind'], reporter))) {
+ final kind = obj['kind'];
+ if (kind != null && !(CompletionItemKind.canParse(kind, reporter))) {
reporter.reportError('must be of type CompletionItemKind');
return false;
}
@@ -6102,9 +6376,10 @@
}
reporter.push('tags');
try {
- if (obj['tags'] != null &&
- !((obj['tags'] is List &&
- (obj['tags'].every(
+ final tags = obj['tags'];
+ if (tags != null &&
+ !((tags is List &&
+ (tags.every(
(item) => CompletionItemTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CompletionItemTag>');
return false;
@@ -6114,7 +6389,8 @@
}
reporter.push('detail');
try {
- if (obj['detail'] != null && !(obj['detail'] is String)) {
+ final detail = obj['detail'];
+ if (detail != null && !(detail is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -6123,9 +6399,10 @@
}
reporter.push('documentation');
try {
- if (obj['documentation'] != null &&
- !((obj['documentation'] is String ||
- MarkupContent.canParse(obj['documentation'], reporter)))) {
+ final documentation = obj['documentation'];
+ if (documentation != null &&
+ !((documentation is String ||
+ MarkupContent.canParse(documentation, reporter)))) {
reporter
.reportError('must be of type Either2<String, MarkupContent>');
return false;
@@ -6135,7 +6412,8 @@
}
reporter.push('deprecated');
try {
- if (obj['deprecated'] != null && !(obj['deprecated'] is bool)) {
+ final deprecated = obj['deprecated'];
+ if (deprecated != null && !(deprecated is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -6144,7 +6422,8 @@
}
reporter.push('preselect');
try {
- if (obj['preselect'] != null && !(obj['preselect'] is bool)) {
+ final preselect = obj['preselect'];
+ if (preselect != null && !(preselect is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -6153,7 +6432,8 @@
}
reporter.push('sortText');
try {
- if (obj['sortText'] != null && !(obj['sortText'] is String)) {
+ final sortText = obj['sortText'];
+ if (sortText != null && !(sortText is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -6162,7 +6442,8 @@
}
reporter.push('filterText');
try {
- if (obj['filterText'] != null && !(obj['filterText'] is String)) {
+ final filterText = obj['filterText'];
+ if (filterText != null && !(filterText is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -6171,7 +6452,8 @@
}
reporter.push('insertText');
try {
- if (obj['insertText'] != null && !(obj['insertText'] is String)) {
+ final insertText = obj['insertText'];
+ if (insertText != null && !(insertText is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -6180,8 +6462,9 @@
}
reporter.push('insertTextFormat');
try {
- if (obj['insertTextFormat'] != null &&
- !(InsertTextFormat.canParse(obj['insertTextFormat'], reporter))) {
+ final insertTextFormat = obj['insertTextFormat'];
+ if (insertTextFormat != null &&
+ !(InsertTextFormat.canParse(insertTextFormat, reporter))) {
reporter.reportError('must be of type InsertTextFormat');
return false;
}
@@ -6190,8 +6473,9 @@
}
reporter.push('insertTextMode');
try {
- if (obj['insertTextMode'] != null &&
- !(InsertTextMode.canParse(obj['insertTextMode'], reporter))) {
+ final insertTextMode = obj['insertTextMode'];
+ if (insertTextMode != null &&
+ !(InsertTextMode.canParse(insertTextMode, reporter))) {
reporter.reportError('must be of type InsertTextMode');
return false;
}
@@ -6200,9 +6484,10 @@
}
reporter.push('textEdit');
try {
- if (obj['textEdit'] != null &&
- !((TextEdit.canParse(obj['textEdit'], reporter) ||
- InsertReplaceEdit.canParse(obj['textEdit'], reporter)))) {
+ final textEdit = obj['textEdit'];
+ if (textEdit != null &&
+ !((TextEdit.canParse(textEdit, reporter) ||
+ InsertReplaceEdit.canParse(textEdit, reporter)))) {
reporter.reportError(
'must be of type Either2<TextEdit, InsertReplaceEdit>');
return false;
@@ -6212,9 +6497,10 @@
}
reporter.push('additionalTextEdits');
try {
- if (obj['additionalTextEdits'] != null &&
- !((obj['additionalTextEdits'] is List &&
- (obj['additionalTextEdits']
+ final additionalTextEdits = obj['additionalTextEdits'];
+ if (additionalTextEdits != null &&
+ !((additionalTextEdits is List &&
+ (additionalTextEdits
.every((item) => TextEdit.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<TextEdit>');
return false;
@@ -6224,9 +6510,10 @@
}
reporter.push('commitCharacters');
try {
- if (obj['commitCharacters'] != null &&
- !((obj['commitCharacters'] is List &&
- (obj['commitCharacters'].every((item) => item is String))))) {
+ final commitCharacters = obj['commitCharacters'];
+ if (commitCharacters != null &&
+ !((commitCharacters is List &&
+ (commitCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -6235,8 +6522,8 @@
}
reporter.push('command');
try {
- if (obj['command'] != null &&
- !(Command.canParse(obj['command'], reporter))) {
+ final command = obj['command'];
+ if (command != null && !(Command.canParse(command, reporter))) {
reporter.reportError('must be of type Command');
return false;
}
@@ -6245,8 +6532,9 @@
}
reporter.push('data');
try {
- if (obj['data'] != null &&
- !(CompletionItemResolutionInfo.canParse(obj['data'], reporter))) {
+ final data = obj['data'];
+ if (data != null &&
+ !(CompletionItemResolutionInfo.canParse(data, reporter))) {
reporter.reportError('must be of type CompletionItemResolutionInfo');
return false;
}
@@ -6397,12 +6685,13 @@
LspJsonHandler(CompletionList.canParse, CompletionList.fromJson);
CompletionList({required this.isIncomplete, required this.items});
- static CompletionList fromJson(Map<String, dynamic> json) {
- final isIncomplete = json['isIncomplete'];
- final items = json['items']
- ?.map((item) => CompletionItem.fromJson(item))
- ?.cast<CompletionItem>()
- ?.toList();
+ static CompletionList fromJson(Map<String, Object?> json) {
+ final isIncompleteJson = json['isIncomplete'];
+ final isIncomplete = isIncompleteJson as bool;
+ final itemsJson = json['items'];
+ final items = (itemsJson as List<Object?>)
+ .map((item) => CompletionItem.fromJson(item as Map<String, Object?>))
+ .toList();
return CompletionList(isIncomplete: isIncomplete, items: items);
}
@@ -6413,26 +6702,27 @@
/// The completion items.
final List<CompletionItem> items;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['isIncomplete'] = isIncomplete;
__result['items'] = items.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('isIncomplete');
try {
if (!obj.containsKey('isIncomplete')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['isIncomplete'] == null) {
+ final isIncomplete = obj['isIncomplete'];
+ if (isIncomplete == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['isIncomplete'] is bool)) {
+ if (!(isIncomplete is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -6445,12 +6735,13 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['items'] == null) {
+ final items = obj['items'];
+ if (items == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['items'] is List &&
- (obj['items']
+ if (!((items is List &&
+ (items
.every((item) => CompletionItem.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CompletionItem>');
return false;
@@ -6498,20 +6789,22 @@
this.allCommitCharacters,
this.resolveProvider,
this.workDoneProgress});
- static CompletionOptions fromJson(Map<String, dynamic> json) {
+ static CompletionOptions fromJson(Map<String, Object?> json) {
if (CompletionRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return CompletionRegistrationOptions.fromJson(json);
}
- final triggerCharacters = json['triggerCharacters']
- ?.map((item) => item)
- ?.cast<String>()
- ?.toList();
- final allCommitCharacters = json['allCommitCharacters']
- ?.map((item) => item)
- ?.cast<String>()
- ?.toList();
- final resolveProvider = json['resolveProvider'];
- final workDoneProgress = json['workDoneProgress'];
+ final triggerCharactersJson = json['triggerCharacters'];
+ final triggerCharacters = (triggerCharactersJson as List<Object?>?)
+ ?.map((item) => item as String)
+ .toList();
+ final allCommitCharactersJson = json['allCommitCharacters'];
+ final allCommitCharacters = (allCommitCharactersJson as List<Object?>?)
+ ?.map((item) => item as String)
+ .toList();
+ final resolveProviderJson = json['resolveProvider'];
+ final resolveProvider = resolveProviderJson as bool?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return CompletionOptions(
triggerCharacters: triggerCharacters,
allCommitCharacters: allCommitCharacters,
@@ -6546,8 +6839,8 @@
final List<String>? triggerCharacters;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (triggerCharacters != null) {
__result['triggerCharacters'] = triggerCharacters;
}
@@ -6564,12 +6857,13 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('triggerCharacters');
try {
- if (obj['triggerCharacters'] != null &&
- !((obj['triggerCharacters'] is List &&
- (obj['triggerCharacters'].every((item) => item is String))))) {
+ final triggerCharacters = obj['triggerCharacters'];
+ if (triggerCharacters != null &&
+ !((triggerCharacters is List &&
+ (triggerCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -6578,10 +6872,10 @@
}
reporter.push('allCommitCharacters');
try {
- if (obj['allCommitCharacters'] != null &&
- !((obj['allCommitCharacters'] is List &&
- (obj['allCommitCharacters']
- .every((item) => item is String))))) {
+ final allCommitCharacters = obj['allCommitCharacters'];
+ if (allCommitCharacters != null &&
+ !((allCommitCharacters is List &&
+ (allCommitCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -6590,8 +6884,8 @@
}
reporter.push('resolveProvider');
try {
- if (obj['resolveProvider'] != null &&
- !(obj['resolveProvider'] is bool)) {
+ final resolveProvider = obj['resolveProvider'];
+ if (resolveProvider != null && !(resolveProvider is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -6600,8 +6894,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -6658,26 +6952,32 @@
required this.position,
this.workDoneToken,
this.partialResultToken});
- static CompletionParams fromJson(Map<String, dynamic> json) {
- final context = json['context'] != null
- ? CompletionContext.fromJson(json['context'])
+ static CompletionParams fromJson(Map<String, Object?> json) {
+ final contextJson = json['context'];
+ final context = contextJson != null
+ ? CompletionContext.fromJson(contextJson as Map<String, Object?>)
: null;
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
- final workDoneToken = json['workDoneToken'] == null
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return CompletionParams(
context: context,
textDocument: textDocument,
@@ -6703,8 +7003,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (context != null) {
__result['context'] = context?.toJson();
}
@@ -6720,11 +7020,12 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('context');
try {
- if (obj['context'] != null &&
- !(CompletionContext.canParse(obj['context'], reporter))) {
+ final context = obj['context'];
+ if (context != null &&
+ !(CompletionContext.canParse(context, reporter))) {
reporter.reportError('must be of type CompletionContext');
return false;
}
@@ -6737,11 +7038,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -6754,11 +7056,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -6767,9 +7070,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -6778,9 +7081,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -6834,21 +7137,23 @@
this.allCommitCharacters,
this.resolveProvider,
this.workDoneProgress});
- static CompletionRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final triggerCharacters = json['triggerCharacters']
- ?.map((item) => item)
- ?.cast<String>()
- ?.toList();
- final allCommitCharacters = json['allCommitCharacters']
- ?.map((item) => item)
- ?.cast<String>()
- ?.toList();
- final resolveProvider = json['resolveProvider'];
- final workDoneProgress = json['workDoneProgress'];
+ static CompletionRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final triggerCharactersJson = json['triggerCharacters'];
+ final triggerCharacters = (triggerCharactersJson as List<Object?>?)
+ ?.map((item) => item as String)
+ .toList();
+ final allCommitCharactersJson = json['allCommitCharacters'];
+ final allCommitCharacters = (allCommitCharactersJson as List<Object?>?)
+ ?.map((item) => item as String)
+ .toList();
+ final resolveProviderJson = json['resolveProvider'];
+ final resolveProvider = resolveProviderJson as bool?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return CompletionRegistrationOptions(
documentSelector: documentSelector,
triggerCharacters: triggerCharacters,
@@ -6888,8 +7193,8 @@
final List<String>? triggerCharacters;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (triggerCharacters != null) {
__result['triggerCharacters'] = triggerCharacters;
@@ -6907,16 +7212,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -6926,9 +7232,10 @@
}
reporter.push('triggerCharacters');
try {
- if (obj['triggerCharacters'] != null &&
- !((obj['triggerCharacters'] is List &&
- (obj['triggerCharacters'].every((item) => item is String))))) {
+ final triggerCharacters = obj['triggerCharacters'];
+ if (triggerCharacters != null &&
+ !((triggerCharacters is List &&
+ (triggerCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -6937,10 +7244,10 @@
}
reporter.push('allCommitCharacters');
try {
- if (obj['allCommitCharacters'] != null &&
- !((obj['allCommitCharacters'] is List &&
- (obj['allCommitCharacters']
- .every((item) => item is String))))) {
+ final allCommitCharacters = obj['allCommitCharacters'];
+ if (allCommitCharacters != null &&
+ !((allCommitCharacters is List &&
+ (allCommitCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -6949,8 +7256,8 @@
}
reporter.push('resolveProvider');
try {
- if (obj['resolveProvider'] != null &&
- !(obj['resolveProvider'] is bool)) {
+ final resolveProvider = obj['resolveProvider'];
+ if (resolveProvider != null && !(resolveProvider is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -6959,8 +7266,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7051,9 +7358,11 @@
LspJsonHandler(ConfigurationItem.canParse, ConfigurationItem.fromJson);
ConfigurationItem({this.scopeUri, this.section});
- static ConfigurationItem fromJson(Map<String, dynamic> json) {
- final scopeUri = json['scopeUri'];
- final section = json['section'];
+ static ConfigurationItem fromJson(Map<String, Object?> json) {
+ final scopeUriJson = json['scopeUri'];
+ final scopeUri = scopeUriJson as String?;
+ final sectionJson = json['section'];
+ final section = sectionJson as String?;
return ConfigurationItem(scopeUri: scopeUri, section: section);
}
@@ -7063,8 +7372,8 @@
/// The configuration section asked for.
final String? section;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (scopeUri != null) {
__result['scopeUri'] = scopeUri;
}
@@ -7075,10 +7384,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('scopeUri');
try {
- if (obj['scopeUri'] != null && !(obj['scopeUri'] is String)) {
+ final scopeUri = obj['scopeUri'];
+ if (scopeUri != null && !(scopeUri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -7087,7 +7397,8 @@
}
reporter.push('section');
try {
- if (obj['section'] != null && !(obj['section'] is String)) {
+ final section = obj['section'];
+ if (section != null && !(section is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -7126,36 +7437,37 @@
ConfigurationParams.canParse, ConfigurationParams.fromJson);
ConfigurationParams({required this.items});
- static ConfigurationParams fromJson(Map<String, dynamic> json) {
- final items = json['items']
- ?.map((item) => ConfigurationItem.fromJson(item))
- ?.cast<ConfigurationItem>()
- ?.toList();
+ static ConfigurationParams fromJson(Map<String, Object?> json) {
+ final itemsJson = json['items'];
+ final items = (itemsJson as List<Object?>)
+ .map((item) => ConfigurationItem.fromJson(item as Map<String, Object?>))
+ .toList();
return ConfigurationParams(items: items);
}
final List<ConfigurationItem> items;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['items'] = items.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('items');
try {
if (!obj.containsKey('items')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['items'] == null) {
+ final items = obj['items'];
+ if (items == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['items'] is List &&
- (obj['items'].every(
+ if (!((items is List &&
+ (items.every(
(item) => ConfigurationItem.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<ConfigurationItem>');
return false;
@@ -7206,13 +7518,17 @@
throw 'kind may only be the literal \'create\'';
}
}
- static CreateFile fromJson(Map<String, dynamic> json) {
- final kind = json['kind'];
- final uri = json['uri'];
- final options = json['options'] != null
- ? CreateFileOptions.fromJson(json['options'])
+ static CreateFile fromJson(Map<String, Object?> json) {
+ final kindJson = json['kind'];
+ final kind = kindJson as String;
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
+ final optionsJson = json['options'];
+ final options = optionsJson != null
+ ? CreateFileOptions.fromJson(optionsJson as Map<String, Object?>)
: null;
- final annotationId = json['annotationId'];
+ final annotationIdJson = json['annotationId'];
+ final annotationId = annotationIdJson as String?;
return CreateFile(
kind: kind, uri: uri, options: options, annotationId: annotationId);
}
@@ -7230,8 +7546,8 @@
/// The resource to create.
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['kind'] = kind;
__result['uri'] = uri;
if (options != null) {
@@ -7244,18 +7560,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('kind');
try {
if (!obj.containsKey('kind')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['kind'] == null) {
+ final kind = obj['kind'];
+ if (kind == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['kind'] == 'create')) {
+ if (!(kind == 'create')) {
reporter.reportError('must be the literal \'create\'');
return false;
}
@@ -7268,11 +7585,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -7281,8 +7599,9 @@
}
reporter.push('options');
try {
- if (obj['options'] != null &&
- !(CreateFileOptions.canParse(obj['options'], reporter))) {
+ final options = obj['options'];
+ if (options != null &&
+ !(CreateFileOptions.canParse(options, reporter))) {
reporter.reportError('must be of type CreateFileOptions');
return false;
}
@@ -7291,7 +7610,8 @@
}
reporter.push('annotationId');
try {
- if (obj['annotationId'] != null && !(obj['annotationId'] is String)) {
+ final annotationId = obj['annotationId'];
+ if (annotationId != null && !(annotationId is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -7337,9 +7657,11 @@
LspJsonHandler(CreateFileOptions.canParse, CreateFileOptions.fromJson);
CreateFileOptions({this.overwrite, this.ignoreIfExists});
- static CreateFileOptions fromJson(Map<String, dynamic> json) {
- final overwrite = json['overwrite'];
- final ignoreIfExists = json['ignoreIfExists'];
+ static CreateFileOptions fromJson(Map<String, Object?> json) {
+ final overwriteJson = json['overwrite'];
+ final overwrite = overwriteJson as bool?;
+ final ignoreIfExistsJson = json['ignoreIfExists'];
+ final ignoreIfExists = ignoreIfExistsJson as bool?;
return CreateFileOptions(
overwrite: overwrite, ignoreIfExists: ignoreIfExists);
}
@@ -7350,8 +7672,8 @@
/// Overwrite existing file. Overwrite wins over `ignoreIfExists`
final bool? overwrite;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (overwrite != null) {
__result['overwrite'] = overwrite;
}
@@ -7362,10 +7684,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('overwrite');
try {
- if (obj['overwrite'] != null && !(obj['overwrite'] is bool)) {
+ final overwrite = obj['overwrite'];
+ if (overwrite != null && !(overwrite is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7374,7 +7697,8 @@
}
reporter.push('ignoreIfExists');
try {
- if (obj['ignoreIfExists'] != null && !(obj['ignoreIfExists'] is bool)) {
+ final ignoreIfExists = obj['ignoreIfExists'];
+ if (ignoreIfExists != null && !(ignoreIfExists is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7418,38 +7742,38 @@
LspJsonHandler(CreateFilesParams.canParse, CreateFilesParams.fromJson);
CreateFilesParams({required this.files});
- static CreateFilesParams fromJson(Map<String, dynamic> json) {
- final files = json['files']
- ?.map((item) => FileCreate.fromJson(item))
- ?.cast<FileCreate>()
- ?.toList();
+ static CreateFilesParams fromJson(Map<String, Object?> json) {
+ final filesJson = json['files'];
+ final files = (filesJson as List<Object?>)
+ .map((item) => FileCreate.fromJson(item as Map<String, Object?>))
+ .toList();
return CreateFilesParams(files: files);
}
/// An array of all files/folders created in this operation.
final List<FileCreate> files;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['files'] = files.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('files');
try {
if (!obj.containsKey('files')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['files'] == null) {
+ final files = obj['files'];
+ if (files == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['files'] is List &&
- (obj['files']
- .every((item) => FileCreate.canParse(item, reporter)))))) {
+ if (!((files is List &&
+ (files.every((item) => FileCreate.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileCreate>');
return false;
}
@@ -7490,9 +7814,11 @@
DeclarationClientCapabilities.fromJson);
DeclarationClientCapabilities({this.dynamicRegistration, this.linkSupport});
- static DeclarationClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final linkSupport = json['linkSupport'];
+ static DeclarationClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final linkSupportJson = json['linkSupport'];
+ final linkSupport = linkSupportJson as bool?;
return DeclarationClientCapabilities(
dynamicRegistration: dynamicRegistration, linkSupport: linkSupport);
}
@@ -7505,8 +7831,8 @@
/// The client supports additional metadata in the form of declaration links.
final bool? linkSupport;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -7517,11 +7843,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7530,7 +7856,8 @@
}
reporter.push('linkSupport');
try {
- if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) {
+ final linkSupport = obj['linkSupport'];
+ if (linkSupport != null && !(linkSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7572,18 +7899,19 @@
LspJsonHandler(DeclarationOptions.canParse, DeclarationOptions.fromJson);
DeclarationOptions({this.workDoneProgress});
- static DeclarationOptions fromJson(Map<String, dynamic> json) {
+ static DeclarationOptions fromJson(Map<String, Object?> json) {
if (DeclarationRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return DeclarationRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DeclarationOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -7591,11 +7919,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7643,23 +7971,28 @@
required this.position,
this.workDoneToken,
this.partialResultToken});
- static DeclarationParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
- final workDoneToken = json['workDoneToken'] == null
+ static DeclarationParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return DeclarationParams(
textDocument: textDocument,
position: position,
@@ -7680,8 +8013,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
if (workDoneToken != null) {
@@ -7694,18 +8027,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -7718,11 +8052,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -7731,9 +8066,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -7742,9 +8077,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -7796,13 +8131,15 @@
DeclarationRegistrationOptions(
{this.workDoneProgress, this.documentSelector, this.id});
- static DeclarationRegistrationOptions fromJson(Map<String, dynamic> json) {
- final workDoneProgress = json['workDoneProgress'];
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final id = json['id'];
+ static DeclarationRegistrationOptions fromJson(Map<String, Object?> json) {
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final idJson = json['id'];
+ final id = idJson as String?;
return DeclarationRegistrationOptions(
workDoneProgress: workDoneProgress,
documentSelector: documentSelector,
@@ -7818,8 +8155,8 @@
final String? id;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -7831,11 +8168,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7848,9 +8185,10 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -7860,7 +8198,8 @@
}
reporter.push('id');
try {
- if (obj['id'] != null && !(obj['id'] is String)) {
+ final id = obj['id'];
+ if (id != null && !(id is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -7906,9 +8245,11 @@
DefinitionClientCapabilities.fromJson);
DefinitionClientCapabilities({this.dynamicRegistration, this.linkSupport});
- static DefinitionClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final linkSupport = json['linkSupport'];
+ static DefinitionClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final linkSupportJson = json['linkSupport'];
+ final linkSupport = linkSupportJson as bool?;
return DefinitionClientCapabilities(
dynamicRegistration: dynamicRegistration, linkSupport: linkSupport);
}
@@ -7920,8 +8261,8 @@
/// @since 3.14.0
final bool? linkSupport;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -7932,11 +8273,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7945,7 +8286,8 @@
}
reporter.push('linkSupport');
try {
- if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) {
+ final linkSupport = obj['linkSupport'];
+ if (linkSupport != null && !(linkSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7987,18 +8329,19 @@
LspJsonHandler(DefinitionOptions.canParse, DefinitionOptions.fromJson);
DefinitionOptions({this.workDoneProgress});
- static DefinitionOptions fromJson(Map<String, dynamic> json) {
+ static DefinitionOptions fromJson(Map<String, Object?> json) {
if (DefinitionRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return DefinitionRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DefinitionOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -8006,11 +8349,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8057,23 +8400,28 @@
required this.position,
this.workDoneToken,
this.partialResultToken});
- static DefinitionParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
- final workDoneToken = json['workDoneToken'] == null
+ static DefinitionParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return DefinitionParams(
textDocument: textDocument,
position: position,
@@ -8094,8 +8442,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
if (workDoneToken != null) {
@@ -8108,18 +8456,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -8132,11 +8481,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -8145,9 +8495,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -8156,9 +8506,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -8205,12 +8555,13 @@
DefinitionRegistrationOptions.fromJson);
DefinitionRegistrationOptions({this.documentSelector, this.workDoneProgress});
- static DefinitionRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
+ static DefinitionRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DefinitionRegistrationOptions(
documentSelector: documentSelector, workDoneProgress: workDoneProgress);
}
@@ -8220,8 +8571,8 @@
final List<DocumentFilter>? documentSelector;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -8230,16 +8581,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -8249,8 +8601,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8302,13 +8654,17 @@
throw 'kind may only be the literal \'delete\'';
}
}
- static DeleteFile fromJson(Map<String, dynamic> json) {
- final kind = json['kind'];
- final uri = json['uri'];
- final options = json['options'] != null
- ? DeleteFileOptions.fromJson(json['options'])
+ static DeleteFile fromJson(Map<String, Object?> json) {
+ final kindJson = json['kind'];
+ final kind = kindJson as String;
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
+ final optionsJson = json['options'];
+ final options = optionsJson != null
+ ? DeleteFileOptions.fromJson(optionsJson as Map<String, Object?>)
: null;
- final annotationId = json['annotationId'];
+ final annotationIdJson = json['annotationId'];
+ final annotationId = annotationIdJson as String?;
return DeleteFile(
kind: kind, uri: uri, options: options, annotationId: annotationId);
}
@@ -8326,8 +8682,8 @@
/// The file to delete.
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['kind'] = kind;
__result['uri'] = uri;
if (options != null) {
@@ -8340,18 +8696,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('kind');
try {
if (!obj.containsKey('kind')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['kind'] == null) {
+ final kind = obj['kind'];
+ if (kind == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['kind'] == 'delete')) {
+ if (!(kind == 'delete')) {
reporter.reportError('must be the literal \'delete\'');
return false;
}
@@ -8364,11 +8721,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -8377,8 +8735,9 @@
}
reporter.push('options');
try {
- if (obj['options'] != null &&
- !(DeleteFileOptions.canParse(obj['options'], reporter))) {
+ final options = obj['options'];
+ if (options != null &&
+ !(DeleteFileOptions.canParse(options, reporter))) {
reporter.reportError('must be of type DeleteFileOptions');
return false;
}
@@ -8387,7 +8746,8 @@
}
reporter.push('annotationId');
try {
- if (obj['annotationId'] != null && !(obj['annotationId'] is String)) {
+ final annotationId = obj['annotationId'];
+ if (annotationId != null && !(annotationId is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -8433,9 +8793,11 @@
LspJsonHandler(DeleteFileOptions.canParse, DeleteFileOptions.fromJson);
DeleteFileOptions({this.recursive, this.ignoreIfNotExists});
- static DeleteFileOptions fromJson(Map<String, dynamic> json) {
- final recursive = json['recursive'];
- final ignoreIfNotExists = json['ignoreIfNotExists'];
+ static DeleteFileOptions fromJson(Map<String, Object?> json) {
+ final recursiveJson = json['recursive'];
+ final recursive = recursiveJson as bool?;
+ final ignoreIfNotExistsJson = json['ignoreIfNotExists'];
+ final ignoreIfNotExists = ignoreIfNotExistsJson as bool?;
return DeleteFileOptions(
recursive: recursive, ignoreIfNotExists: ignoreIfNotExists);
}
@@ -8446,8 +8808,8 @@
/// Delete the content recursively if a folder is denoted.
final bool? recursive;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (recursive != null) {
__result['recursive'] = recursive;
}
@@ -8458,10 +8820,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('recursive');
try {
- if (obj['recursive'] != null && !(obj['recursive'] is bool)) {
+ final recursive = obj['recursive'];
+ if (recursive != null && !(recursive is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8470,8 +8833,8 @@
}
reporter.push('ignoreIfNotExists');
try {
- if (obj['ignoreIfNotExists'] != null &&
- !(obj['ignoreIfNotExists'] is bool)) {
+ final ignoreIfNotExists = obj['ignoreIfNotExists'];
+ if (ignoreIfNotExists != null && !(ignoreIfNotExists is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8515,38 +8878,38 @@
LspJsonHandler(DeleteFilesParams.canParse, DeleteFilesParams.fromJson);
DeleteFilesParams({required this.files});
- static DeleteFilesParams fromJson(Map<String, dynamic> json) {
- final files = json['files']
- ?.map((item) => FileDelete.fromJson(item))
- ?.cast<FileDelete>()
- ?.toList();
+ static DeleteFilesParams fromJson(Map<String, Object?> json) {
+ final filesJson = json['files'];
+ final files = (filesJson as List<Object?>)
+ .map((item) => FileDelete.fromJson(item as Map<String, Object?>))
+ .toList();
return DeleteFilesParams(files: files);
}
/// An array of all files/folders deleted in this operation.
final List<FileDelete> files;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['files'] = files.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('files');
try {
if (!obj.containsKey('files')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['files'] == null) {
+ final files = obj['files'];
+ if (files == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['files'] is List &&
- (obj['files']
- .every((item) => FileDelete.canParse(item, reporter)))))) {
+ if (!((files is List &&
+ (files.every((item) => FileDelete.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileDelete>');
return false;
}
@@ -8595,27 +8958,34 @@
this.tags,
this.relatedInformation,
this.data});
- static Diagnostic fromJson(Map<String, dynamic> json) {
- final range = Range.fromJson(json['range']);
- final severity = json['severity'] != null
- ? DiagnosticSeverity.fromJson(json['severity'])
+ static Diagnostic fromJson(Map<String, Object?> json) {
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final severityJson = json['severity'];
+ final severity = severityJson != null
+ ? DiagnosticSeverity.fromJson(severityJson as num)
: null;
- final code = json['code'];
- final codeDescription = json['codeDescription'] != null
- ? CodeDescription.fromJson(json['codeDescription'])
+ final codeJson = json['code'];
+ final code = codeJson as String?;
+ final codeDescriptionJson = json['codeDescription'];
+ final codeDescription = codeDescriptionJson != null
+ ? CodeDescription.fromJson(codeDescriptionJson as Map<String, Object?>)
: null;
- final source = json['source'];
- final message = json['message'];
- final tags = json['tags']
- ?.map((item) => item != null ? DiagnosticTag.fromJson(item) : null)
- ?.cast<DiagnosticTag>()
- ?.toList();
- final relatedInformation = json['relatedInformation']
+ final sourceJson = json['source'];
+ final source = sourceJson as String?;
+ final messageJson = json['message'];
+ final message = messageJson as String;
+ final tagsJson = json['tags'];
+ final tags = (tagsJson as List<Object?>?)
+ ?.map((item) => DiagnosticTag.fromJson(item as num))
+ .toList();
+ final relatedInformationJson = json['relatedInformation'];
+ final relatedInformation = (relatedInformationJson as List<Object?>?)
?.map((item) =>
- item != null ? DiagnosticRelatedInformation.fromJson(item) : null)
- ?.cast<DiagnosticRelatedInformation>()
- ?.toList();
- final data = json['data'];
+ DiagnosticRelatedInformation.fromJson(item as Map<String, Object?>))
+ .toList();
+ final dataJson = json['data'];
+ final data = dataJson;
return Diagnostic(
range: range,
severity: severity,
@@ -8639,7 +9009,7 @@
/// `textDocument/publishDiagnostics` notification and
/// `textDocument/codeAction` request.
/// @since 3.16.0
- final dynamic data;
+ final Object? data;
/// The diagnostic's message.
final String message;
@@ -8663,8 +9033,8 @@
/// @since 3.15.0
final List<DiagnosticTag>? tags;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['range'] = range.toJson();
if (severity != null) {
__result['severity'] = severity?.toJson();
@@ -8693,18 +9063,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('range');
try {
if (!obj.containsKey('range')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -8713,8 +9084,9 @@
}
reporter.push('severity');
try {
- if (obj['severity'] != null &&
- !(DiagnosticSeverity.canParse(obj['severity'], reporter))) {
+ final severity = obj['severity'];
+ if (severity != null &&
+ !(DiagnosticSeverity.canParse(severity, reporter))) {
reporter.reportError('must be of type DiagnosticSeverity');
return false;
}
@@ -8723,7 +9095,8 @@
}
reporter.push('code');
try {
- if (obj['code'] != null && !(obj['code'] is String)) {
+ final code = obj['code'];
+ if (code != null && !(code is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -8732,8 +9105,9 @@
}
reporter.push('codeDescription');
try {
- if (obj['codeDescription'] != null &&
- !(CodeDescription.canParse(obj['codeDescription'], reporter))) {
+ final codeDescription = obj['codeDescription'];
+ if (codeDescription != null &&
+ !(CodeDescription.canParse(codeDescription, reporter))) {
reporter.reportError('must be of type CodeDescription');
return false;
}
@@ -8742,7 +9116,8 @@
}
reporter.push('source');
try {
- if (obj['source'] != null && !(obj['source'] is String)) {
+ final source = obj['source'];
+ if (source != null && !(source is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -8755,11 +9130,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['message'] == null) {
+ final message = obj['message'];
+ if (message == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['message'] is String)) {
+ if (!(message is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -8768,9 +9144,10 @@
}
reporter.push('tags');
try {
- if (obj['tags'] != null &&
- !((obj['tags'] is List &&
- (obj['tags'].every(
+ final tags = obj['tags'];
+ if (tags != null &&
+ !((tags is List &&
+ (tags.every(
(item) => DiagnosticTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DiagnosticTag>');
return false;
@@ -8780,9 +9157,10 @@
}
reporter.push('relatedInformation');
try {
- if (obj['relatedInformation'] != null &&
- !((obj['relatedInformation'] is List &&
- (obj['relatedInformation'].every((item) =>
+ final relatedInformation = obj['relatedInformation'];
+ if (relatedInformation != null &&
+ !((relatedInformation is List &&
+ (relatedInformation.every((item) =>
DiagnosticRelatedInformation.canParse(item, reporter)))))) {
reporter.reportError(
'must be of type List<DiagnosticRelatedInformation>');
@@ -8849,9 +9227,11 @@
DiagnosticRelatedInformation.fromJson);
DiagnosticRelatedInformation({required this.location, required this.message});
- static DiagnosticRelatedInformation fromJson(Map<String, dynamic> json) {
- final location = Location.fromJson(json['location']);
- final message = json['message'];
+ static DiagnosticRelatedInformation fromJson(Map<String, Object?> json) {
+ final locationJson = json['location'];
+ final location = Location.fromJson(locationJson as Map<String, Object?>);
+ final messageJson = json['message'];
+ final message = messageJson as String;
return DiagnosticRelatedInformation(location: location, message: message);
}
@@ -8861,26 +9241,27 @@
/// The message of this related diagnostic information.
final String message;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['location'] = location.toJson();
__result['message'] = message;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('location');
try {
if (!obj.containsKey('location')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['location'] == null) {
+ final location = obj['location'];
+ if (location == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Location.canParse(obj['location'], reporter))) {
+ if (!(Location.canParse(location, reporter))) {
reporter.reportError('must be of type Location');
return false;
}
@@ -8893,11 +9274,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['message'] == null) {
+ final message = obj['message'];
+ if (message == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['message'] is String)) {
+ if (!(message is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -9006,8 +9388,9 @@
DidChangeConfigurationClientCapabilities({this.dynamicRegistration});
static DidChangeConfigurationClientCapabilities fromJson(
- Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return DidChangeConfigurationClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -9015,8 +9398,8 @@
/// Did change configuration notification supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -9024,11 +9407,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9069,22 +9452,23 @@
DidChangeConfigurationParams.fromJson);
DidChangeConfigurationParams({this.settings});
- static DidChangeConfigurationParams fromJson(Map<String, dynamic> json) {
- final settings = json['settings'];
+ static DidChangeConfigurationParams fromJson(Map<String, Object?> json) {
+ final settingsJson = json['settings'];
+ final settings = settingsJson;
return DidChangeConfigurationParams(settings: settings);
}
/// The actual changed settings
- final dynamic settings;
+ final Object? settings;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['settings'] = settings;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
return true;
} else {
reporter.reportError('must be of type DidChangeConfigurationParams');
@@ -9119,22 +9503,23 @@
DidChangeTextDocumentParams(
{required this.textDocument, required this.contentChanges});
- static DidChangeTextDocumentParams fromJson(Map<String, dynamic> json) {
- final textDocument =
- VersionedTextDocumentIdentifier.fromJson(json['textDocument']);
- final contentChanges = json['contentChanges']
- ?.map((item) => TextDocumentContentChangeEvent1.canParse(
+ static DidChangeTextDocumentParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = VersionedTextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final contentChangesJson = json['contentChanges'];
+ final contentChanges = (contentChangesJson as List<Object?>)
+ .map((item) => TextDocumentContentChangeEvent1.canParse(
item, nullLspJsonReporter)
- ? Either2<TextDocumentContentChangeEvent1,
- TextDocumentContentChangeEvent2>.t1(
- TextDocumentContentChangeEvent1.fromJson(item))
+ ? Either2<TextDocumentContentChangeEvent1, TextDocumentContentChangeEvent2>.t1(
+ TextDocumentContentChangeEvent1.fromJson(
+ item as Map<String, Object?>))
: (TextDocumentContentChangeEvent2.canParse(item, nullLspJsonReporter)
? Either2<TextDocumentContentChangeEvent1,
TextDocumentContentChangeEvent2>.t2(
- TextDocumentContentChangeEvent2.fromJson(item))
+ TextDocumentContentChangeEvent2.fromJson(item as Map<String, Object?>))
: (throw '''$item was not one of (TextDocumentContentChangeEvent1, TextDocumentContentChangeEvent2)''')))
- ?.cast<Either2<TextDocumentContentChangeEvent1, TextDocumentContentChangeEvent2>>()
- ?.toList();
+ .toList();
return DidChangeTextDocumentParams(
textDocument: textDocument, contentChanges: contentChanges);
}
@@ -9160,27 +9545,28 @@
/// after all provided content changes have been applied.
final VersionedTextDocumentIdentifier textDocument;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['contentChanges'] = contentChanges;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
if (!(VersionedTextDocumentIdentifier.canParse(
- obj['textDocument'], reporter))) {
+ textDocument, reporter))) {
reporter
.reportError('must be of type VersionedTextDocumentIdentifier');
return false;
@@ -9194,12 +9580,13 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['contentChanges'] == null) {
+ final contentChanges = obj['contentChanges'];
+ if (contentChanges == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['contentChanges'] is List &&
- (obj['contentChanges'].every((item) =>
+ if (!((contentChanges is List &&
+ (contentChanges.every((item) =>
(TextDocumentContentChangeEvent1.canParse(item, reporter) ||
TextDocumentContentChangeEvent2.canParse(
item, reporter))))))) {
@@ -9256,8 +9643,9 @@
DidChangeWatchedFilesClientCapabilities({this.dynamicRegistration});
static DidChangeWatchedFilesClientCapabilities fromJson(
- Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return DidChangeWatchedFilesClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -9267,8 +9655,8 @@
/// for file changes from the server side.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -9276,11 +9664,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9321,38 +9709,38 @@
DidChangeWatchedFilesParams.fromJson);
DidChangeWatchedFilesParams({required this.changes});
- static DidChangeWatchedFilesParams fromJson(Map<String, dynamic> json) {
- final changes = json['changes']
- ?.map((item) => FileEvent.fromJson(item))
- ?.cast<FileEvent>()
- ?.toList();
+ static DidChangeWatchedFilesParams fromJson(Map<String, Object?> json) {
+ final changesJson = json['changes'];
+ final changes = (changesJson as List<Object?>)
+ .map((item) => FileEvent.fromJson(item as Map<String, Object?>))
+ .toList();
return DidChangeWatchedFilesParams(changes: changes);
}
/// The actual file events.
final List<FileEvent> changes;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['changes'] = changes.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('changes');
try {
if (!obj.containsKey('changes')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['changes'] == null) {
+ final changes = obj['changes'];
+ if (changes == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['changes'] is List &&
- (obj['changes']
- .every((item) => FileEvent.canParse(item, reporter)))))) {
+ if (!((changes is List &&
+ (changes.every((item) => FileEvent.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileEvent>');
return false;
}
@@ -9396,37 +9784,38 @@
DidChangeWatchedFilesRegistrationOptions({required this.watchers});
static DidChangeWatchedFilesRegistrationOptions fromJson(
- Map<String, dynamic> json) {
- final watchers = json['watchers']
- ?.map((item) => FileSystemWatcher.fromJson(item))
- ?.cast<FileSystemWatcher>()
- ?.toList();
+ Map<String, Object?> json) {
+ final watchersJson = json['watchers'];
+ final watchers = (watchersJson as List<Object?>)
+ .map((item) => FileSystemWatcher.fromJson(item as Map<String, Object?>))
+ .toList();
return DidChangeWatchedFilesRegistrationOptions(watchers: watchers);
}
/// The watchers to register.
final List<FileSystemWatcher> watchers;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['watchers'] = watchers.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('watchers');
try {
if (!obj.containsKey('watchers')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['watchers'] == null) {
+ final watchers = obj['watchers'];
+ if (watchers == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['watchers'] is List &&
- (obj['watchers'].every(
+ if (!((watchers is List &&
+ (watchers.every(
(item) => FileSystemWatcher.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileSystemWatcher>');
return false;
@@ -9470,33 +9859,36 @@
DidChangeWorkspaceFoldersParams.fromJson);
DidChangeWorkspaceFoldersParams({required this.event});
- static DidChangeWorkspaceFoldersParams fromJson(Map<String, dynamic> json) {
- final event = WorkspaceFoldersChangeEvent.fromJson(json['event']);
+ static DidChangeWorkspaceFoldersParams fromJson(Map<String, Object?> json) {
+ final eventJson = json['event'];
+ final event =
+ WorkspaceFoldersChangeEvent.fromJson(eventJson as Map<String, Object?>);
return DidChangeWorkspaceFoldersParams(event: event);
}
/// The actual workspace folder change event.
final WorkspaceFoldersChangeEvent event;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['event'] = event.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('event');
try {
if (!obj.containsKey('event')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['event'] == null) {
+ final event = obj['event'];
+ if (event == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(WorkspaceFoldersChangeEvent.canParse(obj['event'], reporter))) {
+ if (!(WorkspaceFoldersChangeEvent.canParse(event, reporter))) {
reporter.reportError('must be of type WorkspaceFoldersChangeEvent');
return false;
}
@@ -9535,33 +9927,36 @@
DidCloseTextDocumentParams.canParse, DidCloseTextDocumentParams.fromJson);
DidCloseTextDocumentParams({required this.textDocument});
- static DidCloseTextDocumentParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+ static DidCloseTextDocumentParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
return DidCloseTextDocumentParams(textDocument: textDocument);
}
/// The document that was closed.
final TextDocumentIdentifier textDocument;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -9600,33 +9995,36 @@
DidOpenTextDocumentParams.canParse, DidOpenTextDocumentParams.fromJson);
DidOpenTextDocumentParams({required this.textDocument});
- static DidOpenTextDocumentParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentItem.fromJson(json['textDocument']);
+ static DidOpenTextDocumentParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument =
+ TextDocumentItem.fromJson(textDocumentJson as Map<String, Object?>);
return DidOpenTextDocumentParams(textDocument: textDocument);
}
/// The document that was opened.
final TextDocumentItem textDocument;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentItem.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentItem.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentItem');
return false;
}
@@ -9665,9 +10063,12 @@
DidSaveTextDocumentParams.canParse, DidSaveTextDocumentParams.fromJson);
DidSaveTextDocumentParams({required this.textDocument, this.text});
- static DidSaveTextDocumentParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final text = json['text'];
+ static DidSaveTextDocumentParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final textJson = json['text'];
+ final text = textJson as String?;
return DidSaveTextDocumentParams(textDocument: textDocument, text: text);
}
@@ -9678,8 +10079,8 @@
/// The document that was saved.
final TextDocumentIdentifier textDocument;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
if (text != null) {
__result['text'] = text;
@@ -9688,18 +10089,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -9708,7 +10110,8 @@
}
reporter.push('text');
try {
- if (obj['text'] != null && !(obj['text'] is String)) {
+ final text = obj['text'];
+ if (text != null && !(text is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -9749,8 +10152,9 @@
DocumentColorClientCapabilities.fromJson);
DocumentColorClientCapabilities({this.dynamicRegistration});
- static DocumentColorClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ static DocumentColorClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return DocumentColorClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -9758,8 +10162,8 @@
/// Whether document color supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -9767,11 +10171,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9810,18 +10214,19 @@
DocumentColorOptions.canParse, DocumentColorOptions.fromJson);
DocumentColorOptions({this.workDoneProgress});
- static DocumentColorOptions fromJson(Map<String, dynamic> json) {
+ static DocumentColorOptions fromJson(Map<String, Object?> json) {
if (DocumentColorRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return DocumentColorRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentColorOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -9829,11 +10234,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9876,22 +10281,26 @@
{required this.textDocument,
this.workDoneToken,
this.partialResultToken});
- static DocumentColorParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final workDoneToken = json['workDoneToken'] == null
+ static DocumentColorParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return DocumentColorParams(
textDocument: textDocument,
workDoneToken: workDoneToken,
@@ -9908,8 +10317,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
@@ -9921,18 +10330,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -9941,9 +10351,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -9952,9 +10362,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -10005,13 +10415,15 @@
DocumentColorRegistrationOptions(
{this.documentSelector, this.id, this.workDoneProgress});
- static DocumentColorRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final id = json['id'];
- final workDoneProgress = json['workDoneProgress'];
+ static DocumentColorRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final idJson = json['id'];
+ final id = idJson as String?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentColorRegistrationOptions(
documentSelector: documentSelector,
id: id,
@@ -10027,8 +10439,8 @@
final String? id;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (id != null) {
__result['id'] = id;
@@ -10040,16 +10452,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -10059,7 +10472,8 @@
}
reporter.push('id');
try {
- if (obj['id'] != null && !(obj['id'] is String)) {
+ final id = obj['id'];
+ if (id != null && !(id is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -10068,8 +10482,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10114,10 +10528,13 @@
LspJsonHandler(DocumentFilter.canParse, DocumentFilter.fromJson);
DocumentFilter({this.language, this.scheme, this.pattern});
- static DocumentFilter fromJson(Map<String, dynamic> json) {
- final language = json['language'];
- final scheme = json['scheme'];
- final pattern = json['pattern'];
+ static DocumentFilter fromJson(Map<String, Object?> json) {
+ final languageJson = json['language'];
+ final language = languageJson as String?;
+ final schemeJson = json['scheme'];
+ final scheme = schemeJson as String?;
+ final patternJson = json['pattern'];
+ final pattern = patternJson as String?;
return DocumentFilter(language: language, scheme: scheme, pattern: pattern);
}
@@ -10142,8 +10559,8 @@
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
final String? scheme;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (language != null) {
__result['language'] = language;
}
@@ -10157,10 +10574,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('language');
try {
- if (obj['language'] != null && !(obj['language'] is String)) {
+ final language = obj['language'];
+ if (language != null && !(language is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -10169,7 +10587,8 @@
}
reporter.push('scheme');
try {
- if (obj['scheme'] != null && !(obj['scheme'] is String)) {
+ final scheme = obj['scheme'];
+ if (scheme != null && !(scheme is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -10178,7 +10597,8 @@
}
reporter.push('pattern');
try {
- if (obj['pattern'] != null && !(obj['pattern'] is String)) {
+ final pattern = obj['pattern'];
+ if (pattern != null && !(pattern is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -10223,8 +10643,9 @@
DocumentFormattingClientCapabilities({this.dynamicRegistration});
static DocumentFormattingClientCapabilities fromJson(
- Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return DocumentFormattingClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -10232,8 +10653,8 @@
/// Whether formatting supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -10241,11 +10662,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10285,19 +10706,20 @@
DocumentFormattingOptions.canParse, DocumentFormattingOptions.fromJson);
DocumentFormattingOptions({this.workDoneProgress});
- static DocumentFormattingOptions fromJson(Map<String, dynamic> json) {
+ static DocumentFormattingOptions fromJson(Map<String, Object?> json) {
if (DocumentFormattingRegistrationOptions.canParse(
json, nullLspJsonReporter)) {
return DocumentFormattingRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentFormattingOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -10305,11 +10727,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10349,16 +10771,21 @@
DocumentFormattingParams(
{required this.textDocument, required this.options, this.workDoneToken});
- static DocumentFormattingParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final options = FormattingOptions.fromJson(json['options']);
- final workDoneToken = json['workDoneToken'] == null
+ static DocumentFormattingParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final optionsJson = json['options'];
+ final options =
+ FormattingOptions.fromJson(optionsJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
return DocumentFormattingParams(
textDocument: textDocument,
options: options,
@@ -10374,8 +10801,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['options'] = options.toJson();
if (workDoneToken != null) {
@@ -10385,18 +10812,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -10409,11 +10837,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['options'] == null) {
+ final options = obj['options'];
+ if (options == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(FormattingOptions.canParse(obj['options'], reporter))) {
+ if (!(FormattingOptions.canParse(options, reporter))) {
reporter.reportError('must be of type FormattingOptions');
return false;
}
@@ -10422,9 +10851,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -10475,12 +10904,13 @@
DocumentFormattingRegistrationOptions(
{this.documentSelector, this.workDoneProgress});
static DocumentFormattingRegistrationOptions fromJson(
- Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
+ Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentFormattingRegistrationOptions(
documentSelector: documentSelector, workDoneProgress: workDoneProgress);
}
@@ -10490,8 +10920,8 @@
final List<DocumentFilter>? documentSelector;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -10500,16 +10930,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -10519,8 +10950,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10567,10 +10998,12 @@
LspJsonHandler(DocumentHighlight.canParse, DocumentHighlight.fromJson);
DocumentHighlight({required this.range, this.kind});
- static DocumentHighlight fromJson(Map<String, dynamic> json) {
- final range = Range.fromJson(json['range']);
- final kind = json['kind'] != null
- ? DocumentHighlightKind.fromJson(json['kind'])
+ static DocumentHighlight fromJson(Map<String, Object?> json) {
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final kindJson = json['kind'];
+ final kind = kindJson != null
+ ? DocumentHighlightKind.fromJson(kindJson as int)
: null;
return DocumentHighlight(range: range, kind: kind);
}
@@ -10581,8 +11014,8 @@
/// The range this highlight applies to.
final Range range;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['range'] = range.toJson();
if (kind != null) {
__result['kind'] = kind?.toJson();
@@ -10591,18 +11024,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('range');
try {
if (!obj.containsKey('range')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -10611,8 +11045,8 @@
}
reporter.push('kind');
try {
- if (obj['kind'] != null &&
- !(DocumentHighlightKind.canParse(obj['kind'], reporter))) {
+ final kind = obj['kind'];
+ if (kind != null && !(DocumentHighlightKind.canParse(kind, reporter))) {
reporter.reportError('must be of type DocumentHighlightKind');
return false;
}
@@ -10653,8 +11087,9 @@
DocumentHighlightClientCapabilities({this.dynamicRegistration});
static DocumentHighlightClientCapabilities fromJson(
- Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return DocumentHighlightClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -10662,8 +11097,8 @@
/// Whether document highlight supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -10671,11 +11106,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10747,19 +11182,20 @@
DocumentHighlightOptions.canParse, DocumentHighlightOptions.fromJson);
DocumentHighlightOptions({this.workDoneProgress});
- static DocumentHighlightOptions fromJson(Map<String, dynamic> json) {
+ static DocumentHighlightOptions fromJson(Map<String, Object?> json) {
if (DocumentHighlightRegistrationOptions.canParse(
json, nullLspJsonReporter)) {
return DocumentHighlightRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentHighlightOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -10767,11 +11203,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10819,23 +11255,28 @@
required this.position,
this.workDoneToken,
this.partialResultToken});
- static DocumentHighlightParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
- final workDoneToken = json['workDoneToken'] == null
+ static DocumentHighlightParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return DocumentHighlightParams(
textDocument: textDocument,
position: position,
@@ -10856,8 +11297,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
if (workDoneToken != null) {
@@ -10870,18 +11311,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -10894,11 +11336,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -10907,9 +11350,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -10918,9 +11361,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -10973,12 +11416,13 @@
DocumentHighlightRegistrationOptions(
{this.documentSelector, this.workDoneProgress});
static DocumentHighlightRegistrationOptions fromJson(
- Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
+ Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentHighlightRegistrationOptions(
documentSelector: documentSelector, workDoneProgress: workDoneProgress);
}
@@ -10988,8 +11432,8 @@
final List<DocumentFilter>? documentSelector;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -10998,16 +11442,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -11017,8 +11462,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11064,18 +11509,22 @@
LspJsonHandler(DocumentLink.canParse, DocumentLink.fromJson);
DocumentLink({required this.range, this.target, this.tooltip, this.data});
- static DocumentLink fromJson(Map<String, dynamic> json) {
- final range = Range.fromJson(json['range']);
- final target = json['target'];
- final tooltip = json['tooltip'];
- final data = json['data'];
+ static DocumentLink fromJson(Map<String, Object?> json) {
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final targetJson = json['target'];
+ final target = targetJson as String?;
+ final tooltipJson = json['tooltip'];
+ final tooltip = tooltipJson as String?;
+ final dataJson = json['data'];
+ final data = dataJson;
return DocumentLink(
range: range, target: target, tooltip: tooltip, data: data);
}
/// A data entry field that is preserved on a document link between a
/// DocumentLinkRequest and a DocumentLinkResolveRequest.
- final dynamic data;
+ final Object? data;
/// The range this link applies to.
final Range range;
@@ -11092,8 +11541,8 @@
/// @since 3.15.0
final String? tooltip;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['range'] = range.toJson();
if (target != null) {
__result['target'] = target;
@@ -11108,18 +11557,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('range');
try {
if (!obj.containsKey('range')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -11128,7 +11578,8 @@
}
reporter.push('target');
try {
- if (obj['target'] != null && !(obj['target'] is String)) {
+ final target = obj['target'];
+ if (target != null && !(target is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -11137,7 +11588,8 @@
}
reporter.push('tooltip');
try {
- if (obj['tooltip'] != null && !(obj['tooltip'] is String)) {
+ final tooltip = obj['tooltip'];
+ if (tooltip != null && !(tooltip is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -11184,9 +11636,11 @@
DocumentLinkClientCapabilities(
{this.dynamicRegistration, this.tooltipSupport});
- static DocumentLinkClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final tooltipSupport = json['tooltipSupport'];
+ static DocumentLinkClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final tooltipSupportJson = json['tooltipSupport'];
+ final tooltipSupport = tooltipSupportJson as bool?;
return DocumentLinkClientCapabilities(
dynamicRegistration: dynamicRegistration,
tooltipSupport: tooltipSupport);
@@ -11199,8 +11653,8 @@
/// @since 3.15.0
final bool? tooltipSupport;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -11211,11 +11665,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11224,7 +11678,8 @@
}
reporter.push('tooltipSupport');
try {
- if (obj['tooltipSupport'] != null && !(obj['tooltipSupport'] is bool)) {
+ final tooltipSupport = obj['tooltipSupport'];
+ if (tooltipSupport != null && !(tooltipSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11266,12 +11721,14 @@
DocumentLinkOptions.canParse, DocumentLinkOptions.fromJson);
DocumentLinkOptions({this.resolveProvider, this.workDoneProgress});
- static DocumentLinkOptions fromJson(Map<String, dynamic> json) {
+ static DocumentLinkOptions fromJson(Map<String, Object?> json) {
if (DocumentLinkRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return DocumentLinkRegistrationOptions.fromJson(json);
}
- final resolveProvider = json['resolveProvider'];
- final workDoneProgress = json['workDoneProgress'];
+ final resolveProviderJson = json['resolveProvider'];
+ final resolveProvider = resolveProviderJson as bool?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentLinkOptions(
resolveProvider: resolveProvider, workDoneProgress: workDoneProgress);
}
@@ -11280,8 +11737,8 @@
final bool? resolveProvider;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (resolveProvider != null) {
__result['resolveProvider'] = resolveProvider;
}
@@ -11292,11 +11749,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('resolveProvider');
try {
- if (obj['resolveProvider'] != null &&
- !(obj['resolveProvider'] is bool)) {
+ final resolveProvider = obj['resolveProvider'];
+ if (resolveProvider != null && !(resolveProvider is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11305,8 +11762,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11352,22 +11809,26 @@
{required this.textDocument,
this.workDoneToken,
this.partialResultToken});
- static DocumentLinkParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final workDoneToken = json['workDoneToken'] == null
+ static DocumentLinkParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return DocumentLinkParams(
textDocument: textDocument,
workDoneToken: workDoneToken,
@@ -11384,8 +11845,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
@@ -11397,18 +11858,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -11417,9 +11879,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -11428,9 +11890,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -11480,13 +11942,15 @@
DocumentLinkRegistrationOptions(
{this.documentSelector, this.resolveProvider, this.workDoneProgress});
- static DocumentLinkRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final resolveProvider = json['resolveProvider'];
- final workDoneProgress = json['workDoneProgress'];
+ static DocumentLinkRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final resolveProviderJson = json['resolveProvider'];
+ final resolveProvider = resolveProviderJson as bool?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentLinkRegistrationOptions(
documentSelector: documentSelector,
resolveProvider: resolveProvider,
@@ -11501,8 +11965,8 @@
final bool? resolveProvider;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (resolveProvider != null) {
__result['resolveProvider'] = resolveProvider;
@@ -11514,16 +11978,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -11533,8 +11998,8 @@
}
reporter.push('resolveProvider');
try {
- if (obj['resolveProvider'] != null &&
- !(obj['resolveProvider'] is bool)) {
+ final resolveProvider = obj['resolveProvider'];
+ if (resolveProvider != null && !(resolveProvider is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11543,8 +12008,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11591,8 +12056,9 @@
DocumentOnTypeFormattingClientCapabilities({this.dynamicRegistration});
static DocumentOnTypeFormattingClientCapabilities fromJson(
- Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return DocumentOnTypeFormattingClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -11600,8 +12066,8 @@
/// Whether on type formatting supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -11609,11 +12075,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11655,16 +12121,17 @@
DocumentOnTypeFormattingOptions(
{required this.firstTriggerCharacter, this.moreTriggerCharacter});
- static DocumentOnTypeFormattingOptions fromJson(Map<String, dynamic> json) {
+ static DocumentOnTypeFormattingOptions fromJson(Map<String, Object?> json) {
if (DocumentOnTypeFormattingRegistrationOptions.canParse(
json, nullLspJsonReporter)) {
return DocumentOnTypeFormattingRegistrationOptions.fromJson(json);
}
- final firstTriggerCharacter = json['firstTriggerCharacter'];
- final moreTriggerCharacter = json['moreTriggerCharacter']
- ?.map((item) => item)
- ?.cast<String>()
- ?.toList();
+ final firstTriggerCharacterJson = json['firstTriggerCharacter'];
+ final firstTriggerCharacter = firstTriggerCharacterJson as String;
+ final moreTriggerCharacterJson = json['moreTriggerCharacter'];
+ final moreTriggerCharacter = (moreTriggerCharacterJson as List<Object?>?)
+ ?.map((item) => item as String)
+ .toList();
return DocumentOnTypeFormattingOptions(
firstTriggerCharacter: firstTriggerCharacter,
moreTriggerCharacter: moreTriggerCharacter);
@@ -11676,8 +12143,8 @@
/// More trigger characters.
final List<String>? moreTriggerCharacter;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['firstTriggerCharacter'] = firstTriggerCharacter;
if (moreTriggerCharacter != null) {
__result['moreTriggerCharacter'] = moreTriggerCharacter;
@@ -11686,18 +12153,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('firstTriggerCharacter');
try {
if (!obj.containsKey('firstTriggerCharacter')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['firstTriggerCharacter'] == null) {
+ final firstTriggerCharacter = obj['firstTriggerCharacter'];
+ if (firstTriggerCharacter == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['firstTriggerCharacter'] is String)) {
+ if (!(firstTriggerCharacter is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -11706,10 +12174,10 @@
}
reporter.push('moreTriggerCharacter');
try {
- if (obj['moreTriggerCharacter'] != null &&
- !((obj['moreTriggerCharacter'] is List &&
- (obj['moreTriggerCharacter']
- .every((item) => item is String))))) {
+ final moreTriggerCharacter = obj['moreTriggerCharacter'];
+ if (moreTriggerCharacter != null &&
+ !((moreTriggerCharacter is List &&
+ (moreTriggerCharacter.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -11758,11 +12226,17 @@
required this.options,
required this.textDocument,
required this.position});
- static DocumentOnTypeFormattingParams fromJson(Map<String, dynamic> json) {
- final ch = json['ch'];
- final options = FormattingOptions.fromJson(json['options']);
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
+ static DocumentOnTypeFormattingParams fromJson(Map<String, Object?> json) {
+ final chJson = json['ch'];
+ final ch = chJson as String;
+ final optionsJson = json['options'];
+ final options =
+ FormattingOptions.fromJson(optionsJson as Map<String, Object?>);
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
return DocumentOnTypeFormattingParams(
ch: ch,
options: options,
@@ -11782,8 +12256,8 @@
/// The text document.
final TextDocumentIdentifier textDocument;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['ch'] = ch;
__result['options'] = options.toJson();
__result['textDocument'] = textDocument.toJson();
@@ -11792,18 +12266,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('ch');
try {
if (!obj.containsKey('ch')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['ch'] == null) {
+ final ch = obj['ch'];
+ if (ch == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['ch'] is String)) {
+ if (!(ch is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -11816,11 +12291,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['options'] == null) {
+ final options = obj['options'];
+ if (options == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(FormattingOptions.canParse(obj['options'], reporter))) {
+ if (!(FormattingOptions.canParse(options, reporter))) {
reporter.reportError('must be of type FormattingOptions');
return false;
}
@@ -11833,11 +12309,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -11850,11 +12327,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -11909,16 +12387,17 @@
required this.firstTriggerCharacter,
this.moreTriggerCharacter});
static DocumentOnTypeFormattingRegistrationOptions fromJson(
- Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final firstTriggerCharacter = json['firstTriggerCharacter'];
- final moreTriggerCharacter = json['moreTriggerCharacter']
- ?.map((item) => item)
- ?.cast<String>()
- ?.toList();
+ Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final firstTriggerCharacterJson = json['firstTriggerCharacter'];
+ final firstTriggerCharacter = firstTriggerCharacterJson as String;
+ final moreTriggerCharacterJson = json['moreTriggerCharacter'];
+ final moreTriggerCharacter = (moreTriggerCharacterJson as List<Object?>?)
+ ?.map((item) => item as String)
+ .toList();
return DocumentOnTypeFormattingRegistrationOptions(
documentSelector: documentSelector,
firstTriggerCharacter: firstTriggerCharacter,
@@ -11935,8 +12414,8 @@
/// More trigger characters.
final List<String>? moreTriggerCharacter;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
__result['firstTriggerCharacter'] = firstTriggerCharacter;
if (moreTriggerCharacter != null) {
@@ -11946,16 +12425,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -11969,11 +12449,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['firstTriggerCharacter'] == null) {
+ final firstTriggerCharacter = obj['firstTriggerCharacter'];
+ if (firstTriggerCharacter == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['firstTriggerCharacter'] is String)) {
+ if (!(firstTriggerCharacter is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -11982,10 +12463,10 @@
}
reporter.push('moreTriggerCharacter');
try {
- if (obj['moreTriggerCharacter'] != null &&
- !((obj['moreTriggerCharacter'] is List &&
- (obj['moreTriggerCharacter']
- .every((item) => item is String))))) {
+ final moreTriggerCharacter = obj['moreTriggerCharacter'];
+ if (moreTriggerCharacter != null &&
+ !((moreTriggerCharacter is List &&
+ (moreTriggerCharacter.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -12034,8 +12515,9 @@
DocumentRangeFormattingClientCapabilities({this.dynamicRegistration});
static DocumentRangeFormattingClientCapabilities fromJson(
- Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return DocumentRangeFormattingClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -12043,8 +12525,8 @@
/// Whether formatting supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -12052,11 +12534,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12098,19 +12580,20 @@
DocumentRangeFormattingOptions.fromJson);
DocumentRangeFormattingOptions({this.workDoneProgress});
- static DocumentRangeFormattingOptions fromJson(Map<String, dynamic> json) {
+ static DocumentRangeFormattingOptions fromJson(Map<String, Object?> json) {
if (DocumentRangeFormattingRegistrationOptions.canParse(
json, nullLspJsonReporter)) {
return DocumentRangeFormattingRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentRangeFormattingOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -12118,11 +12601,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12167,17 +12650,23 @@
required this.range,
required this.options,
this.workDoneToken});
- static DocumentRangeFormattingParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final range = Range.fromJson(json['range']);
- final options = FormattingOptions.fromJson(json['options']);
- final workDoneToken = json['workDoneToken'] == null
+ static DocumentRangeFormattingParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final optionsJson = json['options'];
+ final options =
+ FormattingOptions.fromJson(optionsJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
return DocumentRangeFormattingParams(
textDocument: textDocument,
range: range,
@@ -12197,8 +12686,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['range'] = range.toJson();
__result['options'] = options.toJson();
@@ -12209,18 +12698,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -12233,11 +12723,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -12250,11 +12741,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['options'] == null) {
+ final options = obj['options'];
+ if (options == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(FormattingOptions.canParse(obj['options'], reporter))) {
+ if (!(FormattingOptions.canParse(options, reporter))) {
reporter.reportError('must be of type FormattingOptions');
return false;
}
@@ -12263,9 +12755,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -12318,12 +12810,13 @@
DocumentRangeFormattingRegistrationOptions(
{this.documentSelector, this.workDoneProgress});
static DocumentRangeFormattingRegistrationOptions fromJson(
- Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
+ Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentRangeFormattingRegistrationOptions(
documentSelector: documentSelector, workDoneProgress: workDoneProgress);
}
@@ -12333,8 +12826,8 @@
final List<DocumentFilter>? documentSelector;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -12343,16 +12836,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -12362,8 +12856,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12419,21 +12913,28 @@
required this.range,
required this.selectionRange,
this.children});
- static DocumentSymbol fromJson(Map<String, dynamic> json) {
- final name = json['name'];
- final detail = json['detail'];
- final kind = SymbolKind.fromJson(json['kind']);
- final tags = json['tags']
- ?.map((item) => item != null ? SymbolTag.fromJson(item) : null)
- ?.cast<SymbolTag>()
- ?.toList();
- final deprecated = json['deprecated'];
- final range = Range.fromJson(json['range']);
- final selectionRange = Range.fromJson(json['selectionRange']);
- final children = json['children']
- ?.map((item) => item != null ? DocumentSymbol.fromJson(item) : null)
- ?.cast<DocumentSymbol>()
- ?.toList();
+ static DocumentSymbol fromJson(Map<String, Object?> json) {
+ final nameJson = json['name'];
+ final name = nameJson as String;
+ final detailJson = json['detail'];
+ final detail = detailJson as String?;
+ final kindJson = json['kind'];
+ final kind = SymbolKind.fromJson(kindJson as int);
+ final tagsJson = json['tags'];
+ final tags = (tagsJson as List<Object?>?)
+ ?.map((item) => SymbolTag.fromJson(item as num))
+ .toList();
+ final deprecatedJson = json['deprecated'];
+ final deprecated = deprecatedJson as bool?;
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
+ final selectionRangeJson = json['selectionRange'];
+ final selectionRange =
+ Range.fromJson(selectionRangeJson as Map<String, Object?>);
+ final childrenJson = json['children'];
+ final children = (childrenJson as List<Object?>?)
+ ?.map((item) => DocumentSymbol.fromJson(item as Map<String, Object?>))
+ .toList();
return DocumentSymbol(
name: name,
detail: detail,
@@ -12477,8 +12978,8 @@
/// @since 3.16.0
final List<SymbolTag>? tags;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['name'] = name;
if (detail != null) {
__result['detail'] = detail;
@@ -12499,18 +13000,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('name');
try {
if (!obj.containsKey('name')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['name'] == null) {
+ final name = obj['name'];
+ if (name == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['name'] is String)) {
+ if (!(name is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -12519,7 +13021,8 @@
}
reporter.push('detail');
try {
- if (obj['detail'] != null && !(obj['detail'] is String)) {
+ final detail = obj['detail'];
+ if (detail != null && !(detail is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -12532,11 +13035,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['kind'] == null) {
+ final kind = obj['kind'];
+ if (kind == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(SymbolKind.canParse(obj['kind'], reporter))) {
+ if (!(SymbolKind.canParse(kind, reporter))) {
reporter.reportError('must be of type SymbolKind');
return false;
}
@@ -12545,10 +13049,10 @@
}
reporter.push('tags');
try {
- if (obj['tags'] != null &&
- !((obj['tags'] is List &&
- (obj['tags']
- .every((item) => SymbolTag.canParse(item, reporter)))))) {
+ final tags = obj['tags'];
+ if (tags != null &&
+ !((tags is List &&
+ (tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -12557,7 +13061,8 @@
}
reporter.push('deprecated');
try {
- if (obj['deprecated'] != null && !(obj['deprecated'] is bool)) {
+ final deprecated = obj['deprecated'];
+ if (deprecated != null && !(deprecated is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12570,11 +13075,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -12587,11 +13093,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['selectionRange'] == null) {
+ final selectionRange = obj['selectionRange'];
+ if (selectionRange == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['selectionRange'], reporter))) {
+ if (!(Range.canParse(selectionRange, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -12600,9 +13107,10 @@
}
reporter.push('children');
try {
- if (obj['children'] != null &&
- !((obj['children'] is List &&
- (obj['children'].every(
+ final children = obj['children'];
+ if (children != null &&
+ !((children is List &&
+ (children.every(
(item) => DocumentSymbol.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentSymbol>');
return false;
@@ -12663,19 +13171,25 @@
this.hierarchicalDocumentSymbolSupport,
this.tagSupport,
this.labelSupport});
- static DocumentSymbolClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final symbolKind = json['symbolKind'] != null
+ static DocumentSymbolClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final symbolKindJson = json['symbolKind'];
+ final symbolKind = symbolKindJson != null
? DocumentSymbolClientCapabilitiesSymbolKind.fromJson(
- json['symbolKind'])
+ symbolKindJson as Map<String, Object?>)
: null;
- final hierarchicalDocumentSymbolSupport =
+ final hierarchicalDocumentSymbolSupportJson =
json['hierarchicalDocumentSymbolSupport'];
- final tagSupport = json['tagSupport'] != null
+ final hierarchicalDocumentSymbolSupport =
+ hierarchicalDocumentSymbolSupportJson as bool?;
+ final tagSupportJson = json['tagSupport'];
+ final tagSupport = tagSupportJson != null
? DocumentSymbolClientCapabilitiesTagSupport.fromJson(
- json['tagSupport'])
+ tagSupportJson as Map<String, Object?>)
: null;
- final labelSupport = json['labelSupport'];
+ final labelSupportJson = json['labelSupport'];
+ final labelSupport = labelSupportJson as bool?;
return DocumentSymbolClientCapabilities(
dynamicRegistration: dynamicRegistration,
symbolKind: symbolKind,
@@ -12705,8 +13219,8 @@
/// @since 3.16.0
final DocumentSymbolClientCapabilitiesTagSupport? tagSupport;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -12727,11 +13241,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12740,9 +13254,10 @@
}
reporter.push('symbolKind');
try {
- if (obj['symbolKind'] != null &&
+ final symbolKind = obj['symbolKind'];
+ if (symbolKind != null &&
!(DocumentSymbolClientCapabilitiesSymbolKind.canParse(
- obj['symbolKind'], reporter))) {
+ symbolKind, reporter))) {
reporter.reportError(
'must be of type DocumentSymbolClientCapabilitiesSymbolKind');
return false;
@@ -12752,8 +13267,10 @@
}
reporter.push('hierarchicalDocumentSymbolSupport');
try {
- if (obj['hierarchicalDocumentSymbolSupport'] != null &&
- !(obj['hierarchicalDocumentSymbolSupport'] is bool)) {
+ final hierarchicalDocumentSymbolSupport =
+ obj['hierarchicalDocumentSymbolSupport'];
+ if (hierarchicalDocumentSymbolSupport != null &&
+ !(hierarchicalDocumentSymbolSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12762,9 +13279,10 @@
}
reporter.push('tagSupport');
try {
- if (obj['tagSupport'] != null &&
+ final tagSupport = obj['tagSupport'];
+ if (tagSupport != null &&
!(DocumentSymbolClientCapabilitiesTagSupport.canParse(
- obj['tagSupport'], reporter))) {
+ tagSupport, reporter))) {
reporter.reportError(
'must be of type DocumentSymbolClientCapabilitiesTagSupport');
return false;
@@ -12774,7 +13292,8 @@
}
reporter.push('labelSupport');
try {
- if (obj['labelSupport'] != null && !(obj['labelSupport'] is bool)) {
+ final labelSupport = obj['labelSupport'];
+ if (labelSupport != null && !(labelSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12826,11 +13345,11 @@
DocumentSymbolClientCapabilitiesSymbolKind({this.valueSet});
static DocumentSymbolClientCapabilitiesSymbolKind fromJson(
- Map<String, dynamic> json) {
- final valueSet = json['valueSet']
- ?.map((item) => item != null ? SymbolKind.fromJson(item) : null)
- ?.cast<SymbolKind>()
- ?.toList();
+ Map<String, Object?> json) {
+ final valueSetJson = json['valueSet'];
+ final valueSet = (valueSetJson as List<Object?>?)
+ ?.map((item) => SymbolKind.fromJson(item as int))
+ .toList();
return DocumentSymbolClientCapabilitiesSymbolKind(valueSet: valueSet);
}
@@ -12842,8 +13361,8 @@
/// from `File` to `Array` as defined in the initial version of the protocol.
final List<SymbolKind>? valueSet;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (valueSet != null) {
__result['valueSet'] = valueSet?.map((item) => item.toJson()).toList();
}
@@ -12851,12 +13370,13 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('valueSet');
try {
- if (obj['valueSet'] != null &&
- !((obj['valueSet'] is List &&
- (obj['valueSet']
+ final valueSet = obj['valueSet'];
+ if (valueSet != null &&
+ !((valueSet is List &&
+ (valueSet
.every((item) => SymbolKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolKind>');
return false;
@@ -12901,38 +13421,38 @@
DocumentSymbolClientCapabilitiesTagSupport({required this.valueSet});
static DocumentSymbolClientCapabilitiesTagSupport fromJson(
- Map<String, dynamic> json) {
- final valueSet = json['valueSet']
- ?.map((item) => SymbolTag.fromJson(item))
- ?.cast<SymbolTag>()
- ?.toList();
+ Map<String, Object?> json) {
+ final valueSetJson = json['valueSet'];
+ final valueSet = (valueSetJson as List<Object?>)
+ .map((item) => SymbolTag.fromJson(item as num))
+ .toList();
return DocumentSymbolClientCapabilitiesTagSupport(valueSet: valueSet);
}
/// The tags supported by the client.
final List<SymbolTag> valueSet;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('valueSet');
try {
if (!obj.containsKey('valueSet')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['valueSet'] == null) {
+ final valueSet = obj['valueSet'];
+ if (valueSet == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['valueSet'] is List &&
- (obj['valueSet']
- .every((item) => SymbolTag.canParse(item, reporter)))))) {
+ if (!((valueSet is List &&
+ (valueSet.every((item) => SymbolTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -12974,12 +13494,14 @@
DocumentSymbolOptions.canParse, DocumentSymbolOptions.fromJson);
DocumentSymbolOptions({this.label, this.workDoneProgress});
- static DocumentSymbolOptions fromJson(Map<String, dynamic> json) {
+ static DocumentSymbolOptions fromJson(Map<String, Object?> json) {
if (DocumentSymbolRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return DocumentSymbolRegistrationOptions.fromJson(json);
}
- final label = json['label'];
- final workDoneProgress = json['workDoneProgress'];
+ final labelJson = json['label'];
+ final label = labelJson as String?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentSymbolOptions(
label: label, workDoneProgress: workDoneProgress);
}
@@ -12990,8 +13512,8 @@
final String? label;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (label != null) {
__result['label'] = label;
}
@@ -13002,10 +13524,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('label');
try {
- if (obj['label'] != null && !(obj['label'] is String)) {
+ final label = obj['label'];
+ if (label != null && !(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -13014,8 +13537,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13061,22 +13584,26 @@
{required this.textDocument,
this.workDoneToken,
this.partialResultToken});
- static DocumentSymbolParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final workDoneToken = json['workDoneToken'] == null
+ static DocumentSymbolParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return DocumentSymbolParams(
textDocument: textDocument,
workDoneToken: workDoneToken,
@@ -13093,8 +13620,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
@@ -13106,18 +13633,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -13126,9 +13654,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -13137,9 +13665,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -13189,13 +13717,15 @@
DocumentSymbolRegistrationOptions(
{this.documentSelector, this.label, this.workDoneProgress});
- static DocumentSymbolRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final label = json['label'];
- final workDoneProgress = json['workDoneProgress'];
+ static DocumentSymbolRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final labelJson = json['label'];
+ final label = labelJson as String?;
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return DocumentSymbolRegistrationOptions(
documentSelector: documentSelector,
label: label,
@@ -13212,8 +13742,8 @@
final String? label;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (label != null) {
__result['label'] = label;
@@ -13225,16 +13755,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -13244,7 +13775,8 @@
}
reporter.push('label');
try {
- if (obj['label'] != null && !(obj['label'] is String)) {
+ final label = obj['label'];
+ if (label != null && !(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -13253,8 +13785,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13353,8 +13885,9 @@
ExecuteCommandClientCapabilities.fromJson);
ExecuteCommandClientCapabilities({this.dynamicRegistration});
- static ExecuteCommandClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ static ExecuteCommandClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return ExecuteCommandClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -13362,8 +13895,8 @@
/// Execute command supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -13371,11 +13904,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13414,13 +13947,15 @@
ExecuteCommandOptions.canParse, ExecuteCommandOptions.fromJson);
ExecuteCommandOptions({required this.commands, this.workDoneProgress});
- static ExecuteCommandOptions fromJson(Map<String, dynamic> json) {
+ static ExecuteCommandOptions fromJson(Map<String, Object?> json) {
if (ExecuteCommandRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return ExecuteCommandRegistrationOptions.fromJson(json);
}
+ final commandsJson = json['commands'];
final commands =
- json['commands']?.map((item) => item)?.cast<String>()?.toList();
- final workDoneProgress = json['workDoneProgress'];
+ (commandsJson as List<Object?>).map((item) => item as String).toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return ExecuteCommandOptions(
commands: commands, workDoneProgress: workDoneProgress);
}
@@ -13429,8 +13964,8 @@
final List<String> commands;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['commands'] = commands;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -13439,19 +13974,20 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('commands');
try {
if (!obj.containsKey('commands')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['commands'] == null) {
+ final commands = obj['commands'];
+ if (commands == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['commands'] is List &&
- (obj['commands'].every((item) => item is String))))) {
+ if (!((commands is List &&
+ (commands.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -13460,8 +13996,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13505,23 +14041,26 @@
ExecuteCommandParams(
{required this.command, this.arguments, this.workDoneToken});
- static ExecuteCommandParams fromJson(Map<String, dynamic> json) {
- final command = json['command'];
+ static ExecuteCommandParams fromJson(Map<String, Object?> json) {
+ final commandJson = json['command'];
+ final command = commandJson as String;
+ final argumentsJson = json['arguments'];
final arguments =
- json['arguments']?.map((item) => item)?.cast<dynamic>()?.toList();
- final workDoneToken = json['workDoneToken'] == null
+ (argumentsJson as List<Object?>?)?.map((item) => item).toList();
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
return ExecuteCommandParams(
command: command, arguments: arguments, workDoneToken: workDoneToken);
}
/// Arguments that the command should be invoked with.
- final List<dynamic>? arguments;
+ final List<Object?>? arguments;
/// The identifier of the actual command handler.
final String command;
@@ -13529,8 +14068,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['command'] = command;
if (arguments != null) {
__result['arguments'] = arguments;
@@ -13542,18 +14081,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('command');
try {
if (!obj.containsKey('command')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['command'] == null) {
+ final command = obj['command'];
+ if (command == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['command'] is String)) {
+ if (!(command is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -13562,10 +14102,10 @@
}
reporter.push('arguments');
try {
- if (obj['arguments'] != null &&
- !((obj['arguments'] is List &&
- (obj['arguments'].every((item) => true))))) {
- reporter.reportError('must be of type List<dynamic>');
+ final arguments = obj['arguments'];
+ if (arguments != null &&
+ !((arguments is List && (arguments.every((item) => true))))) {
+ reporter.reportError('must be of type List<Object?>');
return false;
}
} finally {
@@ -13573,9 +14113,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -13595,7 +14135,7 @@
other.runtimeType == ExecuteCommandParams) {
return command == other.command &&
listEqual(
- arguments, other.arguments, (dynamic a, dynamic b) => a == b) &&
+ arguments, other.arguments, (Object? a, Object? b) => a == b) &&
workDoneToken == other.workDoneToken &&
true;
}
@@ -13624,10 +14164,12 @@
ExecuteCommandRegistrationOptions(
{required this.commands, this.workDoneProgress});
- static ExecuteCommandRegistrationOptions fromJson(Map<String, dynamic> json) {
+ static ExecuteCommandRegistrationOptions fromJson(Map<String, Object?> json) {
+ final commandsJson = json['commands'];
final commands =
- json['commands']?.map((item) => item)?.cast<String>()?.toList();
- final workDoneProgress = json['workDoneProgress'];
+ (commandsJson as List<Object?>).map((item) => item as String).toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return ExecuteCommandRegistrationOptions(
commands: commands, workDoneProgress: workDoneProgress);
}
@@ -13636,8 +14178,8 @@
final List<String> commands;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['commands'] = commands;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -13646,19 +14188,20 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('commands');
try {
if (!obj.containsKey('commands')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['commands'] == null) {
+ final commands = obj['commands'];
+ if (commands == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['commands'] is List &&
- (obj['commands'].every((item) => item is String))))) {
+ if (!((commands is List &&
+ (commands.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -13667,8 +14210,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13791,33 +14334,35 @@
LspJsonHandler(FileCreate.canParse, FileCreate.fromJson);
FileCreate({required this.uri});
- static FileCreate fromJson(Map<String, dynamic> json) {
- final uri = json['uri'];
+ static FileCreate fromJson(Map<String, Object?> json) {
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
return FileCreate(uri: uri);
}
/// A file:// URI for the location of the file/folder being created.
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['uri'] = uri;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('uri');
try {
if (!obj.containsKey('uri')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -13857,33 +14402,35 @@
LspJsonHandler(FileDelete.canParse, FileDelete.fromJson);
FileDelete({required this.uri});
- static FileDelete fromJson(Map<String, dynamic> json) {
- final uri = json['uri'];
+ static FileDelete fromJson(Map<String, Object?> json) {
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
return FileDelete(uri: uri);
}
/// A file:// URI for the location of the file/folder being deleted.
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['uri'] = uri;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('uri');
try {
if (!obj.containsKey('uri')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -13922,9 +14469,11 @@
LspJsonHandler(FileEvent.canParse, FileEvent.fromJson);
FileEvent({required this.uri, required this.type});
- static FileEvent fromJson(Map<String, dynamic> json) {
- final uri = json['uri'];
- final type = json['type'];
+ static FileEvent fromJson(Map<String, Object?> json) {
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
+ final typeJson = json['type'];
+ final type = typeJson as int;
return FileEvent(uri: uri, type: type);
}
@@ -13934,26 +14483,27 @@
/// The file's URI.
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['uri'] = uri;
__result['type'] = type;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('uri');
try {
if (!obj.containsKey('uri')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -13966,11 +14516,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['type'] == null) {
+ final type = obj['type'];
+ if (type == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['type'] is int)) {
+ if (!(type is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -14012,9 +14563,12 @@
FileOperationFilter.canParse, FileOperationFilter.fromJson);
FileOperationFilter({this.scheme, required this.pattern});
- static FileOperationFilter fromJson(Map<String, dynamic> json) {
- final scheme = json['scheme'];
- final pattern = FileOperationPattern.fromJson(json['pattern']);
+ static FileOperationFilter fromJson(Map<String, Object?> json) {
+ final schemeJson = json['scheme'];
+ final scheme = schemeJson as String?;
+ final patternJson = json['pattern'];
+ final pattern =
+ FileOperationPattern.fromJson(patternJson as Map<String, Object?>);
return FileOperationFilter(scheme: scheme, pattern: pattern);
}
@@ -14024,8 +14578,8 @@
/// A Uri like `file` or `untitled`.
final String? scheme;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (scheme != null) {
__result['scheme'] = scheme;
}
@@ -14034,10 +14588,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('scheme');
try {
- if (obj['scheme'] != null && !(obj['scheme'] is String)) {
+ final scheme = obj['scheme'];
+ if (scheme != null && !(scheme is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -14050,11 +14605,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['pattern'] == null) {
+ final pattern = obj['pattern'];
+ if (pattern == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(FileOperationPattern.canParse(obj['pattern'], reporter))) {
+ if (!(FileOperationPattern.canParse(pattern, reporter))) {
reporter.reportError('must be of type FileOperationPattern');
return false;
}
@@ -14097,13 +14653,17 @@
FileOperationPattern.canParse, FileOperationPattern.fromJson);
FileOperationPattern({required this.glob, this.matches, this.options});
- static FileOperationPattern fromJson(Map<String, dynamic> json) {
- final glob = json['glob'];
- final matches = json['matches'] != null
- ? FileOperationPatternKind.fromJson(json['matches'])
+ static FileOperationPattern fromJson(Map<String, Object?> json) {
+ final globJson = json['glob'];
+ final glob = globJson as String;
+ final matchesJson = json['matches'];
+ final matches = matchesJson != null
+ ? FileOperationPatternKind.fromJson(matchesJson as String)
: null;
- final options = json['options'] != null
- ? FileOperationPatternOptions.fromJson(json['options'])
+ final optionsJson = json['options'];
+ final options = optionsJson != null
+ ? FileOperationPatternOptions.fromJson(
+ optionsJson as Map<String, Object?>)
: null;
return FileOperationPattern(glob: glob, matches: matches, options: options);
}
@@ -14129,8 +14689,8 @@
/// Additional options used during matching.
final FileOperationPatternOptions? options;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['glob'] = glob;
if (matches != null) {
__result['matches'] = matches?.toJson();
@@ -14142,18 +14702,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('glob');
try {
if (!obj.containsKey('glob')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['glob'] == null) {
+ final glob = obj['glob'];
+ if (glob == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['glob'] is String)) {
+ if (!(glob is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -14162,8 +14723,9 @@
}
reporter.push('matches');
try {
- if (obj['matches'] != null &&
- !(FileOperationPatternKind.canParse(obj['matches'], reporter))) {
+ final matches = obj['matches'];
+ if (matches != null &&
+ !(FileOperationPatternKind.canParse(matches, reporter))) {
reporter.reportError('must be of type FileOperationPatternKind');
return false;
}
@@ -14172,8 +14734,9 @@
}
reporter.push('options');
try {
- if (obj['options'] != null &&
- !(FileOperationPatternOptions.canParse(obj['options'], reporter))) {
+ final options = obj['options'];
+ if (options != null &&
+ !(FileOperationPatternOptions.canParse(options, reporter))) {
reporter.reportError('must be of type FileOperationPatternOptions');
return false;
}
@@ -14250,16 +14813,17 @@
FileOperationPatternOptions.fromJson);
FileOperationPatternOptions({this.ignoreCase});
- static FileOperationPatternOptions fromJson(Map<String, dynamic> json) {
- final ignoreCase = json['ignoreCase'];
+ static FileOperationPatternOptions fromJson(Map<String, Object?> json) {
+ final ignoreCaseJson = json['ignoreCase'];
+ final ignoreCase = ignoreCaseJson as bool?;
return FileOperationPatternOptions(ignoreCase: ignoreCase);
}
/// The pattern should be matched ignoring casing.
final bool? ignoreCase;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (ignoreCase != null) {
__result['ignoreCase'] = ignoreCase;
}
@@ -14267,10 +14831,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('ignoreCase');
try {
- if (obj['ignoreCase'] != null && !(obj['ignoreCase'] is bool)) {
+ final ignoreCase = obj['ignoreCase'];
+ if (ignoreCase != null && !(ignoreCase is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14312,37 +14877,39 @@
FileOperationRegistrationOptions.fromJson);
FileOperationRegistrationOptions({required this.filters});
- static FileOperationRegistrationOptions fromJson(Map<String, dynamic> json) {
- final filters = json['filters']
- ?.map((item) => FileOperationFilter.fromJson(item))
- ?.cast<FileOperationFilter>()
- ?.toList();
+ static FileOperationRegistrationOptions fromJson(Map<String, Object?> json) {
+ final filtersJson = json['filters'];
+ final filters = (filtersJson as List<Object?>)
+ .map((item) =>
+ FileOperationFilter.fromJson(item as Map<String, Object?>))
+ .toList();
return FileOperationRegistrationOptions(filters: filters);
}
/// The actual filters.
final List<FileOperationFilter> filters;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['filters'] = filters.map((item) => item.toJson()).toList();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('filters');
try {
if (!obj.containsKey('filters')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['filters'] == null) {
+ final filters = obj['filters'];
+ if (filters == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['filters'] is List &&
- (obj['filters'].every(
+ if (!((filters is List &&
+ (filters.every(
(item) => FileOperationFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileOperationFilter>');
return false;
@@ -14386,9 +14953,11 @@
LspJsonHandler(FileRename.canParse, FileRename.fromJson);
FileRename({required this.oldUri, required this.newUri});
- static FileRename fromJson(Map<String, dynamic> json) {
- final oldUri = json['oldUri'];
- final newUri = json['newUri'];
+ static FileRename fromJson(Map<String, Object?> json) {
+ final oldUriJson = json['oldUri'];
+ final oldUri = oldUriJson as String;
+ final newUriJson = json['newUri'];
+ final newUri = newUriJson as String;
return FileRename(oldUri: oldUri, newUri: newUri);
}
@@ -14398,26 +14967,27 @@
/// A file:// URI for the original location of the file/folder being renamed.
final String oldUri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['oldUri'] = oldUri;
__result['newUri'] = newUri;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('oldUri');
try {
if (!obj.containsKey('oldUri')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['oldUri'] == null) {
+ final oldUri = obj['oldUri'];
+ if (oldUri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['oldUri'] is String)) {
+ if (!(oldUri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -14430,11 +15000,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['newUri'] == null) {
+ final newUri = obj['newUri'];
+ if (newUri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['newUri'] is String)) {
+ if (!(newUri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -14473,9 +15044,11 @@
LspJsonHandler(FileSystemWatcher.canParse, FileSystemWatcher.fromJson);
FileSystemWatcher({required this.globPattern, this.kind});
- static FileSystemWatcher fromJson(Map<String, dynamic> json) {
- final globPattern = json['globPattern'];
- final kind = json['kind'] != null ? WatchKind.fromJson(json['kind']) : null;
+ static FileSystemWatcher fromJson(Map<String, Object?> json) {
+ final globPatternJson = json['globPattern'];
+ final globPattern = globPatternJson as String;
+ final kindJson = json['kind'];
+ final kind = kindJson != null ? WatchKind.fromJson(kindJson as int) : null;
return FileSystemWatcher(globPattern: globPattern, kind: kind);
}
@@ -14498,8 +15071,8 @@
/// | WatchKind.Change | WatchKind.Delete which is 7.
final WatchKind? kind;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['globPattern'] = globPattern;
if (kind != null) {
__result['kind'] = kind?.toJson();
@@ -14508,18 +15081,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('globPattern');
try {
if (!obj.containsKey('globPattern')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['globPattern'] == null) {
+ final globPattern = obj['globPattern'];
+ if (globPattern == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['globPattern'] is String)) {
+ if (!(globPattern is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -14528,8 +15102,8 @@
}
reporter.push('kind');
try {
- if (obj['kind'] != null &&
- !(WatchKind.canParse(obj['kind'], reporter))) {
+ final kind = obj['kind'];
+ if (kind != null && !(WatchKind.canParse(kind, reporter))) {
reporter.reportError('must be of type WatchKind');
return false;
}
@@ -14576,13 +15150,18 @@
required this.endLine,
this.endCharacter,
this.kind});
- static FoldingRange fromJson(Map<String, dynamic> json) {
- final startLine = json['startLine'];
- final startCharacter = json['startCharacter'];
- final endLine = json['endLine'];
- final endCharacter = json['endCharacter'];
+ static FoldingRange fromJson(Map<String, Object?> json) {
+ final startLineJson = json['startLine'];
+ final startLine = startLineJson as int;
+ final startCharacterJson = json['startCharacter'];
+ final startCharacter = startCharacterJson as int?;
+ final endLineJson = json['endLine'];
+ final endLine = endLineJson as int;
+ final endCharacterJson = json['endCharacter'];
+ final endCharacter = endCharacterJson as int?;
+ final kindJson = json['kind'];
final kind =
- json['kind'] != null ? FoldingRangeKind.fromJson(json['kind']) : null;
+ kindJson != null ? FoldingRangeKind.fromJson(kindJson as String) : null;
return FoldingRange(
startLine: startLine,
startCharacter: startCharacter,
@@ -14615,8 +15194,8 @@
/// larger and smaller than the number of lines in the document.
final int startLine;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['startLine'] = startLine;
if (startCharacter != null) {
__result['startCharacter'] = startCharacter;
@@ -14632,18 +15211,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('startLine');
try {
if (!obj.containsKey('startLine')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['startLine'] == null) {
+ final startLine = obj['startLine'];
+ if (startLine == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['startLine'] is int)) {
+ if (!(startLine is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -14652,7 +15232,8 @@
}
reporter.push('startCharacter');
try {
- if (obj['startCharacter'] != null && !(obj['startCharacter'] is int)) {
+ final startCharacter = obj['startCharacter'];
+ if (startCharacter != null && !(startCharacter is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -14665,11 +15246,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['endLine'] == null) {
+ final endLine = obj['endLine'];
+ if (endLine == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['endLine'] is int)) {
+ if (!(endLine is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -14678,7 +15260,8 @@
}
reporter.push('endCharacter');
try {
- if (obj['endCharacter'] != null && !(obj['endCharacter'] is int)) {
+ final endCharacter = obj['endCharacter'];
+ if (endCharacter != null && !(endCharacter is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -14687,8 +15270,8 @@
}
reporter.push('kind');
try {
- if (obj['kind'] != null &&
- !(FoldingRangeKind.canParse(obj['kind'], reporter))) {
+ final kind = obj['kind'];
+ if (kind != null && !(FoldingRangeKind.canParse(kind, reporter))) {
reporter.reportError('must be of type FoldingRangeKind');
return false;
}
@@ -14737,10 +15320,13 @@
FoldingRangeClientCapabilities(
{this.dynamicRegistration, this.rangeLimit, this.lineFoldingOnly});
- static FoldingRangeClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final rangeLimit = json['rangeLimit'];
- final lineFoldingOnly = json['lineFoldingOnly'];
+ static FoldingRangeClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final rangeLimitJson = json['rangeLimit'];
+ final rangeLimit = rangeLimitJson as int?;
+ final lineFoldingOnlyJson = json['lineFoldingOnly'];
+ final lineFoldingOnly = lineFoldingOnlyJson as bool?;
return FoldingRangeClientCapabilities(
dynamicRegistration: dynamicRegistration,
rangeLimit: rangeLimit,
@@ -14763,8 +15349,8 @@
/// limit.
final int? rangeLimit;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -14778,11 +15364,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14791,7 +15377,8 @@
}
reporter.push('rangeLimit');
try {
- if (obj['rangeLimit'] != null && !(obj['rangeLimit'] is int)) {
+ final rangeLimit = obj['rangeLimit'];
+ if (rangeLimit != null && !(rangeLimit is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -14800,8 +15387,8 @@
}
reporter.push('lineFoldingOnly');
try {
- if (obj['lineFoldingOnly'] != null &&
- !(obj['lineFoldingOnly'] is bool)) {
+ final lineFoldingOnly = obj['lineFoldingOnly'];
+ if (lineFoldingOnly != null && !(lineFoldingOnly is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14876,18 +15463,19 @@
FoldingRangeOptions.canParse, FoldingRangeOptions.fromJson);
FoldingRangeOptions({this.workDoneProgress});
- static FoldingRangeOptions fromJson(Map<String, dynamic> json) {
+ static FoldingRangeOptions fromJson(Map<String, Object?> json) {
if (FoldingRangeRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return FoldingRangeRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return FoldingRangeOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -14895,11 +15483,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14942,22 +15530,26 @@
{required this.textDocument,
this.workDoneToken,
this.partialResultToken});
- static FoldingRangeParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final workDoneToken = json['workDoneToken'] == null
+ static FoldingRangeParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return FoldingRangeParams(
textDocument: textDocument,
workDoneToken: workDoneToken,
@@ -14974,8 +15566,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
if (workDoneToken != null) {
__result['workDoneToken'] = workDoneToken;
@@ -14987,18 +15579,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -15007,9 +15600,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -15018,9 +15611,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -15071,13 +15664,15 @@
FoldingRangeRegistrationOptions(
{this.documentSelector, this.workDoneProgress, this.id});
- static FoldingRangeRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
- final id = json['id'];
+ static FoldingRangeRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
+ final idJson = json['id'];
+ final id = idJson as String?;
return FoldingRangeRegistrationOptions(
documentSelector: documentSelector,
workDoneProgress: workDoneProgress,
@@ -15093,8 +15688,8 @@
final String? id;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -15106,16 +15701,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -15125,8 +15721,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15135,7 +15731,8 @@
}
reporter.push('id');
try {
- if (obj['id'] != null && !(obj['id'] is String)) {
+ final id = obj['id'];
+ if (id != null && !(id is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -15186,12 +15783,17 @@
this.trimTrailingWhitespace,
this.insertFinalNewline,
this.trimFinalNewlines});
- static FormattingOptions fromJson(Map<String, dynamic> json) {
- final tabSize = json['tabSize'];
- final insertSpaces = json['insertSpaces'];
- final trimTrailingWhitespace = json['trimTrailingWhitespace'];
- final insertFinalNewline = json['insertFinalNewline'];
- final trimFinalNewlines = json['trimFinalNewlines'];
+ static FormattingOptions fromJson(Map<String, Object?> json) {
+ final tabSizeJson = json['tabSize'];
+ final tabSize = tabSizeJson as int;
+ final insertSpacesJson = json['insertSpaces'];
+ final insertSpaces = insertSpacesJson as bool;
+ final trimTrailingWhitespaceJson = json['trimTrailingWhitespace'];
+ final trimTrailingWhitespace = trimTrailingWhitespaceJson as bool?;
+ final insertFinalNewlineJson = json['insertFinalNewline'];
+ final insertFinalNewline = insertFinalNewlineJson as bool?;
+ final trimFinalNewlinesJson = json['trimFinalNewlines'];
+ final trimFinalNewlines = trimFinalNewlinesJson as bool?;
return FormattingOptions(
tabSize: tabSize,
insertSpaces: insertSpaces,
@@ -15218,8 +15820,8 @@
/// @since 3.15.0
final bool? trimTrailingWhitespace;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['tabSize'] = tabSize;
__result['insertSpaces'] = insertSpaces;
if (trimTrailingWhitespace != null) {
@@ -15235,18 +15837,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('tabSize');
try {
if (!obj.containsKey('tabSize')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['tabSize'] == null) {
+ final tabSize = obj['tabSize'];
+ if (tabSize == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['tabSize'] is int)) {
+ if (!(tabSize is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -15259,11 +15862,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['insertSpaces'] == null) {
+ final insertSpaces = obj['insertSpaces'];
+ if (insertSpaces == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['insertSpaces'] is bool)) {
+ if (!(insertSpaces is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15272,8 +15876,9 @@
}
reporter.push('trimTrailingWhitespace');
try {
- if (obj['trimTrailingWhitespace'] != null &&
- !(obj['trimTrailingWhitespace'] is bool)) {
+ final trimTrailingWhitespace = obj['trimTrailingWhitespace'];
+ if (trimTrailingWhitespace != null &&
+ !(trimTrailingWhitespace is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15282,8 +15887,8 @@
}
reporter.push('insertFinalNewline');
try {
- if (obj['insertFinalNewline'] != null &&
- !(obj['insertFinalNewline'] is bool)) {
+ final insertFinalNewline = obj['insertFinalNewline'];
+ if (insertFinalNewline != null && !(insertFinalNewline is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15292,8 +15897,8 @@
}
reporter.push('trimFinalNewlines');
try {
- if (obj['trimFinalNewlines'] != null &&
- !(obj['trimFinalNewlines'] is bool)) {
+ final trimFinalNewlines = obj['trimFinalNewlines'];
+ if (trimFinalNewlines != null && !(trimFinalNewlines is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15340,14 +15945,18 @@
static const jsonHandler = LspJsonHandler(Hover.canParse, Hover.fromJson);
Hover({required this.contents, this.range});
- static Hover fromJson(Map<String, dynamic> json) {
- final contents = json['contents'] is String
- ? Either2<String, MarkupContent>.t1(json['contents'])
- : (MarkupContent.canParse(json['contents'], nullLspJsonReporter)
+ static Hover fromJson(Map<String, Object?> json) {
+ final contentsJson = json['contents'];
+ final contents = contentsJson is String
+ ? Either2<String, MarkupContent>.t1(contentsJson)
+ : (MarkupContent.canParse(contentsJson, nullLspJsonReporter)
? Either2<String, MarkupContent>.t2(
- MarkupContent.fromJson(json['contents']))
- : (throw '''${json['contents']} was not one of (String, MarkupContent)'''));
- final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+ MarkupContent.fromJson(contentsJson as Map<String, Object?>))
+ : (throw '''$contentsJson was not one of (String, MarkupContent)'''));
+ final rangeJson = json['range'];
+ final range = rangeJson != null
+ ? Range.fromJson(rangeJson as Map<String, Object?>)
+ : null;
return Hover(contents: contents, range: range);
}
@@ -15358,8 +15967,8 @@
/// visualize a hover, e.g. by changing the background color.
final Range? range;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['contents'] = contents;
if (range != null) {
__result['range'] = range?.toJson();
@@ -15368,19 +15977,20 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('contents');
try {
if (!obj.containsKey('contents')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['contents'] == null) {
+ final contents = obj['contents'];
+ if (contents == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['contents'] is String ||
- MarkupContent.canParse(obj['contents'], reporter)))) {
+ if (!((contents is String ||
+ MarkupContent.canParse(contents, reporter)))) {
reporter
.reportError('must be of type Either2<String, MarkupContent>');
return false;
@@ -15390,7 +16000,8 @@
}
reporter.push('range');
try {
- if (obj['range'] != null && !(Range.canParse(obj['range'], reporter))) {
+ final range = obj['range'];
+ if (range != null && !(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -15429,12 +16040,13 @@
HoverClientCapabilities.canParse, HoverClientCapabilities.fromJson);
HoverClientCapabilities({this.dynamicRegistration, this.contentFormat});
- static HoverClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final contentFormat = json['contentFormat']
- ?.map((item) => item != null ? MarkupKind.fromJson(item) : null)
- ?.cast<MarkupKind>()
- ?.toList();
+ static HoverClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final contentFormatJson = json['contentFormat'];
+ final contentFormat = (contentFormatJson as List<Object?>?)
+ ?.map((item) => MarkupKind.fromJson(item as String))
+ .toList();
return HoverClientCapabilities(
dynamicRegistration: dynamicRegistration, contentFormat: contentFormat);
}
@@ -15447,8 +16059,8 @@
/// Whether hover supports dynamic registration.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -15460,11 +16072,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15473,9 +16085,10 @@
}
reporter.push('contentFormat');
try {
- if (obj['contentFormat'] != null &&
- !((obj['contentFormat'] is List &&
- (obj['contentFormat']
+ final contentFormat = obj['contentFormat'];
+ if (contentFormat != null &&
+ !((contentFormat is List &&
+ (contentFormat
.every((item) => MarkupKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<MarkupKind>');
return false;
@@ -15519,18 +16132,19 @@
LspJsonHandler(HoverOptions.canParse, HoverOptions.fromJson);
HoverOptions({this.workDoneProgress});
- static HoverOptions fromJson(Map<String, dynamic> json) {
+ static HoverOptions fromJson(Map<String, Object?> json) {
if (HoverRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return HoverRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return HoverOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -15538,11 +16152,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15582,16 +16196,20 @@
HoverParams(
{required this.textDocument, required this.position, this.workDoneToken});
- static HoverParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
- final workDoneToken = json['workDoneToken'] == null
+ static HoverParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
return HoverParams(
textDocument: textDocument,
position: position,
@@ -15607,8 +16225,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
if (workDoneToken != null) {
@@ -15618,18 +16236,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -15642,11 +16261,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -15655,9 +16275,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -15701,12 +16321,13 @@
HoverRegistrationOptions.canParse, HoverRegistrationOptions.fromJson);
HoverRegistrationOptions({this.documentSelector, this.workDoneProgress});
- static HoverRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
+ static HoverRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return HoverRegistrationOptions(
documentSelector: documentSelector, workDoneProgress: workDoneProgress);
}
@@ -15716,8 +16337,8 @@
final List<DocumentFilter>? documentSelector;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -15726,16 +16347,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -15745,8 +16367,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15791,9 +16413,11 @@
ImplementationClientCapabilities(
{this.dynamicRegistration, this.linkSupport});
- static ImplementationClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
- final linkSupport = json['linkSupport'];
+ static ImplementationClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final linkSupportJson = json['linkSupport'];
+ final linkSupport = linkSupportJson as bool?;
return ImplementationClientCapabilities(
dynamicRegistration: dynamicRegistration, linkSupport: linkSupport);
}
@@ -15807,8 +16431,8 @@
/// @since 3.14.0
final bool? linkSupport;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -15819,11 +16443,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15832,7 +16456,8 @@
}
reporter.push('linkSupport');
try {
- if (obj['linkSupport'] != null && !(obj['linkSupport'] is bool)) {
+ final linkSupport = obj['linkSupport'];
+ if (linkSupport != null && !(linkSupport is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15874,18 +16499,19 @@
ImplementationOptions.canParse, ImplementationOptions.fromJson);
ImplementationOptions({this.workDoneProgress});
- static ImplementationOptions fromJson(Map<String, dynamic> json) {
+ static ImplementationOptions fromJson(Map<String, Object?> json) {
if (ImplementationRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return ImplementationRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return ImplementationOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -15893,11 +16519,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15945,23 +16571,28 @@
required this.position,
this.workDoneToken,
this.partialResultToken});
- static ImplementationParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
- final workDoneToken = json['workDoneToken'] == null
+ static ImplementationParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return ImplementationParams(
textDocument: textDocument,
position: position,
@@ -15982,8 +16613,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
if (workDoneToken != null) {
@@ -15996,18 +16627,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -16020,11 +16652,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -16033,9 +16666,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -16044,9 +16677,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -16099,13 +16732,15 @@
ImplementationRegistrationOptions(
{this.documentSelector, this.workDoneProgress, this.id});
- static ImplementationRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
- final id = json['id'];
+ static ImplementationRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
+ final idJson = json['id'];
+ final id = idJson as String?;
return ImplementationRegistrationOptions(
documentSelector: documentSelector,
workDoneProgress: workDoneProgress,
@@ -16121,8 +16756,8 @@
final String? id;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -16134,16 +16769,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -16153,8 +16789,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -16163,7 +16799,8 @@
}
reporter.push('id');
try {
- if (obj['id'] != null && !(obj['id'] is String)) {
+ final id = obj['id'];
+ if (id != null && !(id is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -16218,31 +16855,41 @@
this.trace,
this.workspaceFolders,
this.workDoneToken});
- static InitializeParams fromJson(Map<String, dynamic> json) {
- final processId = json['processId'];
- final clientInfo = json['clientInfo'] != null
- ? InitializeParamsClientInfo.fromJson(json['clientInfo'])
+ static InitializeParams fromJson(Map<String, Object?> json) {
+ final processIdJson = json['processId'];
+ final processId = processIdJson as int?;
+ final clientInfoJson = json['clientInfo'];
+ final clientInfo = clientInfoJson != null
+ ? InitializeParamsClientInfo.fromJson(
+ clientInfoJson as Map<String, Object?>)
: null;
- final locale = json['locale'];
- final rootPath = json['rootPath'];
- final rootUri = json['rootUri'];
- final initializationOptions = json['initializationOptions'];
- final capabilities = ClientCapabilities.fromJson(json['capabilities']);
- final trace = const {null, 'off', 'message', 'verbose'}
- .contains(json['trace'])
- ? json['trace']
- : throw '''${json['trace']} was not one of (null, 'off', 'message', 'verbose')''';
- final workspaceFolders = json['workspaceFolders']
- ?.map((item) => item != null ? WorkspaceFolder.fromJson(item) : null)
- ?.cast<WorkspaceFolder>()
- ?.toList();
- final workDoneToken = json['workDoneToken'] == null
+ final localeJson = json['locale'];
+ final locale = localeJson as String?;
+ final rootPathJson = json['rootPath'];
+ final rootPath = rootPathJson as String?;
+ final rootUriJson = json['rootUri'];
+ final rootUri = rootUriJson as String?;
+ final initializationOptionsJson = json['initializationOptions'];
+ final initializationOptions = initializationOptionsJson;
+ final capabilitiesJson = json['capabilities'];
+ final capabilities =
+ ClientCapabilities.fromJson(capabilitiesJson as Map<String, Object?>);
+ final traceJson = json['trace'];
+ final trace = const {null, 'off', 'message', 'verbose'}.contains(traceJson)
+ ? traceJson as String?
+ : throw '''$traceJson was not one of (null, 'off', 'message', 'verbose')''';
+ final workspaceFoldersJson = json['workspaceFolders'];
+ final workspaceFolders = (workspaceFoldersJson as List<Object?>?)
+ ?.map((item) => WorkspaceFolder.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
return InitializeParams(
processId: processId,
clientInfo: clientInfo,
@@ -16264,7 +16911,7 @@
final InitializeParamsClientInfo? clientInfo;
/// User provided initialization options.
- final dynamic initializationOptions;
+ final Object? initializationOptions;
/// The locale the client is currently showing the user interface in. This
/// must not necessarily be the locale of the operating system.
@@ -16302,8 +16949,8 @@
/// @since 3.6.0
final List<WorkspaceFolder>? workspaceFolders;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['processId'] = processId;
if (clientInfo != null) {
__result['clientInfo'] = clientInfo?.toJson();
@@ -16333,14 +16980,15 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('processId');
try {
if (!obj.containsKey('processId')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['processId'] != null && !(obj['processId'] is int)) {
+ final processId = obj['processId'];
+ if (processId != null && !(processId is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -16349,9 +16997,9 @@
}
reporter.push('clientInfo');
try {
- if (obj['clientInfo'] != null &&
- !(InitializeParamsClientInfo.canParse(
- obj['clientInfo'], reporter))) {
+ final clientInfo = obj['clientInfo'];
+ if (clientInfo != null &&
+ !(InitializeParamsClientInfo.canParse(clientInfo, reporter))) {
reporter.reportError('must be of type InitializeParamsClientInfo');
return false;
}
@@ -16360,7 +17008,8 @@
}
reporter.push('locale');
try {
- if (obj['locale'] != null && !(obj['locale'] is String)) {
+ final locale = obj['locale'];
+ if (locale != null && !(locale is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -16369,7 +17018,8 @@
}
reporter.push('rootPath');
try {
- if (obj['rootPath'] != null && !(obj['rootPath'] is String)) {
+ final rootPath = obj['rootPath'];
+ if (rootPath != null && !(rootPath is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -16382,7 +17032,8 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['rootUri'] != null && !(obj['rootUri'] is String)) {
+ final rootUri = obj['rootUri'];
+ if (rootUri != null && !(rootUri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -16395,11 +17046,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['capabilities'] == null) {
+ final capabilities = obj['capabilities'];
+ if (capabilities == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(ClientCapabilities.canParse(obj['capabilities'], reporter))) {
+ if (!(ClientCapabilities.canParse(capabilities, reporter))) {
reporter.reportError('must be of type ClientCapabilities');
return false;
}
@@ -16408,10 +17060,9 @@
}
reporter.push('trace');
try {
- if (obj['trace'] != null &&
- !((obj['trace'] == 'off' ||
- obj['trace'] == 'message' ||
- obj['trace'] == 'verbose'))) {
+ final trace = obj['trace'];
+ if (trace != null &&
+ !((trace == 'off' || trace == 'message' || trace == 'verbose'))) {
reporter.reportError('must be of type String');
return false;
}
@@ -16420,9 +17071,10 @@
}
reporter.push('workspaceFolders');
try {
- if (obj['workspaceFolders'] != null &&
- !((obj['workspaceFolders'] is List &&
- (obj['workspaceFolders'].every(
+ final workspaceFolders = obj['workspaceFolders'];
+ if (workspaceFolders != null &&
+ !((workspaceFolders is List &&
+ (workspaceFolders.every(
(item) => WorkspaceFolder.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<WorkspaceFolder>');
return false;
@@ -16432,9 +17084,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -16492,9 +17144,11 @@
InitializeParamsClientInfo.canParse, InitializeParamsClientInfo.fromJson);
InitializeParamsClientInfo({required this.name, this.version});
- static InitializeParamsClientInfo fromJson(Map<String, dynamic> json) {
- final name = json['name'];
- final version = json['version'];
+ static InitializeParamsClientInfo fromJson(Map<String, Object?> json) {
+ final nameJson = json['name'];
+ final name = nameJson as String;
+ final versionJson = json['version'];
+ final version = versionJson as String?;
return InitializeParamsClientInfo(name: name, version: version);
}
@@ -16504,8 +17158,8 @@
/// The client's version as defined by the client.
final String? version;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['name'] = name;
if (version != null) {
__result['version'] = version;
@@ -16514,18 +17168,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('name');
try {
if (!obj.containsKey('name')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['name'] == null) {
+ final name = obj['name'];
+ if (name == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['name'] is String)) {
+ if (!(name is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -16534,7 +17189,8 @@
}
reporter.push('version');
try {
- if (obj['version'] != null && !(obj['version'] is String)) {
+ final version = obj['version'];
+ if (version != null && !(version is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -16574,10 +17230,14 @@
LspJsonHandler(InitializeResult.canParse, InitializeResult.fromJson);
InitializeResult({required this.capabilities, this.serverInfo});
- static InitializeResult fromJson(Map<String, dynamic> json) {
- final capabilities = ServerCapabilities.fromJson(json['capabilities']);
- final serverInfo = json['serverInfo'] != null
- ? InitializeResultServerInfo.fromJson(json['serverInfo'])
+ static InitializeResult fromJson(Map<String, Object?> json) {
+ final capabilitiesJson = json['capabilities'];
+ final capabilities =
+ ServerCapabilities.fromJson(capabilitiesJson as Map<String, Object?>);
+ final serverInfoJson = json['serverInfo'];
+ final serverInfo = serverInfoJson != null
+ ? InitializeResultServerInfo.fromJson(
+ serverInfoJson as Map<String, Object?>)
: null;
return InitializeResult(capabilities: capabilities, serverInfo: serverInfo);
}
@@ -16589,8 +17249,8 @@
/// @since 3.15.0
final InitializeResultServerInfo? serverInfo;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['capabilities'] = capabilities.toJson();
if (serverInfo != null) {
__result['serverInfo'] = serverInfo?.toJson();
@@ -16599,18 +17259,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('capabilities');
try {
if (!obj.containsKey('capabilities')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['capabilities'] == null) {
+ final capabilities = obj['capabilities'];
+ if (capabilities == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(ServerCapabilities.canParse(obj['capabilities'], reporter))) {
+ if (!(ServerCapabilities.canParse(capabilities, reporter))) {
reporter.reportError('must be of type ServerCapabilities');
return false;
}
@@ -16619,9 +17280,9 @@
}
reporter.push('serverInfo');
try {
- if (obj['serverInfo'] != null &&
- !(InitializeResultServerInfo.canParse(
- obj['serverInfo'], reporter))) {
+ final serverInfo = obj['serverInfo'];
+ if (serverInfo != null &&
+ !(InitializeResultServerInfo.canParse(serverInfo, reporter))) {
reporter.reportError('must be of type InitializeResultServerInfo');
return false;
}
@@ -16662,9 +17323,11 @@
InitializeResultServerInfo.canParse, InitializeResultServerInfo.fromJson);
InitializeResultServerInfo({required this.name, this.version});
- static InitializeResultServerInfo fromJson(Map<String, dynamic> json) {
- final name = json['name'];
- final version = json['version'];
+ static InitializeResultServerInfo fromJson(Map<String, Object?> json) {
+ final nameJson = json['name'];
+ final name = nameJson as String;
+ final versionJson = json['version'];
+ final version = versionJson as String?;
return InitializeResultServerInfo(name: name, version: version);
}
@@ -16674,8 +17337,8 @@
/// The server's version as defined by the server.
final String? version;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['name'] = name;
if (version != null) {
__result['version'] = version;
@@ -16684,18 +17347,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('name');
try {
if (!obj.containsKey('name')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['name'] == null) {
+ final name = obj['name'];
+ if (name == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['name'] is String)) {
+ if (!(name is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -16704,7 +17368,8 @@
}
reporter.push('version');
try {
- if (obj['version'] != null && !(obj['version'] is String)) {
+ final version = obj['version'];
+ if (version != null && !(version is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -16743,17 +17408,17 @@
static const jsonHandler =
LspJsonHandler(InitializedParams.canParse, InitializedParams.fromJson);
- static InitializedParams fromJson(Map<String, dynamic> json) {
+ static InitializedParams fromJson(Map<String, Object?> json) {
return InitializedParams();
}
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
return true;
} else {
reporter.reportError('must be of type InitializedParams');
@@ -16787,10 +17452,13 @@
InsertReplaceEdit(
{required this.newText, required this.insert, required this.replace});
- static InsertReplaceEdit fromJson(Map<String, dynamic> json) {
- final newText = json['newText'];
- final insert = Range.fromJson(json['insert']);
- final replace = Range.fromJson(json['replace']);
+ static InsertReplaceEdit fromJson(Map<String, Object?> json) {
+ final newTextJson = json['newText'];
+ final newText = newTextJson as String;
+ final insertJson = json['insert'];
+ final insert = Range.fromJson(insertJson as Map<String, Object?>);
+ final replaceJson = json['replace'];
+ final replace = Range.fromJson(replaceJson as Map<String, Object?>);
return InsertReplaceEdit(
newText: newText, insert: insert, replace: replace);
}
@@ -16804,8 +17472,8 @@
/// The range if the replace is requested.
final Range replace;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['newText'] = newText;
__result['insert'] = insert.toJson();
__result['replace'] = replace.toJson();
@@ -16813,18 +17481,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('newText');
try {
if (!obj.containsKey('newText')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['newText'] == null) {
+ final newText = obj['newText'];
+ if (newText == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['newText'] is String)) {
+ if (!(newText is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -16837,11 +17506,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['insert'] == null) {
+ final insert = obj['insert'];
+ if (insert == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['insert'], reporter))) {
+ if (!(Range.canParse(insert, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -16854,11 +17524,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['replace'] == null) {
+ final replace = obj['replace'];
+ if (replace == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['replace'], reporter))) {
+ if (!(Range.canParse(replace, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -16979,8 +17650,9 @@
LinkedEditingRangeClientCapabilities({this.dynamicRegistration});
static LinkedEditingRangeClientCapabilities fromJson(
- Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return LinkedEditingRangeClientCapabilities(
dynamicRegistration: dynamicRegistration);
}
@@ -16991,8 +17663,8 @@
/// capability as well.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -17000,11 +17672,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -17044,19 +17716,20 @@
LinkedEditingRangeOptions.canParse, LinkedEditingRangeOptions.fromJson);
LinkedEditingRangeOptions({this.workDoneProgress});
- static LinkedEditingRangeOptions fromJson(Map<String, dynamic> json) {
+ static LinkedEditingRangeOptions fromJson(Map<String, Object?> json) {
if (LinkedEditingRangeRegistrationOptions.canParse(
json, nullLspJsonReporter)) {
return LinkedEditingRangeRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return LinkedEditingRangeOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -17064,11 +17737,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -17109,16 +17782,20 @@
LinkedEditingRangeParams(
{required this.textDocument, required this.position, this.workDoneToken});
- static LinkedEditingRangeParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
- final workDoneToken = json['workDoneToken'] == null
+ static LinkedEditingRangeParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
return LinkedEditingRangeParams(
textDocument: textDocument,
position: position,
@@ -17134,8 +17811,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
if (workDoneToken != null) {
@@ -17145,18 +17822,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -17169,11 +17847,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -17182,9 +17861,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -17236,13 +17915,15 @@
LinkedEditingRangeRegistrationOptions(
{this.documentSelector, this.workDoneProgress, this.id});
static LinkedEditingRangeRegistrationOptions fromJson(
- Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
- final id = json['id'];
+ Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
+ final idJson = json['id'];
+ final id = idJson as String?;
return LinkedEditingRangeRegistrationOptions(
documentSelector: documentSelector,
workDoneProgress: workDoneProgress,
@@ -17258,8 +17939,8 @@
final String? id;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -17271,16 +17952,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -17290,8 +17972,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -17300,7 +17982,8 @@
}
reporter.push('id');
try {
- if (obj['id'] != null && !(obj['id'] is String)) {
+ final id = obj['id'];
+ if (id != null && !(id is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -17346,12 +18029,13 @@
LinkedEditingRanges.canParse, LinkedEditingRanges.fromJson);
LinkedEditingRanges({required this.ranges, this.wordPattern});
- static LinkedEditingRanges fromJson(Map<String, dynamic> json) {
- final ranges = json['ranges']
- ?.map((item) => Range.fromJson(item))
- ?.cast<Range>()
- ?.toList();
- final wordPattern = json['wordPattern'];
+ static LinkedEditingRanges fromJson(Map<String, Object?> json) {
+ final rangesJson = json['ranges'];
+ final ranges = (rangesJson as List<Object?>)
+ .map((item) => Range.fromJson(item as Map<String, Object?>))
+ .toList();
+ final wordPatternJson = json['wordPattern'];
+ final wordPattern = wordPatternJson as String?;
return LinkedEditingRanges(ranges: ranges, wordPattern: wordPattern);
}
@@ -17365,8 +18049,8 @@
/// configuration's word pattern will be used.
final String? wordPattern;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['ranges'] = ranges.map((item) => item.toJson()).toList();
if (wordPattern != null) {
__result['wordPattern'] = wordPattern;
@@ -17375,19 +18059,20 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('ranges');
try {
if (!obj.containsKey('ranges')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['ranges'] == null) {
+ final ranges = obj['ranges'];
+ if (ranges == null) {
reporter.reportError('must not be null');
return false;
}
- if (!((obj['ranges'] is List &&
- (obj['ranges'].every((item) => Range.canParse(item, reporter)))))) {
+ if (!((ranges is List &&
+ (ranges.every((item) => Range.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Range>');
return false;
}
@@ -17396,7 +18081,8 @@
}
reporter.push('wordPattern');
try {
- if (obj['wordPattern'] != null && !(obj['wordPattern'] is String)) {
+ final wordPattern = obj['wordPattern'];
+ if (wordPattern != null && !(wordPattern is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -17438,35 +18124,38 @@
LspJsonHandler(Location.canParse, Location.fromJson);
Location({required this.uri, required this.range});
- static Location fromJson(Map<String, dynamic> json) {
- final uri = json['uri'];
- final range = Range.fromJson(json['range']);
+ static Location fromJson(Map<String, Object?> json) {
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
+ final rangeJson = json['range'];
+ final range = Range.fromJson(rangeJson as Map<String, Object?>);
return Location(uri: uri, range: range);
}
final Range range;
final String uri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['uri'] = uri;
__result['range'] = range.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('uri');
try {
if (!obj.containsKey('uri')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -17479,11 +18168,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['range'] == null) {
+ final range = obj['range'];
+ if (range == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['range'], reporter))) {
+ if (!(Range.canParse(range, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -17526,13 +18216,18 @@
required this.targetUri,
required this.targetRange,
required this.targetSelectionRange});
- static LocationLink fromJson(Map<String, dynamic> json) {
- final originSelectionRange = json['originSelectionRange'] != null
- ? Range.fromJson(json['originSelectionRange'])
+ static LocationLink fromJson(Map<String, Object?> json) {
+ final originSelectionRangeJson = json['originSelectionRange'];
+ final originSelectionRange = originSelectionRangeJson != null
+ ? Range.fromJson(originSelectionRangeJson as Map<String, Object?>)
: null;
- final targetUri = json['targetUri'];
- final targetRange = Range.fromJson(json['targetRange']);
- final targetSelectionRange = Range.fromJson(json['targetSelectionRange']);
+ final targetUriJson = json['targetUri'];
+ final targetUri = targetUriJson as String;
+ final targetRangeJson = json['targetRange'];
+ final targetRange = Range.fromJson(targetRangeJson as Map<String, Object?>);
+ final targetSelectionRangeJson = json['targetSelectionRange'];
+ final targetSelectionRange =
+ Range.fromJson(targetSelectionRangeJson as Map<String, Object?>);
return LocationLink(
originSelectionRange: originSelectionRange,
targetUri: targetUri,
@@ -17560,8 +18255,8 @@
/// The target resource identifier of this link.
final String targetUri;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (originSelectionRange != null) {
__result['originSelectionRange'] = originSelectionRange?.toJson();
}
@@ -17572,11 +18267,12 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('originSelectionRange');
try {
- if (obj['originSelectionRange'] != null &&
- !(Range.canParse(obj['originSelectionRange'], reporter))) {
+ final originSelectionRange = obj['originSelectionRange'];
+ if (originSelectionRange != null &&
+ !(Range.canParse(originSelectionRange, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -17589,11 +18285,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['targetUri'] == null) {
+ final targetUri = obj['targetUri'];
+ if (targetUri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['targetUri'] is String)) {
+ if (!(targetUri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -17606,11 +18303,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['targetRange'] == null) {
+ final targetRange = obj['targetRange'];
+ if (targetRange == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['targetRange'], reporter))) {
+ if (!(Range.canParse(targetRange, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -17623,11 +18321,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['targetSelectionRange'] == null) {
+ final targetSelectionRange = obj['targetSelectionRange'];
+ if (targetSelectionRange == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(obj['targetSelectionRange'], reporter))) {
+ if (!(Range.canParse(targetSelectionRange, reporter))) {
reporter.reportError('must be of type Range');
return false;
}
@@ -17672,9 +18371,11 @@
LspJsonHandler(LogMessageParams.canParse, LogMessageParams.fromJson);
LogMessageParams({required this.type, required this.message});
- static LogMessageParams fromJson(Map<String, dynamic> json) {
- final type = MessageType.fromJson(json['type']);
- final message = json['message'];
+ static LogMessageParams fromJson(Map<String, Object?> json) {
+ final typeJson = json['type'];
+ final type = MessageType.fromJson(typeJson as int);
+ final messageJson = json['message'];
+ final message = messageJson as String;
return LogMessageParams(type: type, message: message);
}
@@ -17684,26 +18385,27 @@
/// The message type.
final MessageType type;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['type'] = type.toJson();
__result['message'] = message;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('type');
try {
if (!obj.containsKey('type')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['type'] == null) {
+ final type = obj['type'];
+ if (type == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(MessageType.canParse(obj['type'], reporter))) {
+ if (!(MessageType.canParse(type, reporter))) {
reporter.reportError('must be of type MessageType');
return false;
}
@@ -17716,11 +18418,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['message'] == null) {
+ final message = obj['message'];
+ if (message == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['message'] is String)) {
+ if (!(message is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -17759,9 +18462,11 @@
LspJsonHandler(LogTraceParams.canParse, LogTraceParams.fromJson);
LogTraceParams({required this.message, this.verbose});
- static LogTraceParams fromJson(Map<String, dynamic> json) {
- final message = json['message'];
- final verbose = json['verbose'];
+ static LogTraceParams fromJson(Map<String, Object?> json) {
+ final messageJson = json['message'];
+ final message = messageJson as String;
+ final verboseJson = json['verbose'];
+ final verbose = verboseJson as String?;
return LogTraceParams(message: message, verbose: verbose);
}
@@ -17772,8 +18477,8 @@
/// is set to `'verbose'`
final String? verbose;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['message'] = message;
if (verbose != null) {
__result['verbose'] = verbose;
@@ -17782,18 +18487,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('message');
try {
if (!obj.containsKey('message')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['message'] == null) {
+ final message = obj['message'];
+ if (message == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['message'] is String)) {
+ if (!(message is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -17802,7 +18508,8 @@
}
reporter.push('verbose');
try {
- if (obj['verbose'] != null && !(obj['verbose'] is String)) {
+ final verbose = obj['verbose'];
+ if (verbose != null && !(verbose is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -17843,9 +18550,11 @@
MarkdownClientCapabilities.canParse, MarkdownClientCapabilities.fromJson);
MarkdownClientCapabilities({required this.parser, this.version});
- static MarkdownClientCapabilities fromJson(Map<String, dynamic> json) {
- final parser = json['parser'];
- final version = json['version'];
+ static MarkdownClientCapabilities fromJson(Map<String, Object?> json) {
+ final parserJson = json['parser'];
+ final parser = parserJson as String;
+ final versionJson = json['version'];
+ final version = versionJson as String?;
return MarkdownClientCapabilities(parser: parser, version: version);
}
@@ -17855,8 +18564,8 @@
/// The version of the parser.
final String? version;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['parser'] = parser;
if (version != null) {
__result['version'] = version;
@@ -17865,18 +18574,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('parser');
try {
if (!obj.containsKey('parser')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['parser'] == null) {
+ final parser = obj['parser'];
+ if (parser == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['parser'] is String)) {
+ if (!(parser is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -17885,7 +18595,8 @@
}
reporter.push('version');
try {
- if (obj['version'] != null && !(obj['version'] is String)) {
+ final version = obj['version'];
+ if (version != null && !(version is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -17946,9 +18657,11 @@
LspJsonHandler(MarkupContent.canParse, MarkupContent.fromJson);
MarkupContent({required this.kind, required this.value});
- static MarkupContent fromJson(Map<String, dynamic> json) {
- final kind = MarkupKind.fromJson(json['kind']);
- final value = json['value'];
+ static MarkupContent fromJson(Map<String, Object?> json) {
+ final kindJson = json['kind'];
+ final kind = MarkupKind.fromJson(kindJson as String);
+ final valueJson = json['value'];
+ final value = valueJson as String;
return MarkupContent(kind: kind, value: value);
}
@@ -17958,26 +18671,27 @@
/// The content itself
final String value;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['kind'] = kind.toJson();
__result['value'] = value;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('kind');
try {
if (!obj.containsKey('kind')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['kind'] == null) {
+ final kind = obj['kind'];
+ if (kind == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(MarkupKind.canParse(obj['kind'], reporter))) {
+ if (!(MarkupKind.canParse(kind, reporter))) {
reporter.reportError('must be of type MarkupKind');
return false;
}
@@ -17990,11 +18704,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['value'] == null) {
+ final value = obj['value'];
+ if (value == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['value'] is String)) {
+ if (!(value is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -18069,7 +18784,7 @@
static const jsonHandler = LspJsonHandler(Message.canParse, Message.fromJson);
Message({required this.jsonrpc});
- static Message fromJson(Map<String, dynamic> json) {
+ static Message fromJson(Map<String, Object?> json) {
if (RequestMessage.canParse(json, nullLspJsonReporter)) {
return RequestMessage.fromJson(json);
}
@@ -18079,31 +18794,33 @@
if (NotificationMessage.canParse(json, nullLspJsonReporter)) {
return NotificationMessage.fromJson(json);
}
- final jsonrpc = json['jsonrpc'];
+ final jsonrpcJson = json['jsonrpc'];
+ final jsonrpc = jsonrpcJson as String;
return Message(jsonrpc: jsonrpc);
}
final String jsonrpc;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['jsonrpc'] = jsonrpc;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('jsonrpc');
try {
if (!obj.containsKey('jsonrpc')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['jsonrpc'] == null) {
+ final jsonrpc = obj['jsonrpc'];
+ if (jsonrpc == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['jsonrpc'] is String)) {
+ if (!(jsonrpc is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -18141,33 +18858,35 @@
LspJsonHandler(MessageActionItem.canParse, MessageActionItem.fromJson);
MessageActionItem({required this.title});
- static MessageActionItem fromJson(Map<String, dynamic> json) {
- final title = json['title'];
+ static MessageActionItem fromJson(Map<String, Object?> json) {
+ final titleJson = json['title'];
+ final title = titleJson as String;
return MessageActionItem(title: title);
}
/// A short title like 'Retry', 'Open Log' etc.
final String title;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['title'] = title;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('title');
try {
if (!obj.containsKey('title')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['title'] == null) {
+ final title = obj['title'];
+ if (title == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['title'] is String)) {
+ if (!(title is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -18515,12 +19234,16 @@
required this.identifier,
required this.unique,
this.kind});
- static Moniker fromJson(Map<String, dynamic> json) {
- final scheme = json['scheme'];
- final identifier = json['identifier'];
- final unique = UniquenessLevel.fromJson(json['unique']);
+ static Moniker fromJson(Map<String, Object?> json) {
+ final schemeJson = json['scheme'];
+ final scheme = schemeJson as String;
+ final identifierJson = json['identifier'];
+ final identifier = identifierJson as String;
+ final uniqueJson = json['unique'];
+ final unique = UniquenessLevel.fromJson(uniqueJson as String);
+ final kindJson = json['kind'];
final kind =
- json['kind'] != null ? MonikerKind.fromJson(json['kind']) : null;
+ kindJson != null ? MonikerKind.fromJson(kindJson as String) : null;
return Moniker(
scheme: scheme, identifier: identifier, unique: unique, kind: kind);
}
@@ -18538,8 +19261,8 @@
/// The scope in which the moniker is unique
final UniquenessLevel unique;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['scheme'] = scheme;
__result['identifier'] = identifier;
__result['unique'] = unique.toJson();
@@ -18550,18 +19273,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('scheme');
try {
if (!obj.containsKey('scheme')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['scheme'] == null) {
+ final scheme = obj['scheme'];
+ if (scheme == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['scheme'] is String)) {
+ if (!(scheme is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -18574,11 +19298,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['identifier'] == null) {
+ final identifier = obj['identifier'];
+ if (identifier == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['identifier'] is String)) {
+ if (!(identifier is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -18591,11 +19316,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['unique'] == null) {
+ final unique = obj['unique'];
+ if (unique == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(UniquenessLevel.canParse(obj['unique'], reporter))) {
+ if (!(UniquenessLevel.canParse(unique, reporter))) {
reporter.reportError('must be of type UniquenessLevel');
return false;
}
@@ -18604,8 +19330,8 @@
}
reporter.push('kind');
try {
- if (obj['kind'] != null &&
- !(MonikerKind.canParse(obj['kind'], reporter))) {
+ final kind = obj['kind'];
+ if (kind != null && !(MonikerKind.canParse(kind, reporter))) {
reporter.reportError('must be of type MonikerKind');
return false;
}
@@ -18650,8 +19376,9 @@
MonikerClientCapabilities.canParse, MonikerClientCapabilities.fromJson);
MonikerClientCapabilities({this.dynamicRegistration});
- static MonikerClientCapabilities fromJson(Map<String, dynamic> json) {
- final dynamicRegistration = json['dynamicRegistration'];
+ static MonikerClientCapabilities fromJson(Map<String, Object?> json) {
+ final dynamicRegistrationJson = json['dynamicRegistration'];
+ final dynamicRegistration = dynamicRegistrationJson as bool?;
return MonikerClientCapabilities(dynamicRegistration: dynamicRegistration);
}
@@ -18661,8 +19388,8 @@
/// capability as well.
final bool? dynamicRegistration;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (dynamicRegistration != null) {
__result['dynamicRegistration'] = dynamicRegistration;
}
@@ -18670,11 +19397,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('dynamicRegistration');
try {
- if (obj['dynamicRegistration'] != null &&
- !(obj['dynamicRegistration'] is bool)) {
+ final dynamicRegistration = obj['dynamicRegistration'];
+ if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -18745,18 +19472,19 @@
LspJsonHandler(MonikerOptions.canParse, MonikerOptions.fromJson);
MonikerOptions({this.workDoneProgress});
- static MonikerOptions fromJson(Map<String, dynamic> json) {
+ static MonikerOptions fromJson(Map<String, Object?> json) {
if (MonikerRegistrationOptions.canParse(json, nullLspJsonReporter)) {
return MonikerRegistrationOptions.fromJson(json);
}
- final workDoneProgress = json['workDoneProgress'];
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return MonikerOptions(workDoneProgress: workDoneProgress);
}
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
}
@@ -18764,11 +19492,11 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -18815,23 +19543,28 @@
required this.position,
this.workDoneToken,
this.partialResultToken});
- static MonikerParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
- final workDoneToken = json['workDoneToken'] == null
+ static MonikerParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
? null
- : (json['workDoneToken'] is int
- ? Either2<int, String>.t1(json['workDoneToken'])
- : (json['workDoneToken'] is String
- ? Either2<int, String>.t2(json['workDoneToken'])
- : (throw '''${json['workDoneToken']} was not one of (int, String)''')));
- final partialResultToken = json['partialResultToken'] == null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return MonikerParams(
textDocument: textDocument,
position: position,
@@ -18852,8 +19585,8 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
if (workDoneToken != null) {
@@ -18866,18 +19599,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -18890,11 +19624,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -18903,9 +19638,9 @@
}
reporter.push('workDoneToken');
try {
- if (obj['workDoneToken'] != null &&
- !((obj['workDoneToken'] is int ||
- obj['workDoneToken'] is String))) {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ !((workDoneToken is int || workDoneToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -18914,9 +19649,9 @@
}
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -18962,12 +19697,13 @@
MonikerRegistrationOptions.canParse, MonikerRegistrationOptions.fromJson);
MonikerRegistrationOptions({this.documentSelector, this.workDoneProgress});
- static MonikerRegistrationOptions fromJson(Map<String, dynamic> json) {
- final documentSelector = json['documentSelector']
- ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
- ?.cast<DocumentFilter>()
- ?.toList();
- final workDoneProgress = json['workDoneProgress'];
+ static MonikerRegistrationOptions fromJson(Map<String, Object?> json) {
+ final documentSelectorJson = json['documentSelector'];
+ final documentSelector = (documentSelectorJson as List<Object?>?)
+ ?.map((item) => DocumentFilter.fromJson(item as Map<String, Object?>))
+ .toList();
+ final workDoneProgressJson = json['workDoneProgress'];
+ final workDoneProgress = workDoneProgressJson as bool?;
return MonikerRegistrationOptions(
documentSelector: documentSelector, workDoneProgress: workDoneProgress);
}
@@ -18977,8 +19713,8 @@
final List<DocumentFilter>? documentSelector;
final bool? workDoneProgress;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['documentSelector'] = documentSelector;
if (workDoneProgress != null) {
__result['workDoneProgress'] = workDoneProgress;
@@ -18987,16 +19723,17 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('documentSelector');
try {
if (!obj.containsKey('documentSelector')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['documentSelector'] != null &&
- !((obj['documentSelector'] is List &&
- (obj['documentSelector'].every(
+ final documentSelector = obj['documentSelector'];
+ if (documentSelector != null &&
+ !((documentSelector is List &&
+ (documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
return false;
@@ -19006,8 +19743,8 @@
}
reporter.push('workDoneProgress');
try {
- if (obj['workDoneProgress'] != null &&
- !(obj['workDoneProgress'] is bool)) {
+ final workDoneProgress = obj['workDoneProgress'];
+ if (workDoneProgress != null && !(workDoneProgress is bool)) {
reporter.reportError('must be of type bool');
return false;
}
@@ -19051,10 +19788,13 @@
NotificationMessage(
{required this.method, this.params, required this.jsonrpc});
- static NotificationMessage fromJson(Map<String, dynamic> json) {
- final method = Method.fromJson(json['method']);
- final params = json['params'];
- final jsonrpc = json['jsonrpc'];
+ static NotificationMessage fromJson(Map<String, Object?> json) {
+ final methodJson = json['method'];
+ final method = Method.fromJson(methodJson as String);
+ final paramsJson = json['params'];
+ final params = paramsJson;
+ final jsonrpcJson = json['jsonrpc'];
+ final jsonrpc = jsonrpcJson as String;
return NotificationMessage(
method: method, params: params, jsonrpc: jsonrpc);
}
@@ -19065,10 +19805,10 @@
final Method method;
/// The notification's params.
- final dynamic params;
+ final Object? params;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['method'] = method.toJson();
if (params != null) {
__result['params'] = params;
@@ -19078,18 +19818,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('method');
try {
if (!obj.containsKey('method')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['method'] == null) {
+ final method = obj['method'];
+ if (method == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Method.canParse(obj['method'], reporter))) {
+ if (!(Method.canParse(method, reporter))) {
reporter.reportError('must be of type Method');
return false;
}
@@ -19102,11 +19843,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['jsonrpc'] == null) {
+ final jsonrpc = obj['jsonrpc'];
+ if (jsonrpc == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['jsonrpc'] is String)) {
+ if (!(jsonrpc is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -19153,9 +19895,11 @@
OptionalVersionedTextDocumentIdentifier({this.version, required this.uri});
static OptionalVersionedTextDocumentIdentifier fromJson(
- Map<String, dynamic> json) {
- final version = json['version'];
- final uri = json['uri'];
+ Map<String, Object?> json) {
+ final versionJson = json['version'];
+ final version = versionJson as int?;
+ final uriJson = json['uri'];
+ final uri = uriJson as String;
return OptionalVersionedTextDocumentIdentifier(version: version, uri: uri);
}
@@ -19173,22 +19917,23 @@
/// including undo/redo. The number doesn't need to be consecutive.
final int? version;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['version'] = version;
__result['uri'] = uri;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('version');
try {
if (!obj.containsKey('version')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['version'] != null && !(obj['version'] is int)) {
+ final version = obj['version'];
+ if (version != null && !(version is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -19201,11 +19946,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['uri'] == null) {
+ final uri = obj['uri'];
+ if (uri == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['uri'] is String)) {
+ if (!(uri is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -19248,17 +19994,18 @@
ParameterInformation.canParse, ParameterInformation.fromJson);
ParameterInformation({required this.label, this.documentation});
- static ParameterInformation fromJson(Map<String, dynamic> json) {
- final label = json['label'];
- final documentation = json['documentation'] == null
+ static ParameterInformation fromJson(Map<String, Object?> json) {
+ final labelJson = json['label'];
+ final label = labelJson as String;
+ final documentationJson = json['documentation'];
+ final documentation = documentationJson == null
? null
- : (json['documentation'] is String
- ? Either2<String, MarkupContent>.t1(json['documentation'])
- : (MarkupContent.canParse(
- json['documentation'], nullLspJsonReporter)
- ? Either2<String, MarkupContent>.t2(
- MarkupContent.fromJson(json['documentation']))
- : (throw '''${json['documentation']} was not one of (String, MarkupContent)''')));
+ : (documentationJson is String
+ ? Either2<String, MarkupContent>.t1(documentationJson)
+ : (MarkupContent.canParse(documentationJson, nullLspJsonReporter)
+ ? Either2<String, MarkupContent>.t2(MarkupContent.fromJson(
+ documentationJson as Map<String, Object?>))
+ : (throw '''$documentationJson was not one of (String, MarkupContent)''')));
return ParameterInformation(label: label, documentation: documentation);
}
@@ -19278,8 +20025,8 @@
/// part in the `SignatureInformation.label`.
final String label;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['label'] = label;
if (documentation != null) {
__result['documentation'] = documentation;
@@ -19288,18 +20035,19 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('label');
try {
if (!obj.containsKey('label')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['label'] == null) {
+ final label = obj['label'];
+ if (label == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['label'] is String)) {
+ if (!(label is String)) {
reporter.reportError('must be of type String');
return false;
}
@@ -19308,9 +20056,10 @@
}
reporter.push('documentation');
try {
- if (obj['documentation'] != null &&
- !((obj['documentation'] is String ||
- MarkupContent.canParse(obj['documentation'], reporter)))) {
+ final documentation = obj['documentation'];
+ if (documentation != null &&
+ !((documentation is String ||
+ MarkupContent.canParse(documentation, reporter)))) {
reporter
.reportError('must be of type Either2<String, MarkupContent>');
return false;
@@ -19353,7 +20102,7 @@
PartialResultParams.canParse, PartialResultParams.fromJson);
PartialResultParams({this.partialResultToken});
- static PartialResultParams fromJson(Map<String, dynamic> json) {
+ static PartialResultParams fromJson(Map<String, Object?> json) {
if (WorkspaceSymbolParams.canParse(json, nullLspJsonReporter)) {
return WorkspaceSymbolParams.fromJson(json);
}
@@ -19420,13 +20169,14 @@
if (MonikerParams.canParse(json, nullLspJsonReporter)) {
return MonikerParams.fromJson(json);
}
- final partialResultToken = json['partialResultToken'] == null
+ final partialResultTokenJson = json['partialResultToken'];
+ final partialResultToken = partialResultTokenJson == null
? null
- : (json['partialResultToken'] is int
- ? Either2<int, String>.t1(json['partialResultToken'])
- : (json['partialResultToken'] is String
- ? Either2<int, String>.t2(json['partialResultToken'])
- : (throw '''${json['partialResultToken']} was not one of (int, String)''')));
+ : (partialResultTokenJson is int
+ ? Either2<int, String>.t1(partialResultTokenJson)
+ : (partialResultTokenJson is String
+ ? Either2<int, String>.t2(partialResultTokenJson)
+ : (throw '''$partialResultTokenJson was not one of (int, String)''')));
return PartialResultParams(partialResultToken: partialResultToken);
}
@@ -19434,8 +20184,8 @@
/// streaming) to the client.
final Either2<int, String>? partialResultToken;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
if (partialResultToken != null) {
__result['partialResultToken'] = partialResultToken;
}
@@ -19443,12 +20193,12 @@
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('partialResultToken');
try {
- if (obj['partialResultToken'] != null &&
- !((obj['partialResultToken'] is int ||
- obj['partialResultToken'] is String))) {
+ final partialResultToken = obj['partialResultToken'];
+ if (partialResultToken != null &&
+ !((partialResultToken is int || partialResultToken is String))) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -19487,9 +20237,11 @@
LspJsonHandler(Position.canParse, Position.fromJson);
Position({required this.line, required this.character});
- static Position fromJson(Map<String, dynamic> json) {
- final line = json['line'];
- final character = json['character'];
+ static Position fromJson(Map<String, Object?> json) {
+ final lineJson = json['line'];
+ final line = lineJson as int;
+ final characterJson = json['character'];
+ final character = characterJson as int;
return Position(line: line, character: character);
}
@@ -19504,26 +20256,27 @@
/// Line position in a document (zero-based).
final int line;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['line'] = line;
__result['character'] = character;
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('line');
try {
if (!obj.containsKey('line')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['line'] == null) {
+ final line = obj['line'];
+ if (line == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['line'] is int)) {
+ if (!(line is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -19536,11 +20289,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['character'] == null) {
+ final character = obj['character'];
+ if (character == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(obj['character'] is int)) {
+ if (!(character is int)) {
reporter.reportError('must be of type int');
return false;
}
@@ -19579,9 +20333,12 @@
PrepareRenameParams.canParse, PrepareRenameParams.fromJson);
PrepareRenameParams({required this.textDocument, required this.position});
- static PrepareRenameParams fromJson(Map<String, dynamic> json) {
- final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
- final position = Position.fromJson(json['position']);
+ static PrepareRenameParams fromJson(Map<String, Object?> json) {
+ final textDocumentJson = json['textDocument'];
+ final textDocument = TextDocumentIdentifier.fromJson(
+ textDocumentJson as Map<String, Object?>);
+ final positionJson = json['position'];
+ final position = Position.fromJson(positionJson as Map<String, Object?>);
return PrepareRenameParams(textDocument: textDocument, position: position);
}
@@ -19591,26 +20348,27 @@
/// The text document.
final TextDocumentIdentifier textDocument;
- Map<String, dynamic> toJson() {
- var __result = <String, dynamic>{};
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
__result['textDocument'] = textDocument.toJson();
__result['position'] = position.toJson();
return __result;
}
static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, dynamic>) {
+ if (obj is Map<String, Object?>) {
reporter.push('textDocument');
try {
if (!obj.containsKey('textDocument')) {
reporter.reportError('must not be undefined');
return false;
}
- if (obj['textDocument'] == null) {
+ final textDocument = obj['textDocument'];
+ if (textDocument == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(obj['textDocument'], reporter))) {
+ if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -19623,11 +20381,12 @@
reporter.reportError('must not be undefined');
return false;
}
- if (obj['position'] == null) {
+ final position = obj['position'];
+ if (position == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(obj['position'], reporter))) {
+ if (!(Position.canParse(position, reporter))) {
reporter.reportError('must be of type Position');
return false;
}
@@ -19695,13 +20454,15 @@
LspJsonHandler(ProgressParams.canParse, ProgressParams.fromJson);
ProgressParams({required this.token, this.value});
- static ProgressParams<T> fromJson<T>(Map<String, dynamic> json) {
- final token = json['token'] is int
- ? Either2<int, String>.t1(json['token'])
- : (json['token'] is String
- ? Either2<int, String>.t2(json['token'])
- : (throw '''${json['token']} was not one of (int, String)'''));
- final value = json['value'];
+ static ProgressParams<T> fromJson<T>(Map<String, Object?> json) {
+ final tokenJson = json['token'];
+ final token = tokenJson is int
+ ? Either2<int, String>.t1(tokenJson)
+ : (tokenJson is String
+ ? Either2<int, String>.t2(tokenJson)
+ : (throw '''$tokenJson was not one of (int, String)'''));
+ final valueJson = json['value'];
+ final value = valueJson;
return ProgressParams<T>(token: token, value: value