From c954d80f18329ab02cac7cf88843998442a23307 Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Tue, 24 May 2022 16:36:55 +0000 Subject: [PATCH] [analysis_server] Fix LSP class name generation for nested inline types + minor renames Change-Id: Ia8321eedeb783ffe5e91a508e258a87aa9efcf31 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245372 Reviewed-by: Brian Wilkerson Commit-Queue: Brian Wilkerson --- .../lib/lsp_protocol/protocol_generated.dart | 1515 +++++++++-------- .../src/lsp/server_capabilities_computer.dart | 12 +- .../test/lsp/initialization_test.dart | 4 +- .../tool/lsp_spec/generated_classes_test.dart | 8 +- .../tool/lsp_spec/codegen_dart.dart | 25 +- .../tool/lsp_spec/lsp_specification.md | 2 +- .../tool/lsp_spec/typescript_parser.dart | 4 +- 7 files changed, 871 insertions(+), 699 deletions(-) diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart index 736dda02b31..4d212ef50ba 100644 --- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart +++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart @@ -1365,8 +1365,8 @@ class CallHierarchyRegistrationOptions static CallHierarchyRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -1381,7 +1381,7 @@ class CallHierarchyRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -1411,9 +1411,10 @@ class CallHierarchyRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -1450,8 +1451,12 @@ class CallHierarchyRegistrationOptions bool operator ==(Object other) { if (other is CallHierarchyRegistrationOptions && other.runtimeType == CallHierarchyRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; @@ -3192,8 +3197,8 @@ class CodeActionRegistrationOptions .toList(); final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final resolveProviderJson = json['resolveProvider']; final resolveProvider = resolveProviderJson as bool?; @@ -3215,7 +3220,7 @@ class CodeActionRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The server provides support to resolve additional information for a code /// action. @@ -3263,9 +3268,10 @@ class CodeActionRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -3304,8 +3310,12 @@ class CodeActionRegistrationOptions other.runtimeType == CodeActionRegistrationOptions) { return listEqual(codeActionKinds, other.codeActionKinds, (CodeActionKind a, CodeActionKind b) => a == b) && - listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && resolveProvider == other.resolveProvider && workDoneProgress == other.workDoneProgress && true; @@ -3841,8 +3851,8 @@ class CodeLensRegistrationOptions static CodeLensRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final resolveProviderJson = json['resolveProvider']; final resolveProvider = resolveProviderJson as bool?; @@ -3857,7 +3867,7 @@ class CodeLensRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// Code lens has a resolve provider as well. final bool? resolveProvider; @@ -3886,9 +3896,10 @@ class CodeLensRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -3925,8 +3936,12 @@ class CodeLensRegistrationOptions bool operator ==(Object other) { if (other is CodeLensRegistrationOptions && other.runtimeType == CodeLensRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && resolveProvider == other.resolveProvider && workDoneProgress == other.workDoneProgress && true; @@ -6071,6 +6086,101 @@ class CompletionItem implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class CompletionItemEditRange implements ToJsonable { + static const jsonHandler = LspJsonHandler( + CompletionItemEditRange.canParse, + CompletionItemEditRange.fromJson, + ); + + CompletionItemEditRange({ + required this.insert, + required this.replace, + }); + static CompletionItemEditRange fromJson(Map json) { + final insertJson = json['insert']; + final insert = Range.fromJson(insertJson as Map); + final replaceJson = json['replace']; + final replace = Range.fromJson(replaceJson as Map); + return CompletionItemEditRange( + insert: insert, + replace: replace, + ); + } + + final Range insert; + final Range replace; + + Map toJson() { + var result = {}; + result['insert'] = insert.toJson(); + result['replace'] = replace.toJson(); + return result; + } + + static bool canParse(Object? obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('insert'); + try { + if (!obj.containsKey('insert')) { + reporter.reportError('must not be undefined'); + return false; + } + final insert = obj['insert']; + if (insert == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Range.canParse(insert, reporter))) { + reporter.reportError('must be of type Range'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('replace'); + try { + if (!obj.containsKey('replace')) { + reporter.reportError('must not be undefined'); + return false; + } + final replace = obj['replace']; + if (replace == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(Range.canParse(replace, reporter))) { + reporter.reportError('must be of type Range'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError('must be of type CompletionItemEditRange'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is CompletionItemEditRange && + other.runtimeType == CompletionItemEditRange) { + return insert == other.insert && replace == other.replace && true; + } + return false; + } + + @override + int get hashCode => Object.hash( + insert, + replace, + ); + + @override + String toString() => jsonEncoder.convert(toJson()); +} + class CompletionItemInsertTextModeSupport implements ToJsonable { static const jsonHandler = LspJsonHandler( CompletionItemInsertTextModeSupport.canParse, @@ -6611,101 +6721,6 @@ class CompletionList implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class CompletionListEditRange implements ToJsonable { - static const jsonHandler = LspJsonHandler( - CompletionListEditRange.canParse, - CompletionListEditRange.fromJson, - ); - - CompletionListEditRange({ - required this.insert, - required this.replace, - }); - static CompletionListEditRange fromJson(Map json) { - final insertJson = json['insert']; - final insert = Range.fromJson(insertJson as Map); - final replaceJson = json['replace']; - final replace = Range.fromJson(replaceJson as Map); - return CompletionListEditRange( - insert: insert, - replace: replace, - ); - } - - final Range insert; - final Range replace; - - Map toJson() { - var result = {}; - result['insert'] = insert.toJson(); - result['replace'] = replace.toJson(); - return result; - } - - static bool canParse(Object? obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('insert'); - try { - if (!obj.containsKey('insert')) { - reporter.reportError('must not be undefined'); - return false; - } - final insert = obj['insert']; - if (insert == null) { - reporter.reportError('must not be null'); - return false; - } - if (!(Range.canParse(insert, reporter))) { - reporter.reportError('must be of type Range'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('replace'); - try { - if (!obj.containsKey('replace')) { - reporter.reportError('must not be undefined'); - return false; - } - final replace = obj['replace']; - if (replace == null) { - reporter.reportError('must not be null'); - return false; - } - if (!(Range.canParse(replace, reporter))) { - reporter.reportError('must be of type Range'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError('must be of type CompletionListEditRange'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is CompletionListEditRange && - other.runtimeType == CompletionListEditRange) { - return insert == other.insert && replace == other.replace && true; - } - return false; - } - - @override - int get hashCode => Object.hash( - insert, - replace, - ); - - @override - String toString() => jsonEncoder.convert(toJson()); -} - class CompletionListItemDefaults implements ToJsonable { static const jsonHandler = LspJsonHandler( CompletionListItemDefaults.canParse, @@ -6726,14 +6741,14 @@ class CompletionListItemDefaults implements ToJsonable { final editRangeJson = json['editRange']; final editRange = editRangeJson == null ? null - : (CompletionListEditRange.canParse(editRangeJson, nullLspJsonReporter) - ? Either2.t1( - CompletionListEditRange.fromJson( + : (CompletionItemEditRange.canParse(editRangeJson, nullLspJsonReporter) + ? Either2.t1( + CompletionItemEditRange.fromJson( editRangeJson as Map)) : (Range.canParse(editRangeJson, nullLspJsonReporter) - ? Either2.t2( + ? Either2.t2( Range.fromJson(editRangeJson as Map)) - : (throw '''$editRangeJson was not one of (CompletionListEditRange, Range)'''))); + : (throw '''$editRangeJson was not one of (CompletionItemEditRange, Range)'''))); final insertTextFormatJson = json['insertTextFormat']; final insertTextFormat = insertTextFormatJson != null ? InsertTextFormat.fromJson(insertTextFormatJson as int) @@ -6756,7 +6771,7 @@ class CompletionListItemDefaults implements ToJsonable { /// A default edit range /// @since 3.17.0 - final Either2? editRange; + final Either2? editRange; /// A default insert text format /// @since 3.17.0 @@ -6801,10 +6816,10 @@ class CompletionListItemDefaults implements ToJsonable { try { final editRange = obj['editRange']; if (editRange != null && - !((CompletionListEditRange.canParse(editRange, reporter) || + !((CompletionItemEditRange.canParse(editRange, reporter) || Range.canParse(editRange, reporter)))) { reporter.reportError( - 'must be of type Either2'); + 'must be of type Either2'); return false; } } finally { @@ -7337,8 +7352,8 @@ class CompletionRegistrationOptions : null; final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final resolveProviderJson = json['resolveProvider']; final resolveProvider = resolveProviderJson as bool?; @@ -7374,7 +7389,7 @@ class CompletionRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The server provides support to resolve additional information for a /// completion item. @@ -7450,9 +7465,10 @@ class CompletionRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -7504,8 +7520,12 @@ class CompletionRegistrationOptions return listEqual(allCommitCharacters, other.allCommitCharacters, (String a, String b) => a == b) && completionItem == other.completionItem && - listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && resolveProvider == other.resolveProvider && listEqual(triggerCharacters, other.triggerCharacters, (String a, String b) => a == b) && @@ -8382,8 +8402,8 @@ class DeclarationRegistrationOptions static DeclarationRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -8398,7 +8418,7 @@ class DeclarationRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -8428,9 +8448,10 @@ class DeclarationRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -8467,8 +8488,12 @@ class DeclarationRegistrationOptions bool operator ==(Object other) { if (other is DeclarationRegistrationOptions && other.runtimeType == DeclarationRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; @@ -8818,8 +8843,8 @@ class DefinitionRegistrationOptions static DefinitionRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final workDoneProgressJson = json['workDoneProgress']; final workDoneProgress = workDoneProgressJson as bool?; @@ -8831,7 +8856,7 @@ class DefinitionRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; final bool? workDoneProgress; Map toJson() { @@ -8854,9 +8879,10 @@ class DefinitionRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -8883,8 +8909,12 @@ class DefinitionRegistrationOptions bool operator ==(Object other) { if (other is DefinitionRegistrationOptions && other.runtimeType == DefinitionRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && workDoneProgress == other.workDoneProgress && true; } @@ -9762,8 +9792,8 @@ class DiagnosticRegistrationOptions static DiagnosticRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -9787,7 +9817,7 @@ class DiagnosticRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -9835,9 +9865,10 @@ class DiagnosticRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -9920,8 +9951,12 @@ class DiagnosticRegistrationOptions bool operator ==(Object other) { if (other is DiagnosticRegistrationOptions && other.runtimeType == DiagnosticRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && identifier == other.identifier && interFileDependencies == other.interFileDependencies && @@ -11759,8 +11794,8 @@ class DocumentColorRegistrationOptions static DocumentColorRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -11775,7 +11810,7 @@ class DocumentColorRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -11805,9 +11840,10 @@ class DocumentColorRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -11844,8 +11880,12 @@ class DocumentColorRegistrationOptions bool operator ==(Object other) { if (other is DocumentColorRegistrationOptions && other.runtimeType == DocumentColorRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; @@ -12457,8 +12497,8 @@ class DocumentFormattingRegistrationOptions Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final workDoneProgressJson = json['workDoneProgress']; final workDoneProgress = workDoneProgressJson as bool?; @@ -12470,7 +12510,7 @@ class DocumentFormattingRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; final bool? workDoneProgress; Map toJson() { @@ -12493,9 +12533,10 @@ class DocumentFormattingRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -12523,8 +12564,12 @@ class DocumentFormattingRegistrationOptions bool operator ==(Object other) { if (other is DocumentFormattingRegistrationOptions && other.runtimeType == DocumentFormattingRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && workDoneProgress == other.workDoneProgress && true; } @@ -12983,8 +13028,8 @@ class DocumentHighlightRegistrationOptions Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final workDoneProgressJson = json['workDoneProgress']; final workDoneProgress = workDoneProgressJson as bool?; @@ -12996,7 +13041,7 @@ class DocumentHighlightRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; final bool? workDoneProgress; Map toJson() { @@ -13019,9 +13064,10 @@ class DocumentHighlightRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -13049,8 +13095,12 @@ class DocumentHighlightRegistrationOptions bool operator ==(Object other) { if (other is DocumentHighlightRegistrationOptions && other.runtimeType == DocumentHighlightRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && workDoneProgress == other.workDoneProgress && true; } @@ -13532,8 +13582,8 @@ class DocumentLinkRegistrationOptions static DocumentLinkRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final resolveProviderJson = json['resolveProvider']; final resolveProvider = resolveProviderJson as bool?; @@ -13548,7 +13598,7 @@ class DocumentLinkRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// Document links have a resolve provider as well. final bool? resolveProvider; @@ -13577,9 +13627,10 @@ class DocumentLinkRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -13616,8 +13667,12 @@ class DocumentLinkRegistrationOptions bool operator ==(Object other) { if (other is DocumentLinkRegistrationOptions && other.runtimeType == DocumentLinkRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && resolveProvider == other.resolveProvider && workDoneProgress == other.workDoneProgress && true; @@ -13986,8 +14041,8 @@ class DocumentOnTypeFormattingRegistrationOptions Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final firstTriggerCharacterJson = json['firstTriggerCharacter']; final firstTriggerCharacter = firstTriggerCharacterJson as String; @@ -14004,7 +14059,7 @@ class DocumentOnTypeFormattingRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// A character on which formatting should be triggered, like `{`. final String firstTriggerCharacter; @@ -14033,9 +14088,10 @@ class DocumentOnTypeFormattingRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -14083,8 +14139,12 @@ class DocumentOnTypeFormattingRegistrationOptions bool operator ==(Object other) { if (other is DocumentOnTypeFormattingRegistrationOptions && other.runtimeType == DocumentOnTypeFormattingRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && firstTriggerCharacter == other.firstTriggerCharacter && listEqual(moreTriggerCharacter, other.moreTriggerCharacter, (String a, String b) => a == b) && @@ -14414,8 +14474,8 @@ class DocumentRangeFormattingRegistrationOptions Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final workDoneProgressJson = json['workDoneProgress']; final workDoneProgress = workDoneProgressJson as bool?; @@ -14427,7 +14487,7 @@ class DocumentRangeFormattingRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; final bool? workDoneProgress; Map toJson() { @@ -14450,9 +14510,10 @@ class DocumentRangeFormattingRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -14480,8 +14541,12 @@ class DocumentRangeFormattingRegistrationOptions bool operator ==(Object other) { if (other is DocumentRangeFormattingRegistrationOptions && other.runtimeType == DocumentRangeFormattingRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && workDoneProgress == other.workDoneProgress && true; } @@ -15337,8 +15402,8 @@ class DocumentSymbolRegistrationOptions static DocumentSymbolRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final labelJson = json['label']; final label = labelJson as String?; @@ -15353,7 +15418,7 @@ class DocumentSymbolRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// A human-readable string that is shown when multiple outlines trees are /// shown for the same document. @@ -15384,9 +15449,10 @@ class DocumentSymbolRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -15423,8 +15489,12 @@ class DocumentSymbolRegistrationOptions bool operator ==(Object other) { if (other is DocumentSymbolRegistrationOptions && other.runtimeType == DocumentSymbolRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && label == other.label && workDoneProgress == other.workDoneProgress && true; @@ -18101,8 +18171,8 @@ class FoldingRangeRegistrationOptions static FoldingRangeRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -18117,7 +18187,7 @@ class FoldingRangeRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -18147,9 +18217,10 @@ class FoldingRangeRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -18186,8 +18257,12 @@ class FoldingRangeRegistrationOptions bool operator ==(Object other) { if (other is FoldingRangeRegistrationOptions && other.runtimeType == FoldingRangeRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; @@ -19205,8 +19280,8 @@ class HoverRegistrationOptions static HoverRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final workDoneProgressJson = json['workDoneProgress']; final workDoneProgress = workDoneProgressJson as bool?; @@ -19218,7 +19293,7 @@ class HoverRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; final bool? workDoneProgress; Map toJson() { @@ -19241,9 +19316,10 @@ class HoverRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -19270,8 +19346,12 @@ class HoverRegistrationOptions bool operator ==(Object other) { if (other is HoverRegistrationOptions && other.runtimeType == HoverRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && workDoneProgress == other.workDoneProgress && true; } @@ -19628,8 +19708,8 @@ class ImplementationRegistrationOptions static ImplementationRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -19644,7 +19724,7 @@ class ImplementationRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -19674,9 +19754,10 @@ class ImplementationRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -19713,8 +19794,12 @@ class ImplementationRegistrationOptions bool operator ==(Object other) { if (other is ImplementationRegistrationOptions && other.runtimeType == ImplementationRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; @@ -21248,8 +21333,8 @@ class InlayHintRegistrationOptions static InlayHintRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -21267,7 +21352,7 @@ class InlayHintRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -21304,9 +21389,10 @@ class InlayHintRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -21353,8 +21439,12 @@ class InlayHintRegistrationOptions bool operator ==(Object other) { if (other is InlayHintRegistrationOptions && other.runtimeType == InlayHintRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && resolveProvider == other.resolveProvider && workDoneProgress == other.workDoneProgress && @@ -21966,8 +22056,8 @@ class InlineValueRegistrationOptions static InlineValueRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -21982,7 +22072,7 @@ class InlineValueRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -22012,9 +22102,10 @@ class InlineValueRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -22051,8 +22142,12 @@ class InlineValueRegistrationOptions bool operator ==(Object other) { if (other is InlineValueRegistrationOptions && other.runtimeType == InlineValueRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; @@ -22865,8 +22960,8 @@ class LinkedEditingRangeRegistrationOptions Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -22881,7 +22976,7 @@ class LinkedEditingRangeRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -22911,9 +23006,10 @@ class LinkedEditingRangeRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -22951,8 +23047,12 @@ class LinkedEditingRangeRegistrationOptions bool operator ==(Object other) { if (other is LinkedEditingRangeRegistrationOptions && other.runtimeType == LinkedEditingRangeRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; @@ -24716,8 +24816,8 @@ class MonikerRegistrationOptions static MonikerRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final workDoneProgressJson = json['workDoneProgress']; final workDoneProgress = workDoneProgressJson as bool?; @@ -24729,7 +24829,7 @@ class MonikerRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; final bool? workDoneProgress; Map toJson() { @@ -24752,9 +24852,10 @@ class MonikerRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -24781,8 +24882,12 @@ class MonikerRegistrationOptions bool operator ==(Object other) { if (other is MonikerRegistrationOptions && other.runtimeType == MonikerRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && workDoneProgress == other.workDoneProgress && true; } @@ -25503,7 +25608,7 @@ class NotebookDocumentChangeEventCells implements ToJsonable { : null; final textContentJson = json['textContent']; final textContent = (textContentJson as List?) - ?.map((item) => NotebookDocumentChangeEventTextContent.fromJson( + ?.map((item) => NotebookDocumentChangeEventCellsTextContent.fromJson( item as Map)) .toList(); return NotebookDocumentChangeEventCells( @@ -25521,7 +25626,7 @@ class NotebookDocumentChangeEventCells implements ToJsonable { final NotebookDocumentChangeEventCellsStructure? structure; /// Changes to the text content of notebook cells. - final List? textContent; + final List? textContent; Map toJson() { var result = {}; @@ -25572,10 +25677,10 @@ class NotebookDocumentChangeEventCells implements ToJsonable { if (textContent != null && !((textContent is List && (textContent.every((item) => - NotebookDocumentChangeEventTextContent.canParse( + NotebookDocumentChangeEventCellsTextContent.canParse( item, reporter)))))) { reporter.reportError( - 'must be of type List'); + 'must be of type List'); return false; } } finally { @@ -25598,8 +25703,8 @@ class NotebookDocumentChangeEventCells implements ToJsonable { listEqual( textContent, other.textContent, - (NotebookDocumentChangeEventTextContent a, - NotebookDocumentChangeEventTextContent b) => + (NotebookDocumentChangeEventCellsTextContent a, + NotebookDocumentChangeEventCellsTextContent b) => a == b) && true; } @@ -25749,17 +25854,17 @@ class NotebookDocumentChangeEventCellsStructure implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class NotebookDocumentChangeEventTextContent implements ToJsonable { +class NotebookDocumentChangeEventCellsTextContent implements ToJsonable { static const jsonHandler = LspJsonHandler( - NotebookDocumentChangeEventTextContent.canParse, - NotebookDocumentChangeEventTextContent.fromJson, + NotebookDocumentChangeEventCellsTextContent.canParse, + NotebookDocumentChangeEventCellsTextContent.fromJson, ); - NotebookDocumentChangeEventTextContent({ + NotebookDocumentChangeEventCellsTextContent({ required this.changes, required this.document, }); - static NotebookDocumentChangeEventTextContent fromJson( + static NotebookDocumentChangeEventCellsTextContent fromJson( Map json) { final changesJson = json['changes']; final changes = (changesJson as List) @@ -25777,7 +25882,7 @@ class NotebookDocumentChangeEventTextContent implements ToJsonable { final documentJson = json['document']; final document = VersionedTextDocumentIdentifier.fromJson( documentJson as Map); - return NotebookDocumentChangeEventTextContent( + return NotebookDocumentChangeEventCellsTextContent( changes: changes, document: document, ); @@ -25841,15 +25946,15 @@ class NotebookDocumentChangeEventTextContent implements ToJsonable { return true; } else { reporter.reportError( - 'must be of type NotebookDocumentChangeEventTextContent'); + 'must be of type NotebookDocumentChangeEventCellsTextContent'); return false; } } @override bool operator ==(Object other) { - if (other is NotebookDocumentChangeEventTextContent && - other.runtimeType == NotebookDocumentChangeEventTextContent) { + if (other is NotebookDocumentChangeEventCellsTextContent && + other.runtimeType == NotebookDocumentChangeEventCellsTextContent) { return listEqual( changes, other.changes, @@ -26578,142 +26683,6 @@ class NotebookDocumentSyncOptions implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class NotebookDocumentSyncOptionsCells implements ToJsonable { - static const jsonHandler = LspJsonHandler( - NotebookDocumentSyncOptionsCells.canParse, - NotebookDocumentSyncOptionsCells.fromJson, - ); - - NotebookDocumentSyncOptionsCells({ - required this.language, - }); - static NotebookDocumentSyncOptionsCells fromJson(Map json) { - final languageJson = json['language']; - final language = languageJson as String; - return NotebookDocumentSyncOptionsCells( - language: language, - ); - } - - final String language; - - Map toJson() { - var result = {}; - result['language'] = language; - return result; - } - - static bool canParse(Object? obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('language'); - try { - if (!obj.containsKey('language')) { - reporter.reportError('must not be undefined'); - return false; - } - final language = obj['language']; - if (language == null) { - reporter.reportError('must not be null'); - return false; - } - if (!(language is String)) { - reporter.reportError('must be of type String'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError('must be of type NotebookDocumentSyncOptionsCells'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is NotebookDocumentSyncOptionsCells && - other.runtimeType == NotebookDocumentSyncOptionsCells) { - return language == other.language && true; - } - return false; - } - - @override - int get hashCode => language.hashCode; - - @override - String toString() => jsonEncoder.convert(toJson()); -} - -class NotebookDocumentSyncOptionsCells2 implements ToJsonable { - static const jsonHandler = LspJsonHandler( - NotebookDocumentSyncOptionsCells2.canParse, - NotebookDocumentSyncOptionsCells2.fromJson, - ); - - NotebookDocumentSyncOptionsCells2({ - required this.language, - }); - static NotebookDocumentSyncOptionsCells2 fromJson(Map json) { - final languageJson = json['language']; - final language = languageJson as String; - return NotebookDocumentSyncOptionsCells2( - language: language, - ); - } - - final String language; - - Map toJson() { - var result = {}; - result['language'] = language; - return result; - } - - static bool canParse(Object? obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('language'); - try { - if (!obj.containsKey('language')) { - reporter.reportError('must not be undefined'); - return false; - } - final language = obj['language']; - if (language == null) { - reporter.reportError('must not be null'); - return false; - } - if (!(language is String)) { - reporter.reportError('must be of type String'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError('must be of type NotebookDocumentSyncOptionsCells2'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is NotebookDocumentSyncOptionsCells2 && - other.runtimeType == NotebookDocumentSyncOptionsCells2) { - return language == other.language && true; - } - return false; - } - - @override - int get hashCode => language.hashCode; - - @override - String toString() => jsonEncoder.convert(toJson()); -} - class NotebookDocumentSyncOptionsNotebookSelector implements ToJsonable { static const jsonHandler = LspJsonHandler( NotebookDocumentSyncOptionsNotebookSelector.canParse, @@ -26728,8 +26697,9 @@ class NotebookDocumentSyncOptionsNotebookSelector implements ToJsonable { Map json) { final cellsJson = json['cells']; final cells = (cellsJson as List?) - ?.map((item) => NotebookDocumentSyncOptionsCells.fromJson( - item as Map)) + ?.map((item) => + NotebookDocumentSyncOptionsNotebookSelectorCells.fromJson( + item as Map)) .toList(); final notebookDocumentJson = json['notebookDocument']; final notebookDocument = (NotebookDocumentFilter1.canParse( @@ -26755,7 +26725,7 @@ class NotebookDocumentSyncOptionsNotebookSelector implements ToJsonable { } /// The cells of the matching notebook to be synced. - final List? cells; + final List? cells; /// The notebook to be synced If a string value is provided it matches against /// the notebook type. '*' matches every notebook. @@ -26781,10 +26751,10 @@ class NotebookDocumentSyncOptionsNotebookSelector implements ToJsonable { if (cells != null && !((cells is List && (cells.every((item) => - NotebookDocumentSyncOptionsCells.canParse( + NotebookDocumentSyncOptionsNotebookSelectorCells.canParse( item, reporter)))))) { reporter.reportError( - 'must be of type List'); + 'must be of type List'); return false; } } finally { @@ -26827,8 +26797,8 @@ class NotebookDocumentSyncOptionsNotebookSelector implements ToJsonable { return listEqual( cells, other.cells, - (NotebookDocumentSyncOptionsCells a, - NotebookDocumentSyncOptionsCells b) => + (NotebookDocumentSyncOptionsNotebookSelectorCells a, + NotebookDocumentSyncOptionsNotebookSelectorCells b) => a == b) && notebookDocument == other.notebookDocument && true; @@ -26860,8 +26830,9 @@ class NotebookDocumentSyncOptionsNotebookSelector2 implements ToJsonable { Map json) { final cellsJson = json['cells']; final cells = (cellsJson as List) - .map((item) => NotebookDocumentSyncOptionsCells2.fromJson( - item as Map)) + .map((item) => + NotebookDocumentSyncOptionsNotebookSelector2Cells.fromJson( + item as Map)) .toList(); final notebookDocumentJson = json['notebookDocument']; final notebookDocument = notebookDocumentJson == null @@ -26888,7 +26859,7 @@ class NotebookDocumentSyncOptionsNotebookSelector2 implements ToJsonable { } /// The cells of the matching notebook to be synced. - final List cells; + final List cells; /// The notebook to be synced If a string value is provided it matches against /// the notebook type. '*' matches every notebook. @@ -26920,10 +26891,11 @@ class NotebookDocumentSyncOptionsNotebookSelector2 implements ToJsonable { return false; } if (!((cells is List && - (cells.every((item) => NotebookDocumentSyncOptionsCells2.canParse( - item, reporter)))))) { + (cells.every((item) => + NotebookDocumentSyncOptionsNotebookSelector2Cells.canParse( + item, reporter)))))) { reporter.reportError( - 'must be of type List'); + 'must be of type List'); return false; } } finally { @@ -26961,8 +26933,8 @@ class NotebookDocumentSyncOptionsNotebookSelector2 implements ToJsonable { return listEqual( cells, other.cells, - (NotebookDocumentSyncOptionsCells2 a, - NotebookDocumentSyncOptionsCells2 b) => + (NotebookDocumentSyncOptionsNotebookSelector2Cells a, + NotebookDocumentSyncOptionsNotebookSelector2Cells b) => a == b) && notebookDocument == other.notebookDocument && true; @@ -26980,6 +26952,147 @@ class NotebookDocumentSyncOptionsNotebookSelector2 implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } +class NotebookDocumentSyncOptionsNotebookSelector2Cells implements ToJsonable { + static const jsonHandler = LspJsonHandler( + NotebookDocumentSyncOptionsNotebookSelector2Cells.canParse, + NotebookDocumentSyncOptionsNotebookSelector2Cells.fromJson, + ); + + NotebookDocumentSyncOptionsNotebookSelector2Cells({ + required this.language, + }); + static NotebookDocumentSyncOptionsNotebookSelector2Cells fromJson( + Map json) { + final languageJson = json['language']; + final language = languageJson as String; + return NotebookDocumentSyncOptionsNotebookSelector2Cells( + language: language, + ); + } + + final String language; + + Map toJson() { + var result = {}; + result['language'] = language; + return result; + } + + static bool canParse(Object? obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('language'); + try { + if (!obj.containsKey('language')) { + reporter.reportError('must not be undefined'); + return false; + } + final language = obj['language']; + if (language == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(language is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type NotebookDocumentSyncOptionsNotebookSelector2Cells'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is NotebookDocumentSyncOptionsNotebookSelector2Cells && + other.runtimeType == + NotebookDocumentSyncOptionsNotebookSelector2Cells) { + return language == other.language && true; + } + return false; + } + + @override + int get hashCode => language.hashCode; + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class NotebookDocumentSyncOptionsNotebookSelectorCells implements ToJsonable { + static const jsonHandler = LspJsonHandler( + NotebookDocumentSyncOptionsNotebookSelectorCells.canParse, + NotebookDocumentSyncOptionsNotebookSelectorCells.fromJson, + ); + + NotebookDocumentSyncOptionsNotebookSelectorCells({ + required this.language, + }); + static NotebookDocumentSyncOptionsNotebookSelectorCells fromJson( + Map json) { + final languageJson = json['language']; + final language = languageJson as String; + return NotebookDocumentSyncOptionsNotebookSelectorCells( + language: language, + ); + } + + final String language; + + Map toJson() { + var result = {}; + result['language'] = language; + return result; + } + + static bool canParse(Object? obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('language'); + try { + if (!obj.containsKey('language')) { + reporter.reportError('must not be undefined'); + return false; + } + final language = obj['language']; + if (language == null) { + reporter.reportError('must not be null'); + return false; + } + if (!(language is String)) { + reporter.reportError('must be of type String'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type NotebookDocumentSyncOptionsNotebookSelectorCells'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is NotebookDocumentSyncOptionsNotebookSelectorCells && + other.runtimeType == NotebookDocumentSyncOptionsNotebookSelectorCells) { + return language == other.language && true; + } + return false; + } + + @override + int get hashCode => language.hashCode; + + @override + String toString() => jsonEncoder.convert(toJson()); +} + /// Registration options specific to a notebook. /// @since 3.17.0 class NotebookDocumentSyncRegistrationOptions @@ -28923,8 +29036,8 @@ class ReferenceRegistrationOptions static ReferenceRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final workDoneProgressJson = json['workDoneProgress']; final workDoneProgress = workDoneProgressJson as bool?; @@ -28936,7 +29049,7 @@ class ReferenceRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; final bool? workDoneProgress; Map toJson() { @@ -28959,9 +29072,10 @@ class ReferenceRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -28988,8 +29102,12 @@ class ReferenceRegistrationOptions bool operator ==(Object other) { if (other is ReferenceRegistrationOptions && other.runtimeType == ReferenceRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && workDoneProgress == other.workDoneProgress && true; } @@ -30525,8 +30643,8 @@ class RenameRegistrationOptions static RenameRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final prepareProviderJson = json['prepareProvider']; final prepareProvider = prepareProviderJson as bool?; @@ -30541,7 +30659,7 @@ class RenameRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// Renames should be checked and tested before being executed. final bool? prepareProvider; @@ -30570,9 +30688,10 @@ class RenameRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -30609,8 +30728,12 @@ class RenameRegistrationOptions bool operator ==(Object other) { if (other is RenameRegistrationOptions && other.runtimeType == RenameRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && prepareProvider == other.prepareProvider && workDoneProgress == other.workDoneProgress && true; @@ -31137,8 +31260,8 @@ class SelectionRangeRegistrationOptions static SelectionRangeRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -31153,7 +31276,7 @@ class SelectionRangeRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -31183,9 +31306,10 @@ class SelectionRangeRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -31222,8 +31346,12 @@ class SelectionRangeRegistrationOptions bool operator ==(Object other) { if (other is SelectionRangeRegistrationOptions && other.runtimeType == SelectionRangeRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; @@ -31721,20 +31849,140 @@ class SemanticTokensClientCapabilities implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class SemanticTokensClientCapabilitiesFull implements ToJsonable { +class SemanticTokensClientCapabilitiesRequests implements ToJsonable { static const jsonHandler = LspJsonHandler( - SemanticTokensClientCapabilitiesFull.canParse, - SemanticTokensClientCapabilitiesFull.fromJson, + SemanticTokensClientCapabilitiesRequests.canParse, + SemanticTokensClientCapabilitiesRequests.fromJson, ); - SemanticTokensClientCapabilitiesFull({ + SemanticTokensClientCapabilitiesRequests({ + this.full, + this.range, + }); + static SemanticTokensClientCapabilitiesRequests fromJson( + Map json) { + final fullJson = json['full']; + final full = fullJson == null + ? null + : (fullJson is bool + ? Either2.t1( + fullJson) + : (SemanticTokensClientCapabilitiesRequestsFull.canParse( + fullJson, nullLspJsonReporter) + ? Either2.t2( + SemanticTokensClientCapabilitiesRequestsFull.fromJson( + fullJson as Map)) + : (throw '''$fullJson was not one of (bool, SemanticTokensClientCapabilitiesRequestsFull)'''))); + final rangeJson = json['range']; + final range = rangeJson == null + ? null + : (rangeJson is bool + ? Either2.t1( + rangeJson) + : (SemanticTokensClientCapabilitiesRequestsRange.canParse( + rangeJson, nullLspJsonReporter) + ? Either2.t2( + SemanticTokensClientCapabilitiesRequestsRange.fromJson( + rangeJson as Map)) + : (throw '''$rangeJson was not one of (bool, SemanticTokensClientCapabilitiesRequestsRange)'''))); + return SemanticTokensClientCapabilitiesRequests( + full: full, + range: range, + ); + } + + /// The client will send the `textDocument/semanticTokens/full` request if the + /// server provides a corresponding handler. + final Either2? full; + + /// The client will send the `textDocument/semanticTokens/range` request if + /// the server provides a corresponding handler. + final Either2? range; + + Map toJson() { + var result = {}; + if (full != null) { + result['full'] = full; + } + if (range != null) { + result['range'] = range; + } + return result; + } + + static bool canParse(Object? obj, LspJsonReporter reporter) { + if (obj is Map) { + reporter.push('full'); + try { + final full = obj['full']; + if (full != null && + !((full is bool || + SemanticTokensClientCapabilitiesRequestsFull.canParse( + full, reporter)))) { + reporter.reportError( + 'must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + reporter.push('range'); + try { + final range = obj['range']; + if (range != null && + !((range is bool || + SemanticTokensClientCapabilitiesRequestsRange.canParse( + range, reporter)))) { + reporter.reportError( + 'must be of type Either2'); + return false; + } + } finally { + reporter.pop(); + } + return true; + } else { + reporter.reportError( + 'must be of type SemanticTokensClientCapabilitiesRequests'); + return false; + } + } + + @override + bool operator ==(Object other) { + if (other is SemanticTokensClientCapabilitiesRequests && + other.runtimeType == SemanticTokensClientCapabilitiesRequests) { + return full == other.full && range == other.range && true; + } + return false; + } + + @override + int get hashCode => Object.hash( + full, + range, + ); + + @override + String toString() => jsonEncoder.convert(toJson()); +} + +class SemanticTokensClientCapabilitiesRequestsFull implements ToJsonable { + static const jsonHandler = LspJsonHandler( + SemanticTokensClientCapabilitiesRequestsFull.canParse, + SemanticTokensClientCapabilitiesRequestsFull.fromJson, + ); + + SemanticTokensClientCapabilitiesRequestsFull({ this.delta, }); - static SemanticTokensClientCapabilitiesFull fromJson( + static SemanticTokensClientCapabilitiesRequestsFull fromJson( Map json) { final deltaJson = json['delta']; final delta = deltaJson as bool?; - return SemanticTokensClientCapabilitiesFull( + return SemanticTokensClientCapabilitiesRequestsFull( delta: delta, ); } @@ -31765,16 +32013,16 @@ class SemanticTokensClientCapabilitiesFull implements ToJsonable { } return true; } else { - reporter - .reportError('must be of type SemanticTokensClientCapabilitiesFull'); + reporter.reportError( + 'must be of type SemanticTokensClientCapabilitiesRequestsFull'); return false; } } @override bool operator ==(Object other) { - if (other is SemanticTokensClientCapabilitiesFull && - other.runtimeType == SemanticTokensClientCapabilitiesFull) { + if (other is SemanticTokensClientCapabilitiesRequestsFull && + other.runtimeType == SemanticTokensClientCapabilitiesRequestsFull) { return delta == other.delta && true; } return false; @@ -31787,15 +32035,15 @@ class SemanticTokensClientCapabilitiesFull implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class SemanticTokensClientCapabilitiesRange implements ToJsonable { +class SemanticTokensClientCapabilitiesRequestsRange implements ToJsonable { static const jsonHandler = LspJsonHandler( - SemanticTokensClientCapabilitiesRange.canParse, - SemanticTokensClientCapabilitiesRange.fromJson, + SemanticTokensClientCapabilitiesRequestsRange.canParse, + SemanticTokensClientCapabilitiesRequestsRange.fromJson, ); - static SemanticTokensClientCapabilitiesRange fromJson( + static SemanticTokensClientCapabilitiesRequestsRange fromJson( Map json) { - return SemanticTokensClientCapabilitiesRange(); + return SemanticTokensClientCapabilitiesRequestsRange(); } Map toJson() { @@ -31807,16 +32055,16 @@ class SemanticTokensClientCapabilitiesRange implements ToJsonable { if (obj is Map) { return true; } else { - reporter - .reportError('must be of type SemanticTokensClientCapabilitiesRange'); + reporter.reportError( + 'must be of type SemanticTokensClientCapabilitiesRequestsRange'); return false; } } @override bool operator ==(Object other) { - if (other is SemanticTokensClientCapabilitiesRange && - other.runtimeType == SemanticTokensClientCapabilitiesRange) { + if (other is SemanticTokensClientCapabilitiesRequestsRange && + other.runtimeType == SemanticTokensClientCapabilitiesRequestsRange) { return true; } return false; @@ -31829,122 +32077,6 @@ class SemanticTokensClientCapabilitiesRange implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class SemanticTokensClientCapabilitiesRequests implements ToJsonable { - static const jsonHandler = LspJsonHandler( - SemanticTokensClientCapabilitiesRequests.canParse, - SemanticTokensClientCapabilitiesRequests.fromJson, - ); - - SemanticTokensClientCapabilitiesRequests({ - this.full, - this.range, - }); - static SemanticTokensClientCapabilitiesRequests fromJson( - Map json) { - final fullJson = json['full']; - final full = fullJson == null - ? null - : (fullJson is bool - ? Either2.t1(fullJson) - : (SemanticTokensClientCapabilitiesFull.canParse( - fullJson, nullLspJsonReporter) - ? Either2.t2( - SemanticTokensClientCapabilitiesFull.fromJson( - fullJson as Map)) - : (throw '''$fullJson was not one of (bool, SemanticTokensClientCapabilitiesFull)'''))); - final rangeJson = json['range']; - final range = rangeJson == null - ? null - : (rangeJson is bool - ? Either2.t1(rangeJson) - : (SemanticTokensClientCapabilitiesRange.canParse( - rangeJson, nullLspJsonReporter) - ? Either2.t2( - SemanticTokensClientCapabilitiesRange.fromJson( - rangeJson as Map)) - : (throw '''$rangeJson was not one of (bool, SemanticTokensClientCapabilitiesRange)'''))); - return SemanticTokensClientCapabilitiesRequests( - full: full, - range: range, - ); - } - - /// The client will send the `textDocument/semanticTokens/full` request if the - /// server provides a corresponding handler. - final Either2? full; - - /// The client will send the `textDocument/semanticTokens/range` request if - /// the server provides a corresponding handler. - final Either2? range; - - Map toJson() { - var result = {}; - if (full != null) { - result['full'] = full; - } - if (range != null) { - result['range'] = range; - } - return result; - } - - static bool canParse(Object? obj, LspJsonReporter reporter) { - if (obj is Map) { - reporter.push('full'); - try { - final full = obj['full']; - if (full != null && - !((full is bool || - SemanticTokensClientCapabilitiesFull.canParse( - full, reporter)))) { - reporter.reportError( - 'must be of type Either2'); - return false; - } - } finally { - reporter.pop(); - } - reporter.push('range'); - try { - final range = obj['range']; - if (range != null && - !((range is bool || - SemanticTokensClientCapabilitiesRange.canParse( - range, reporter)))) { - reporter.reportError( - 'must be of type Either2'); - return false; - } - } finally { - reporter.pop(); - } - return true; - } else { - reporter.reportError( - 'must be of type SemanticTokensClientCapabilitiesRequests'); - return false; - } - } - - @override - bool operator ==(Object other) { - if (other is SemanticTokensClientCapabilitiesRequests && - other.runtimeType == SemanticTokensClientCapabilitiesRequests) { - return full == other.full && range == other.range && true; - } - return false; - } - - @override - int get hashCode => Object.hash( - full, - range, - ); - - @override - String toString() => jsonEncoder.convert(toJson()); -} - class SemanticTokensDelta implements ToJsonable { static const jsonHandler = LspJsonHandler( SemanticTokensDelta.canParse, @@ -33164,8 +33296,8 @@ class SemanticTokensRegistrationOptions static SemanticTokensRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final fullJson = json['full']; final full = fullJson == null @@ -33207,7 +33339,7 @@ class SemanticTokensRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// Server supports providing semantic tokens for a full document. final Either2? full; @@ -33254,9 +33386,10 @@ class SemanticTokensRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -33337,8 +33470,12 @@ class SemanticTokensRegistrationOptions bool operator ==(Object other) { if (other is SemanticTokensRegistrationOptions && other.runtimeType == SemanticTokensRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && full == other.full && id == other.id && legend == other.legend && @@ -36447,8 +36584,8 @@ class SignatureHelpRegistrationOptions static SignatureHelpRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final retriggerCharactersJson = json['retriggerCharacters']; final retriggerCharacters = (retriggerCharactersJson as List?) @@ -36470,7 +36607,7 @@ class SignatureHelpRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// List of characters that re-trigger signature help. /// @@ -36509,9 +36646,10 @@ class SignatureHelpRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -36562,8 +36700,12 @@ class SignatureHelpRegistrationOptions bool operator ==(Object other) { if (other is SignatureHelpRegistrationOptions && other.runtimeType == SignatureHelpRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && listEqual(retriggerCharacters, other.retriggerCharacters, (String a, String b) => a == b) && listEqual(triggerCharacters, other.triggerCharacters, @@ -37264,8 +37406,8 @@ class TextDocumentChangeRegistrationOptions Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final syncKindJson = json['syncKind']; final syncKind = TextDocumentSyncKind.fromJson(syncKindJson as int); @@ -37277,7 +37419,7 @@ class TextDocumentChangeRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// How documents are synced to the server. See TextDocumentSyncKind.Full and /// TextDocumentSyncKind.Incremental. @@ -37301,9 +37443,10 @@ class TextDocumentChangeRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -37339,8 +37482,12 @@ class TextDocumentChangeRegistrationOptions bool operator ==(Object other) { if (other is TextDocumentChangeRegistrationOptions && other.runtimeType == TextDocumentChangeRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && syncKind == other.syncKind && true; } @@ -37542,7 +37689,7 @@ class TextDocumentClientCapabilities implements ToJsonable { : null; final typeHierarchyJson = json['typeHierarchy']; final typeHierarchy = typeHierarchyJson != null - ? TypeHierarchyClientCapabilities1.fromJson( + ? TypeHierarchyClientCapabilities.fromJson( typeHierarchyJson as Map) : null; return TextDocumentClientCapabilities( @@ -37682,7 +37829,7 @@ class TextDocumentClientCapabilities implements ToJsonable { /// Capabilities specific to the various type hierarchy requests. /// @since 3.17.0 - final TypeHierarchyClientCapabilities1? typeHierarchy; + final TypeHierarchyClientCapabilities? typeHierarchy; Map toJson() { var result = {}; @@ -38138,10 +38285,10 @@ class TextDocumentClientCapabilities implements ToJsonable { try { final typeHierarchy = obj['typeHierarchy']; if (typeHierarchy != null && - !(TypeHierarchyClientCapabilities1.canParse( + !(TypeHierarchyClientCapabilities.canParse( typeHierarchy, reporter))) { reporter - .reportError('must be of type TypeHierarchyClientCapabilities1'); + .reportError('must be of type TypeHierarchyClientCapabilities'); return false; } } finally { @@ -38549,25 +38696,25 @@ class TextDocumentEdit implements ToJsonable { String toString() => jsonEncoder.convert(toJson()); } -class TextDocumentFilter implements ToJsonable { +class TextDocumentFilterWithScheme implements ToJsonable { static const jsonHandler = LspJsonHandler( - TextDocumentFilter.canParse, - TextDocumentFilter.fromJson, + TextDocumentFilterWithScheme.canParse, + TextDocumentFilterWithScheme.fromJson, ); - TextDocumentFilter({ + TextDocumentFilterWithScheme({ this.language, this.pattern, this.scheme, }); - static TextDocumentFilter fromJson(Map json) { + static TextDocumentFilterWithScheme fromJson(Map json) { final languageJson = json['language']; final language = languageJson as String?; final patternJson = json['pattern']; final pattern = patternJson as String?; final schemeJson = json['scheme']; final scheme = schemeJson as String?; - return TextDocumentFilter( + return TextDocumentFilterWithScheme( language: language, pattern: pattern, scheme: scheme, @@ -38643,15 +38790,15 @@ class TextDocumentFilter implements ToJsonable { } return true; } else { - reporter.reportError('must be of type TextDocumentFilter'); + reporter.reportError('must be of type TextDocumentFilterWithScheme'); return false; } } @override bool operator ==(Object other) { - if (other is TextDocumentFilter && - other.runtimeType == TextDocumentFilter) { + if (other is TextDocumentFilterWithScheme && + other.runtimeType == TextDocumentFilterWithScheme) { return language == other.language && pattern == other.pattern && scheme == other.scheme && @@ -39159,8 +39306,8 @@ class TextDocumentRegistrationOptions implements ToJsonable { } final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); return TextDocumentRegistrationOptions( documentSelector: documentSelector, @@ -39169,7 +39316,7 @@ class TextDocumentRegistrationOptions implements ToJsonable { /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; Map toJson() { var result = {}; @@ -39188,9 +39335,10 @@ class TextDocumentRegistrationOptions implements ToJsonable { final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -39207,8 +39355,12 @@ class TextDocumentRegistrationOptions implements ToJsonable { bool operator ==(Object other) { if (other is TextDocumentRegistrationOptions && other.runtimeType == TextDocumentRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && true; } return false; @@ -39269,8 +39421,8 @@ class TextDocumentSaveRegistrationOptions Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final includeTextJson = json['includeText']; final includeText = includeTextJson as bool?; @@ -39282,7 +39434,7 @@ class TextDocumentSaveRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The client is supposed to include the content on save. final bool? includeText; @@ -39307,9 +39459,10 @@ class TextDocumentSaveRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -39337,8 +39490,12 @@ class TextDocumentSaveRegistrationOptions bool operator ==(Object other) { if (other is TextDocumentSaveRegistrationOptions && other.runtimeType == TextDocumentSaveRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && includeText == other.includeText && true; } @@ -40165,8 +40322,8 @@ class TypeDefinitionRegistrationOptions static TypeDefinitionRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -40181,7 +40338,7 @@ class TypeDefinitionRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -40211,9 +40368,10 @@ class TypeDefinitionRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -40250,8 +40408,12 @@ class TypeDefinitionRegistrationOptions bool operator ==(Object other) { if (other is TypeDefinitionRegistrationOptions && other.runtimeType == TypeDefinitionRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; @@ -40270,19 +40432,19 @@ class TypeDefinitionRegistrationOptions String toString() => jsonEncoder.convert(toJson()); } -class TypeHierarchyClientCapabilities1 implements ToJsonable { +class TypeHierarchyClientCapabilities implements ToJsonable { static const jsonHandler = LspJsonHandler( - TypeHierarchyClientCapabilities1.canParse, - TypeHierarchyClientCapabilities1.fromJson, + TypeHierarchyClientCapabilities.canParse, + TypeHierarchyClientCapabilities.fromJson, ); - TypeHierarchyClientCapabilities1({ + TypeHierarchyClientCapabilities({ this.dynamicRegistration, }); - static TypeHierarchyClientCapabilities1 fromJson(Map json) { + static TypeHierarchyClientCapabilities fromJson(Map json) { final dynamicRegistrationJson = json['dynamicRegistration']; final dynamicRegistration = dynamicRegistrationJson as bool?; - return TypeHierarchyClientCapabilities1( + return TypeHierarchyClientCapabilities( dynamicRegistration: dynamicRegistration, ); } @@ -40315,15 +40477,15 @@ class TypeHierarchyClientCapabilities1 implements ToJsonable { } return true; } else { - reporter.reportError('must be of type TypeHierarchyClientCapabilities1'); + reporter.reportError('must be of type TypeHierarchyClientCapabilities'); return false; } } @override bool operator ==(Object other) { - if (other is TypeHierarchyClientCapabilities1 && - other.runtimeType == TypeHierarchyClientCapabilities1) { + if (other is TypeHierarchyClientCapabilities && + other.runtimeType == TypeHierarchyClientCapabilities) { return dynamicRegistration == other.dynamicRegistration && true; } return false; @@ -40801,8 +40963,8 @@ class TypeHierarchyRegistrationOptions static TypeHierarchyRegistrationOptions fromJson(Map json) { final documentSelectorJson = json['documentSelector']; final documentSelector = (documentSelectorJson as List?) - ?.map( - (item) => TextDocumentFilter.fromJson(item as Map)) + ?.map((item) => + TextDocumentFilterWithScheme.fromJson(item as Map)) .toList(); final idJson = json['id']; final id = idJson as String?; @@ -40817,7 +40979,7 @@ class TypeHierarchyRegistrationOptions /// A document selector to identify the scope of the registration. If set to /// null the document selector provided on the client side will be used. - final List? documentSelector; + final List? documentSelector; /// The id used to register the request. The id can be used to deregister the /// request again. See also Registration#id. @@ -40847,9 +41009,10 @@ class TypeHierarchyRegistrationOptions final documentSelector = obj['documentSelector']; if (documentSelector != null && !((documentSelector is List && - (documentSelector.every( - (item) => TextDocumentFilter.canParse(item, reporter)))))) { - reporter.reportError('must be of type List'); + (documentSelector.every((item) => + TextDocumentFilterWithScheme.canParse(item, reporter)))))) { + reporter.reportError( + 'must be of type List'); return false; } } finally { @@ -40886,8 +41049,12 @@ class TypeHierarchyRegistrationOptions bool operator ==(Object other) { if (other is TypeHierarchyRegistrationOptions && other.runtimeType == TypeHierarchyRegistrationOptions) { - return listEqual(documentSelector, other.documentSelector, - (TextDocumentFilter a, TextDocumentFilter b) => a == b) && + return listEqual( + documentSelector, + other.documentSelector, + (TextDocumentFilterWithScheme a, + TextDocumentFilterWithScheme b) => + a == b) && id == other.id && workDoneProgress == other.workDoneProgress && true; diff --git a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart index 5b47d0a9dc5..3d987f28f85 100644 --- a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart +++ b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart @@ -137,12 +137,13 @@ class ServerCapabilitiesComputer { Set currentRegistrations = {}; var _lastRegistrationId = 0; - final dartFiles = TextDocumentFilter(language: 'dart', scheme: 'file'); - final pubspecFile = TextDocumentFilter( + final dartFiles = + TextDocumentFilterWithScheme(language: 'dart', scheme: 'file'); + final pubspecFile = TextDocumentFilterWithScheme( language: 'yaml', scheme: 'file', pattern: '**/pubspec.yaml'); - final analysisOptionsFile = TextDocumentFilter( + final analysisOptionsFile = TextDocumentFilterWithScheme( language: 'yaml', scheme: 'file', pattern: '**/analysis_options.yaml'); - final fixDataFile = TextDocumentFilter( + final fixDataFile = TextDocumentFilterWithScheme( language: 'yaml', scheme: 'file', pattern: '**/lib/fix_data.yaml'); ServerCapabilitiesComputer(this._server); @@ -303,7 +304,8 @@ class ServerCapabilitiesComputer { // All published plugins use something like `*.extension` as // interestingFiles. Prefix a `**/` so that the glob matches nested // folders as well. - .map((glob) => TextDocumentFilter(scheme: 'file', pattern: '**/$glob')); + .map((glob) => + TextDocumentFilterWithScheme(scheme: 'file', pattern: '**/$glob')); final pluginTypesExcludingDart = pluginTypes.where((filter) => filter.pattern != '**/*.dart'); diff --git a/pkg/analysis_server/test/lsp/initialization_test.dart b/pkg/analysis_server/test/lsp/initialization_test.dart index a70a2dbbfea..e4a8ece8933 100644 --- a/pkg/analysis_server/test/lsp/initialization_test.dart +++ b/pkg/analysis_server/test/lsp/initialization_test.dart @@ -491,9 +491,9 @@ class InitializationTest extends AbstractLspAnalysisServerTest { .registrations; final documentFilterSql = - TextDocumentFilter(scheme: 'file', pattern: '**/*.sql'); + TextDocumentFilterWithScheme(scheme: 'file', pattern: '**/*.sql'); final documentFilterDart = - TextDocumentFilter(language: 'dart', scheme: 'file'); + TextDocumentFilterWithScheme(language: 'dart', scheme: 'file'); expect( registrations, diff --git a/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart b/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart index f10b8ce977d..772f0916e19 100644 --- a/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart +++ b/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart @@ -29,10 +29,10 @@ void main() { test('with aliased list fields can be checked for equality', () { final a = TextDocumentRegistrationOptions(documentSelector: [ - TextDocumentFilter(language: 'dart', scheme: 'file') + TextDocumentFilterWithScheme(language: 'dart', scheme: 'file') ]); final b = TextDocumentRegistrationOptions(documentSelector: [ - TextDocumentFilter(language: 'dart', scheme: 'file') + TextDocumentFilterWithScheme(language: 'dart', scheme: 'file') ]); expect(a, equals(b)); @@ -87,12 +87,12 @@ void main() { test('consider subclasses when checking for equality', () { final a = TextDocumentRegistrationOptions(documentSelector: [ - TextDocumentFilter(language: 'dart', scheme: 'file') + TextDocumentFilterWithScheme(language: 'dart', scheme: 'file') ]); final b = TextDocumentSaveRegistrationOptions( includeText: true, documentSelector: [ - TextDocumentFilter(language: 'dart', scheme: 'file') + TextDocumentFilterWithScheme(language: 'dart', scheme: 'file') ]); expect(a, isNot(equals(b))); diff --git a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart index 14e862064bb..784c74dc729 100644 --- a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart +++ b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart @@ -73,23 +73,26 @@ Iterable renameTypes(List types) sync* { // the migration to JSON meta_model. 'ClientCapabilitiesWindow': 'WindowClientCapabilities', 'ClientCapabilitiesWorkspace': 'WorkspaceClientCapabilities', - 'ClientCapabilitiesFileOperations': 'FileOperationClientCapabilities', - 'ServerCapabilitiesFileOperations': 'FileOperationOptions', + 'ClientCapabilitiesWorkspaceFileOperations': + 'FileOperationClientCapabilities', + 'ServerCapabilitiesWorkspaceFileOperations': 'FileOperationOptions', 'ClientCapabilitiesGeneral': 'GeneralClientCapabilities', - 'CompletionClientCapabilitiesInsertTextModeSupport': + 'CompletionClientCapabilitiesCompletionItemInsertTextModeSupport': 'CompletionItemInsertTextModeSupport', - 'CompletionClientCapabilitiesResolveSupport': + 'CompletionClientCapabilitiesCompletionItemResolveSupport': 'CompletionItemResolveSupport', - 'CompletionClientCapabilitiesTagSupport': 'CompletionItemTagSupport', - 'CodeActionClientCapabilitiesCodeActionKind': + 'CompletionClientCapabilitiesCompletionItemTagSupport': + 'CompletionItemTagSupport', + 'CodeActionClientCapabilitiesCodeActionLiteralSupportCodeActionKind': 'CodeActionLiteralSupportCodeActionKind', - 'DocumentFilter': 'TextDocumentFilter', - 'ClientCapabilitiesStaleRequestSupport': + // In JSON model this becomes a union of literals which we assign improved + // names to (to avoid numeric suffixes). + 'DocumentFilter': 'TextDocumentFilterWithScheme', + 'ClientCapabilitiesGeneralStaleRequestSupport': 'GeneralClientCapabilitiesStaleRequestSupport', - 'SignatureHelpClientCapabilitiesParameterInformation': + 'SignatureHelpClientCapabilitiesSignatureInformationParameterInformation': 'SignatureInformationParameterInformation', - 'NotebookDocumentChangeEventStructure': - 'NotebookDocumentChangeEventCellsStructure', + 'CompletionListItemDefaultsEditRange': 'CompletionItemEditRange', }; for (final type in types) { diff --git a/pkg/analysis_server/tool/lsp_spec/lsp_specification.md b/pkg/analysis_server/tool/lsp_spec/lsp_specification.md index 55fd7f47020..e2f07754e97 100644 --- a/pkg/analysis_server/tool/lsp_spec/lsp_specification.md +++ b/pkg/analysis_server/tool/lsp_spec/lsp_specification.md @@ -4735,7 +4735,7 @@ _Client Capability_:
```typescript -type TypeHierarchyClientCapabilities = { +export interface TypeHierarchyClientCapabilities { /** * Whether implementation supports dynamic registration. If this is set to * `true` the client supports the new `(TextDocumentRegistrationOptions & diff --git a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart index d0744602df3..3f790e38480 100644 --- a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart +++ b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart @@ -623,9 +623,10 @@ class Parser { TypeBase type; if (_match([TokenType.LEFT_BRACE])) { // Inline interfaces. + final generatedName = _getAvailableName(containerName, fieldName); final members = []; while (!_check(TokenType.RIGHT_BRACE)) { - members.add(_member(containerName)); + members.add(_member(generatedName)); } _consume(TokenType.RIGHT_BRACE, 'Expected }'); @@ -638,7 +639,6 @@ class Parser { type = MapType(indexer.indexType, indexer.valueType); } else { // Add a synthetic interface to the parsers list of nodes to represent this type. - final generatedName = _getAvailableName(containerName, fieldName); _addNode(InlineInterface(generatedName, members)); // Record the type as a simple type that references this interface. type = Type.identifier(generatedName);