[analysis_server] Move language server protocol to third_party Bug: b/286184681 Change-Id: Iabb9070e354f85d29bb94dee4bdd52a0cf664c94 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326643 Commit-Queue: Alexander Thomas <athom@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Devon Carew <devoncarew@google.com>
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol.dart b/pkg/analysis_server/lib/lsp_protocol/protocol.dart index 7243549..66cb10d 100644 --- a/pkg/analysis_server/lib/lsp_protocol/protocol.dart +++ b/pkg/analysis_server/lib/lsp_protocol/protocol.dart
@@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -export 'package:analysis_server/lsp_protocol/protocol_custom_generated.dart' +export 'package:language_server_protocol/protocol_custom_generated.dart' hide jsonEncoder; -export 'package:analysis_server/lsp_protocol/protocol_generated.dart'; -export 'package:analysis_server/lsp_protocol/protocol_special.dart'; +export 'package:language_server_protocol/protocol_generated.dart'; +export 'package:language_server_protocol/protocol_special.dart';
diff --git a/pkg/analysis_server/lib/src/handler/legacy/lsp_over_legacy_handler.dart b/pkg/analysis_server/lib/src/handler/legacy/lsp_over_legacy_handler.dart index dc56e48..3b5e2d0 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/lsp_over_legacy_handler.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/lsp_over_legacy_handler.dart
@@ -4,15 +4,15 @@ import 'dart:async'; -import 'package:analysis_server/lsp_protocol/protocol_custom_generated.dart'; -import 'package:analysis_server/lsp_protocol/protocol_special.dart'; import 'package:analysis_server/protocol/protocol.dart'; import 'package:analysis_server/protocol/protocol_generated.dart'; import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; import 'package:analysis_server/src/lsp/constants.dart'; import 'package:analysis_server/src/lsp/handlers/handler_states.dart'; import 'package:analysis_server/src/lsp/handlers/handlers.dart' as lsp; -import 'package:analysis_server/src/lsp/json_parsing.dart'; +import 'package:language_server_protocol/json_parsing.dart'; +import 'package:language_server_protocol/protocol_custom_generated.dart'; +import 'package:language_server_protocol/protocol_special.dart'; /// The handler for the `lsp.handle` request. class LspOverLegacyHandler extends LegacyHandler {
diff --git a/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart b/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart index fefa959..5c30dd6 100644 --- a/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart +++ b/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart
@@ -8,9 +8,9 @@ import 'package:analysis_server/lsp_protocol/protocol.dart'; import 'package:analysis_server/src/lsp/channel/lsp_channel.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; import 'package:analysis_server/src/lsp/lsp_packet_transformer.dart'; import 'package:analyzer/instrumentation/instrumentation.dart'; +import 'package:language_server_protocol/json_parsing.dart'; /// Instances of the class [LspByteStreamServerChannel] implement an /// [LspServerCommunicationChannel] that uses a stream and a sink (typically,
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart index aa19346..354ddaf 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart
@@ -4,8 +4,6 @@ import 'dart:async'; -import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; -import 'package:analysis_server/lsp_protocol/protocol_special.dart'; import 'package:analysis_server/src/analysis_server.dart'; import 'package:analysis_server/src/computer/computer_call_hierarchy.dart' as call_hierarchy; @@ -17,6 +15,8 @@ import 'package:analyzer/dart/analysis/session.dart'; import 'package:analyzer/source/line_info.dart'; import 'package:analyzer/source/source_range.dart'; +import 'package:language_server_protocol/protocol_generated.dart'; +import 'package:language_server_protocol/protocol_special.dart'; typedef StaticOptions = Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>;
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart b/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart index 33289f5..fdb56de 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart
@@ -9,7 +9,6 @@ import 'package:analysis_server/src/lsp/constants.dart'; import 'package:analysis_server/src/lsp/handlers/handler_cancel_request.dart'; import 'package:analysis_server/src/lsp/handlers/handler_reject.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; import 'package:analysis_server/src/lsp/lsp_analysis_server.dart'; import 'package:analysis_server/src/lsp/progress.dart'; import 'package:analysis_server/src/request_handler_mixin.dart'; @@ -19,6 +18,7 @@ import 'package:analyzer/src/utilities/cancellation.dart'; import 'package:analyzer_plugin/protocol/protocol.dart'; import 'package:analyzer_plugin/src/protocol/protocol_internal.dart'; +import 'package:language_server_protocol/json_parsing.dart'; import 'package:path/path.dart' as path; export 'package:analyzer/src/utilities/cancellation.dart';
diff --git a/pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart b/pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart index 39733ca..fbef303 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart
@@ -2,13 +2,13 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analysis_server/lsp_protocol/protocol_custom_generated.dart'; import 'package:analysis_server/src/services/refactoring/agnostic/change_method_signature.dart'; import 'package:analysis_server/src/services/refactoring/framework/formal_parameter.dart'; import 'package:analysis_server/src/services/refactoring/framework/refactoring_producer.dart'; import 'package:analysis_server/src/services/refactoring/framework/write_invocation_arguments.dart' show ArgumentsTrailingComma; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; +import 'package:language_server_protocol/protocol_custom_generated.dart'; /// The refactoring that converts all formal parameters into required named. class ConvertAllFormalParametersToNamed extends RefactoringProducer {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart b/pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart index 330830b..bc1ee1e 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart
@@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analysis_server/lsp_protocol/protocol_custom_generated.dart'; import 'package:analysis_server/src/services/refactoring/agnostic/change_method_signature.dart'; import 'package:analysis_server/src/services/refactoring/framework/formal_parameter.dart'; import 'package:analysis_server/src/services/refactoring/framework/refactoring_producer.dart'; @@ -10,6 +9,7 @@ show ArgumentsTrailingComma; import 'package:analyzer/src/utilities/extensions/collection.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; +import 'package:language_server_protocol/protocol_custom_generated.dart'; /// The refactoring that converts selected formal parameters into required /// named.
diff --git a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_processor.dart b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_processor.dart index bcdb744..c14b395 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_processor.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_processor.dart
@@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; import 'package:analysis_server/src/lsp/constants.dart'; import 'package:analysis_server/src/services/refactoring/convert_all_formal_parameters_to_named.dart'; import 'package:analysis_server/src/services/refactoring/convert_selected_formal_parameters_to_named.dart'; @@ -10,6 +9,7 @@ import 'package:analysis_server/src/services/refactoring/framework/refactoring_producer.dart'; import 'package:analysis_server/src/services/refactoring/move_selected_formal_parameters_left.dart'; import 'package:analysis_server/src/services/refactoring/move_top_level_to_file.dart'; +import 'package:language_server_protocol/protocol_generated.dart'; /// A function that can be executed to create a refactoring producer. typedef ProducerGenerator = RefactoringProducer Function(RefactoringContext);
diff --git a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_producer.dart b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_producer.dart index 7cb6dc4..b7ee3eb 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_producer.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_producer.dart
@@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analysis_server/lsp_protocol/protocol_custom_generated.dart'; -import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; import 'package:analysis_server/src/services/correction/util.dart'; import 'package:analysis_server/src/services/refactoring/framework/refactoring_context.dart'; import 'package:analysis_server/src/services/search/search_engine.dart'; @@ -13,6 +11,8 @@ import 'package:analyzer/dart/ast/token.dart'; import 'package:analyzer/src/dart/analysis/session_helper.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; +import 'package:language_server_protocol/protocol_custom_generated.dart'; +import 'package:language_server_protocol/protocol_generated.dart'; /// An object that can compute a refactoring in a Dart file. abstract class RefactoringProducer {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart b/pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart index 0a046ce..7e98340 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart
@@ -2,13 +2,13 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analysis_server/lsp_protocol/protocol_custom_generated.dart'; import 'package:analysis_server/src/services/refactoring/agnostic/change_method_signature.dart'; import 'package:analysis_server/src/services/refactoring/framework/refactoring_producer.dart'; import 'package:analysis_server/src/services/refactoring/framework/write_invocation_arguments.dart' show ArgumentsTrailingComma; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; import 'package:collection/collection.dart'; +import 'package:language_server_protocol/protocol_custom_generated.dart'; /// The refactoring that move selected formal parameters one position left /// in the list of formal parameters.
diff --git a/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart b/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart index 8e72947..3654349 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart
@@ -2,9 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analysis_server/lsp_protocol/protocol_custom_generated.dart' - show CommandParameter, SaveUriCommandParameter; -import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; import 'package:analysis_server/src/lsp/constants.dart'; import 'package:analysis_server/src/services/refactoring/framework/refactoring_producer.dart'; import 'package:analysis_server/src/utilities/extensions/ast.dart'; @@ -19,6 +16,9 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:collection/collection.dart'; +import 'package:language_server_protocol/protocol_custom_generated.dart' + show CommandParameter, SaveUriCommandParameter; +import 'package:language_server_protocol/protocol_generated.dart'; /// A refactoring that will move one or more top-level declarations to a /// different file. The destination file can either be a new file or an existing
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml index 2f931f2..f12a049 100644 --- a/pkg/analysis_server/pubspec.yaml +++ b/pkg/analysis_server/pubspec.yaml
@@ -16,6 +16,7 @@ crypto: any dart_style: any http: any + language_server_protocol: any leak_tracker: any linter: any meta: any @@ -82,6 +83,8 @@ path: ../../third_party/pkg/intl js: path: ../js + language_server_protocol: + path: ../../third_party/pkg/language_server_protocol linter: path: ../linter lints:
diff --git a/pkg/analysis_server/test/lsp/call_hierarchy_test.dart b/pkg/analysis_server/test/lsp/call_hierarchy_test.dart index 3b90ea7..b6400d5 100644 --- a/pkg/analysis_server/test/lsp/call_hierarchy_test.dart +++ b/pkg/analysis_server/test/lsp/call_hierarchy_test.dart
@@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; +import 'package:language_server_protocol/protocol_generated.dart'; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/lsp/code_actions_refactor_test.dart b/pkg/analysis_server/test/lsp/code_actions_refactor_test.dart index a8d4a8a..39add86 100644 --- a/pkg/analysis_server/test/lsp/code_actions_refactor_test.dart +++ b/pkg/analysis_server/test/lsp/code_actions_refactor_test.dart
@@ -6,8 +6,8 @@ import 'package:analysis_server/lsp_protocol/protocol.dart'; import 'package:analysis_server/src/lsp/constants.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; import 'package:analyzer/src/test_utilities/test_code_format.dart'; +import 'package:language_server_protocol/json_parsing.dart'; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/lsp/initialization_test.dart b/pkg/analysis_server/test/lsp/initialization_test.dart index 99a213e6f..a548801 100644 --- a/pkg/analysis_server/test/lsp/initialization_test.dart +++ b/pkg/analysis_server/test/lsp/initialization_test.dart
@@ -7,11 +7,11 @@ import 'package:analysis_server/lsp_protocol/protocol.dart'; import 'package:analysis_server/src/analysis_server.dart'; import 'package:analysis_server/src/lsp/constants.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; import 'package:analysis_server/src/lsp/server_capabilities_computer.dart'; import 'package:analysis_server/src/plugin/plugin_manager.dart'; import 'package:analyzer/file_system/memory_file_system.dart'; import 'package:analyzer/src/util/file_paths.dart' as file_paths; +import 'package:language_server_protocol/json_parsing.dart'; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/lsp/request_helpers_mixin.dart b/pkg/analysis_server/test/lsp/request_helpers_mixin.dart index bbcbfa2..4160ec8 100644 --- a/pkg/analysis_server/test/lsp/request_helpers_mixin.dart +++ b/pkg/analysis_server/test/lsp/request_helpers_mixin.dart
@@ -6,10 +6,10 @@ import 'package:analysis_server/lsp_protocol/protocol.dart'; import 'package:analysis_server/src/lsp/constants.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; import 'package:analysis_server/src/lsp/mapping.dart'; import 'package:analyzer/source/line_info.dart'; import 'package:collection/collection.dart'; +import 'package:language_server_protocol/json_parsing.dart'; import 'package:test/test.dart' as test show expect; import 'package:test/test.dart' hide expect;
diff --git a/pkg/analysis_server/test/lsp/server_abstract.dart b/pkg/analysis_server/test/lsp/server_abstract.dart index db4b918..3335245 100644 --- a/pkg/analysis_server/test/lsp/server_abstract.dart +++ b/pkg/analysis_server/test/lsp/server_abstract.dart
@@ -8,7 +8,6 @@ import 'package:analysis_server/src/analytics/analytics_manager.dart'; import 'package:analysis_server/src/legacy_analysis_server.dart'; import 'package:analysis_server/src/lsp/constants.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; import 'package:analysis_server/src/lsp/lsp_analysis_server.dart'; import 'package:analysis_server/src/plugin/plugin_manager.dart'; import 'package:analysis_server/src/server/crash_reporting_attachments.dart'; @@ -24,6 +23,7 @@ import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; import 'package:analyzer_plugin/src/protocol/protocol_internal.dart' as plugin; import 'package:collection/collection.dart'; +import 'package:language_server_protocol/json_parsing.dart'; import 'package:path/path.dart' as path; import 'package:test/test.dart' hide expect; import 'package:unified_analytics/unified_analytics.dart';
diff --git a/pkg/analysis_server/test/lsp/type_hierarchy_test.dart b/pkg/analysis_server/test/lsp/type_hierarchy_test.dart index f63135c..4e3de59 100644 --- a/pkg/analysis_server/test/lsp/type_hierarchy_test.dart +++ b/pkg/analysis_server/test/lsp/type_hierarchy_test.dart
@@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; import 'package:analyzer/src/test_utilities/test_code_format.dart'; +import 'package:language_server_protocol/protocol_generated.dart'; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/tool/lsp_spec/json_test.dart b/pkg/analysis_server/test/tool/lsp_spec/json_test.dart index 1d6db66..70afea5 100644 --- a/pkg/analysis_server/test/tool/lsp_spec/json_test.dart +++ b/pkg/analysis_server/test/tool/lsp_spec/json_test.dart
@@ -5,7 +5,7 @@ import 'dart:convert'; import 'package:analysis_server/lsp_protocol/protocol.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; +import 'package:language_server_protocol/json_parsing.dart'; import 'package:test/test.dart'; void main() {
diff --git a/pkg/analysis_server/test/tool/lsp_spec/readme_test.dart b/pkg/analysis_server/test/tool/lsp_spec/readme_test.dart index 81a8633..9b9108e 100644 --- a/pkg/analysis_server/test/tool/lsp_spec/readme_test.dart +++ b/pkg/analysis_server/test/tool/lsp_spec/readme_test.dart
@@ -12,8 +12,8 @@ void main() { final serverPkgPath = _getAnalysisServerPkgPath(); final readmeFile = File(path.join(serverPkgPath, 'tool/lsp_spec/README.md')); - final metaModelJsonFile = - File(path.join(serverPkgPath, 'tool/lsp_spec/lsp_meta_model.json')); + final metaModelJsonFile = File(path.join(serverPkgPath, + '../../third_party/pkg/language_server_protocol/lsp_meta_model.json')); group('LSP readme', () { test('contains all methods', () {
diff --git a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart index 17e9613..ccc1d74 100644 --- a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart +++ b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
@@ -627,7 +627,14 @@ for (var field in _getAllFields(interface)) { buffer.write(' && '); final type = resolveTypeAlias(field.type); - _writeEqualsExpression(buffer, type, field.name, 'other.${field.name}'); + final thisName = field.name; + final otherName = 'other.${field.name}'; + if (type is ArrayType || type is MapType) { + buffer.write( + 'const DeepCollectionEquality().equals($thisName, $otherName)'); + } else { + buffer.write('$thisName == $otherName'); + } } buffer ..writeln(';') @@ -636,27 +643,6 @@ ..writeIndentedln('}'); } -void _writeEqualsExpression(IndentableStringBuffer buffer, TypeBase type, - String thisName, String otherName) { - if (type is ArrayType) { - final elementType = type.elementType; - final elementDartType = elementType.dartTypeWithTypeArgs; - buffer.write( - 'listEqual($thisName, $otherName, ($elementDartType a, $elementDartType b) => '); - _writeEqualsExpression(buffer, elementType, 'a', 'b'); - buffer.write(')'); - } else if (type is MapType) { - final valueType = type.valueType; - final valueDartType = valueType.dartTypeWithTypeArgs; - buffer.write( - 'mapEqual($thisName, $otherName, ($valueDartType a, $valueDartType b) => '); - _writeEqualsExpression(buffer, valueType, 'a', 'b'); - buffer.write(')'); - } else { - buffer.write('$thisName == $otherName'); - } -} - void _writeField( IndentableStringBuffer buffer, Interface interface, Field field) { _writeDocCommentsAndAnnotations(buffer, field);
diff --git a/pkg/analysis_server/tool/lsp_spec/generate_all.dart b/pkg/analysis_server/tool/lsp_spec/generate_all.dart index f06774a..fc56847 100644 --- a/pkg/analysis_server/tool/lsp_spec/generate_all.dart +++ b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
@@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; import 'dart:io'; import 'package:args/args.dart'; @@ -19,10 +20,7 @@ return; } - final script = Platform.script.toFilePath(); - // 3x parent = file -> lsp_spec -> tool -> analysis_server. - final packageFolder = File(script).parent.parent.parent.path; - final outFolder = path.join(packageFolder, 'lib', 'lsp_protocol'); + final outFolder = path.join(languageServerProtocolPackagePath, 'lib'); Directory(outFolder).createSync(); // Collect definitions for types in the model and our custom extensions. @@ -57,14 +55,27 @@ help: 'Download the latest version of the LSP spec before generating types'); -final String localLicensePath = path.join( - path.dirname(Platform.script.toFilePath()), 'lsp_meta_model.license.txt'); +final String languageServerProtocolPackagePath = + '$sdkRootPath/third_party/pkg/language_server_protocol'; -final String localSpecPath = path.join( - path.dirname(Platform.script.toFilePath()), 'lsp_meta_model.json'); +final String licenseComment = LineSplitter.split( + File(localLicensePath).readAsStringSync()) + .skipWhile((line) => + line != + 'Files: lib/protocol_custom_generated.dart, lib/protocol_generated.dart') + .skip(2) + .map((line) => line.isEmpty ? '//' : '// $line') + .join('\n'); + +final String localLicensePath = '$languageServerProtocolPackagePath/LICENSE'; +final String localSpecPath = + '$languageServerProtocolPackagePath/lsp_meta_model.json'; + +final String sdkRootPath = + File(Platform.script.toFilePath()).parent.parent.parent.parent.parent.path; final Uri specLicenseUri = Uri.parse( - 'https://microsoft.github.io/language-server-protocol/License.txt'); + 'https://microsoft.github.io/language-server-protocol/License-code.txt'); /// The URI of the version of the LSP meta model to generate from. This should /// be periodically updated to the latest version. @@ -78,20 +89,22 @@ assert(specResp.statusCode == 200); assert(licenseResp.statusCode == 200); + final dartSdkLicense = await File('$sdkRootPath/LICENSE').readAsString(); await File(localSpecPath).writeAsString(specResp.body); - await File(localLicensePath).writeAsString( - 'This license is for the ${path.basename(localSpecPath)} file.\n\n' - '${path.basename(localLicensePath)} downloaded from: $specLicenseUri\n' - '${path.basename(localSpecPath)} downloaded from: $specUri\n' - '\n--\n\n' - '${licenseResp.body}', - ); + await File(localLicensePath).writeAsString(''' +$dartSdkLicense + +------------------ + +Files: lsp_meta_model.json +Files: lib/protocol_custom_generated.dart, lib/protocol_generated.dart + +${licenseResp.body} +'''); } String generatedFileHeader(int year, {bool importCustom = false}) => ''' -// Copyright (c) $year, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. +$licenseComment // This file has been automatically generated. Please do not edit it manually. // To regenerate the file, use the script @@ -100,10 +113,11 @@ import 'dart:core' hide deprecated; import 'dart:core' as core show deprecated; import 'dart:convert' show JsonEncoder; -import 'package:analysis_server/lsp_protocol/protocol${importCustom ? '_custom' : ''}_generated.dart'; -import 'package:analysis_server/lsp_protocol/protocol_special.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; -import 'package:analysis_server/src/protocol/protocol_internal.dart'; + +import 'package:collection/collection.dart'; +import 'package:language_server_protocol/json_parsing.dart'; +import 'package:language_server_protocol/protocol_special.dart'; +import 'package:language_server_protocol/protocol${importCustom ? '_custom' : ''}_generated.dart'; const jsonEncoder = JsonEncoder.withIndent(' ');
diff --git a/pkg/analysis_server/tool/lsp_spec/lsp_meta_model.license.txt b/pkg/analysis_server/tool/lsp_spec/lsp_meta_model.license.txt deleted file mode 100644 index dcc54cb..0000000 --- a/pkg/analysis_server/tool/lsp_spec/lsp_meta_model.license.txt +++ /dev/null
@@ -1,15 +0,0 @@ -This license is for the lsp_meta_model.json file. - -lsp_meta_model.license.txt downloaded from: https://microsoft.github.io/language-server-protocol/License.txt -lsp_meta_model.json downloaded from: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.json - --- - -Copyright (c) Microsoft Corporation. - -All rights reserved. - -Distributed under the following terms: - -1. Documentation is licensed under the Creative Commons Attribution 3.0 United States License. Code is licensed under the MIT License. -2. This license does not grant you rights to use any trademarks or logos of Microsoft. For Microsoft’s general trademark guidelines, go to http://go.microsoft.com/fwlink/?LinkID=254653 \ No newline at end of file
diff --git a/third_party/pkg/language_server_protocol/LICENSE b/third_party/pkg/language_server_protocol/LICENSE new file mode 100644 index 0000000..4ba88d3 --- /dev/null +++ b/third_party/pkg/language_server_protocol/LICENSE
@@ -0,0 +1,54 @@ +Copyright 2012, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google LLC nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +------------------ + +Files: lsp_meta_model.json +Files: lib/protocol_custom_generated.dart, lib/protocol_generated.dart + +MIT License + +Copyright (c) Microsoft Corporation. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE
diff --git a/third_party/pkg/language_server_protocol/README.md b/third_party/pkg/language_server_protocol/README.md new file mode 100644 index 0000000..fe2942d --- /dev/null +++ b/third_party/pkg/language_server_protocol/README.md
@@ -0,0 +1,9 @@ +The language server protocol + +The contents of LICENSE is are downloaded from: + +https://microsoft.github.io/language-server-protocol/License-code.txt + +The file lsp_meta_model.json is downloaded from: + +https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.json
diff --git a/pkg/analysis_server/lib/src/lsp/json_parsing.dart b/third_party/pkg/language_server_protocol/lib/json_parsing.dart similarity index 100% rename from pkg/analysis_server/lib/src/lsp/json_parsing.dart rename to third_party/pkg/language_server_protocol/lib/json_parsing.dart
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart b/third_party/pkg/language_server_protocol/lib/protocol_custom_generated.dart similarity index 97% rename from pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart rename to third_party/pkg/language_server_protocol/lib/protocol_custom_generated.dart index 0dfa5ee..03921c3 100644 --- a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart +++ b/third_party/pkg/language_server_protocol/lib/protocol_custom_generated.dart
@@ -1,6 +1,24 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. +// MIT License +// +// Copyright (c) Microsoft Corporation. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE // This file has been automatically generated. Please do not edit it manually. // To regenerate the file, use the script @@ -9,10 +27,11 @@ import 'dart:core' hide deprecated; import 'dart:core' as core show deprecated; import 'dart:convert' show JsonEncoder; -import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; -import 'package:analysis_server/lsp_protocol/protocol_special.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; -import 'package:analysis_server/src/protocol/protocol_internal.dart'; + +import 'package:collection/collection.dart'; +import 'package:language_server_protocol/json_parsing.dart'; +import 'package:language_server_protocol/protocol_special.dart'; +import 'package:language_server_protocol/protocol_generated.dart'; const jsonEncoder = JsonEncoder.withIndent(' '); @@ -321,8 +340,7 @@ return other is DartCompletionResolutionInfo && other.runtimeType == DartCompletionResolutionInfo && file == other.file && - listEqual( - importUris, other.importUris, (String a, String b) => a == b) && + const DeepCollectionEquality().equals(importUris, other.importUris) && ref == other.ref; } @@ -648,10 +666,8 @@ bool operator ==(Object other) { return other is FlutterOutline && other.runtimeType == FlutterOutline && - listEqual(attributes, other.attributes, - (FlutterOutlineAttribute a, FlutterOutlineAttribute b) => a == b) && - listEqual(children, other.children, - (FlutterOutline a, FlutterOutline b) => a == b) && + const DeepCollectionEquality().equals(attributes, other.attributes) && + const DeepCollectionEquality().equals(children, other.children) && className == other.className && codeRange == other.codeRange && dartElement == other.dartElement && @@ -1142,7 +1158,7 @@ bool operator ==(Object other) { return other is Outline && other.runtimeType == Outline && - listEqual(children, other.children, (Outline a, Outline b) => a == b) && + const DeepCollectionEquality().equals(children, other.children) && codeRange == other.codeRange && element == other.element && range == other.range; @@ -1265,8 +1281,7 @@ bool operator ==(Object other) { return other is PublishClosingLabelsParams && other.runtimeType == PublishClosingLabelsParams && - listEqual( - labels, other.labels, (ClosingLabel a, ClosingLabel b) => a == b) && + const DeepCollectionEquality().equals(labels, other.labels) && uri == other.uri; } @@ -1818,11 +1833,7 @@ other.runtimeType == SaveUriCommandParameter && actionLabel == other.actionLabel && defaultValue == other.defaultValue && - mapEqual( - filters, - other.filters, - (List<String> a, List<String> b) => - listEqual(a, b, (String a, String b) => a == b)) && + const DeepCollectionEquality().equals(filters, other.filters) && kind == other.kind && parameterLabel == other.parameterLabel && parameterTitle == other.parameterTitle; @@ -1980,7 +1991,7 @@ bool operator ==(Object other) { return other is TypeHierarchyAnchor && other.runtimeType == TypeHierarchyAnchor && - listEqual(path, other.path, (int a, int b) => a == b) && + const DeepCollectionEquality().equals(path, other.path) && ref == other.ref; }
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/third_party/pkg/language_server_protocol/lib/protocol_generated.dart similarity index 97% rename from pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart rename to third_party/pkg/language_server_protocol/lib/protocol_generated.dart index 366265e..da2379a 100644 --- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart +++ b/third_party/pkg/language_server_protocol/lib/protocol_generated.dart
@@ -1,6 +1,24 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. +// MIT License +// +// Copyright (c) Microsoft Corporation. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE // This file has been automatically generated. Please do not edit it manually. // To regenerate the file, use the script @@ -9,10 +27,11 @@ import 'dart:core' hide deprecated; import 'dart:core' as core show deprecated; import 'dart:convert' show JsonEncoder; -import 'package:analysis_server/lsp_protocol/protocol_custom_generated.dart'; -import 'package:analysis_server/lsp_protocol/protocol_special.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; -import 'package:analysis_server/src/protocol/protocol_internal.dart'; + +import 'package:collection/collection.dart'; +import 'package:language_server_protocol/json_parsing.dart'; +import 'package:language_server_protocol/protocol_special.dart'; +import 'package:language_server_protocol/protocol_custom_generated.dart'; const jsonEncoder = JsonEncoder.withIndent(' '); @@ -725,7 +744,7 @@ containerName == other.containerName && kind == other.kind && name == other.name && - listEqual(tags, other.tags, (SymbolTag a, SymbolTag b) => a == b); + const DeepCollectionEquality().equals(tags, other.tags); } @override @@ -857,7 +876,7 @@ return other is CallHierarchyIncomingCall && other.runtimeType == CallHierarchyIncomingCall && from == other.from && - listEqual(fromRanges, other.fromRanges, (Range a, Range b) => a == b); + const DeepCollectionEquality().equals(fromRanges, other.fromRanges); } @override @@ -1108,7 +1127,7 @@ name == other.name && range == other.range && selectionRange == other.selectionRange && - listEqual(tags, other.tags, (SymbolTag a, SymbolTag b) => a == b) && + const DeepCollectionEquality().equals(tags, other.tags) && uri == other.uri; } @@ -1249,7 +1268,7 @@ bool operator ==(Object other) { return other is CallHierarchyOutgoingCall && other.runtimeType == CallHierarchyOutgoingCall && - listEqual(fromRanges, other.fromRanges, (Range a, Range b) => a == b) && + const DeepCollectionEquality().equals(fromRanges, other.fromRanges) && to == other.to; } @@ -1533,11 +1552,8 @@ bool operator ==(Object other) { return other is CallHierarchyRegistrationOptions && other.runtimeType == CallHierarchyRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -2031,8 +2047,7 @@ other.runtimeType == CodeAction && command == other.command && data == other.data && - listEqual(diagnostics, other.diagnostics, - (Diagnostic a, Diagnostic b) => a == b) && + const DeepCollectionEquality().equals(diagnostics, other.diagnostics) && disabled == other.disabled && edit == other.edit && isPreferred == other.isPreferred && @@ -2338,7 +2353,7 @@ bool operator ==(Object other) { return other is CodeActionClientCapabilitiesResolveSupport && other.runtimeType == CodeActionClientCapabilitiesResolveSupport && - listEqual(properties, other.properties, (String a, String b) => a == b); + const DeepCollectionEquality().equals(properties, other.properties); } @override @@ -2435,10 +2450,8 @@ bool operator ==(Object other) { return other is CodeActionContext && other.runtimeType == CodeActionContext && - listEqual(diagnostics, other.diagnostics, - (Diagnostic a, Diagnostic b) => a == b) && - listEqual( - only, other.only, (CodeActionKind a, CodeActionKind b) => a == b) && + const DeepCollectionEquality().equals(diagnostics, other.diagnostics) && + const DeepCollectionEquality().equals(only, other.only) && triggerKind == other.triggerKind; } @@ -2635,8 +2648,7 @@ bool operator ==(Object other) { return other is CodeActionLiteralSupportCodeActionKind && other.runtimeType == CodeActionLiteralSupportCodeActionKind && - listEqual(valueSet, other.valueSet, - (CodeActionKind a, CodeActionKind b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override @@ -2729,8 +2741,8 @@ bool operator ==(Object other) { return other is CodeActionOptions && other.runtimeType == CodeActionOptions && - listEqual(codeActionKinds, other.codeActionKinds, - (CodeActionKind a, CodeActionKind b) => a == b) && + const DeepCollectionEquality() + .equals(codeActionKinds, other.codeActionKinds) && resolveProvider == other.resolveProvider && workDoneProgress == other.workDoneProgress; } @@ -2970,13 +2982,10 @@ bool operator ==(Object other) { return other is CodeActionRegistrationOptions && other.runtimeType == CodeActionRegistrationOptions && - listEqual(codeActionKinds, other.codeActionKinds, - (CodeActionKind a, CodeActionKind b) => a == b) && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(codeActionKinds, other.codeActionKinds) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && resolveProvider == other.resolveProvider && workDoneProgress == other.workDoneProgress; } @@ -3471,11 +3480,8 @@ bool operator ==(Object other) { return other is CodeLensRegistrationOptions && other.runtimeType == CodeLensRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && resolveProvider == other.resolveProvider && workDoneProgress == other.workDoneProgress; } @@ -3797,8 +3803,8 @@ bool operator ==(Object other) { return other is ColorPresentation && other.runtimeType == ColorPresentation && - listEqual(additionalTextEdits, other.additionalTextEdits, - (TextEdit a, TextEdit b) => a == b) && + const DeepCollectionEquality() + .equals(additionalTextEdits, other.additionalTextEdits) && label == other.label && textEdit == other.textEdit; } @@ -4008,7 +4014,7 @@ bool operator ==(Object other) { return other is Command && other.runtimeType == Command && - listEqual(arguments, other.arguments, (LSPAny a, LSPAny b) => a == b) && + const DeepCollectionEquality().equals(arguments, other.arguments) && command == other.command && title == other.title; } @@ -4391,8 +4397,8 @@ other.runtimeType == CompletionClientCapabilitiesCompletionItem && commitCharactersSupport == other.commitCharactersSupport && deprecatedSupport == other.deprecatedSupport && - listEqual(documentationFormat, other.documentationFormat, - (MarkupKind a, MarkupKind b) => a == b) && + const DeepCollectionEquality() + .equals(documentationFormat, other.documentationFormat) && insertReplaceSupport == other.insertReplaceSupport && insertTextModeSupport == other.insertTextModeSupport && labelDetailsSupport == other.labelDetailsSupport && @@ -4473,8 +4479,7 @@ bool operator ==(Object other) { return other is CompletionClientCapabilitiesCompletionItemKind && other.runtimeType == CompletionClientCapabilitiesCompletionItemKind && - listEqual(valueSet, other.valueSet, - (CompletionItemKind a, CompletionItemKind b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override @@ -4537,8 +4542,7 @@ bool operator ==(Object other) { return other is CompletionClientCapabilitiesCompletionList && other.runtimeType == CompletionClientCapabilitiesCompletionList && - listEqual( - itemDefaults, other.itemDefaults, (String a, String b) => a == b); + const DeepCollectionEquality().equals(itemDefaults, other.itemDefaults); } @override @@ -5018,11 +5022,11 @@ bool operator ==(Object other) { return other is CompletionItem && other.runtimeType == CompletionItem && - listEqual(additionalTextEdits, other.additionalTextEdits, - (TextEdit a, TextEdit b) => a == b) && + const DeepCollectionEquality() + .equals(additionalTextEdits, other.additionalTextEdits) && command == other.command && - listEqual(commitCharacters, other.commitCharacters, - (String a, String b) => a == b) && + const DeepCollectionEquality() + .equals(commitCharacters, other.commitCharacters) && data == other.data && deprecated == other.deprecated && detail == other.detail && @@ -5036,8 +5040,7 @@ labelDetails == other.labelDetails && preselect == other.preselect && sortText == other.sortText && - listEqual(tags, other.tags, - (CompletionItemTag a, CompletionItemTag b) => a == b) && + const DeepCollectionEquality().equals(tags, other.tags) && textEdit == other.textEdit && textEditText == other.textEditText; } @@ -5177,8 +5180,7 @@ bool operator ==(Object other) { return other is CompletionItemInsertTextModeSupport && other.runtimeType == CompletionItemInsertTextModeSupport && - listEqual(valueSet, other.valueSet, - (InsertTextMode a, InsertTextMode b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override @@ -5358,7 +5360,7 @@ bool operator ==(Object other) { return other is CompletionItemResolveSupport && other.runtimeType == CompletionItemResolveSupport && - listEqual(properties, other.properties, (String a, String b) => a == b); + const DeepCollectionEquality().equals(properties, other.properties); } @override @@ -5440,8 +5442,7 @@ bool operator ==(Object other) { return other is CompletionItemTagSupport && other.runtimeType == CompletionItemTagSupport && - listEqual(valueSet, other.valueSet, - (CompletionItemTag a, CompletionItemTag b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override @@ -5541,8 +5542,7 @@ other.runtimeType == CompletionList && isIncomplete == other.isIncomplete && itemDefaults == other.itemDefaults && - listEqual( - items, other.items, (CompletionItem a, CompletionItem b) => a == b); + const DeepCollectionEquality().equals(items, other.items); } @override @@ -5669,8 +5669,8 @@ bool operator ==(Object other) { return other is CompletionListItemDefaults && other.runtimeType == CompletionListItemDefaults && - listEqual(commitCharacters, other.commitCharacters, - (String a, String b) => a == b) && + const DeepCollectionEquality() + .equals(commitCharacters, other.commitCharacters) && data == other.data && editRange == other.editRange && insertTextFormat == other.insertTextFormat && @@ -5820,12 +5820,12 @@ bool operator ==(Object other) { return other is CompletionOptions && other.runtimeType == CompletionOptions && - listEqual(allCommitCharacters, other.allCommitCharacters, - (String a, String b) => a == b) && + const DeepCollectionEquality() + .equals(allCommitCharacters, other.allCommitCharacters) && completionItem == other.completionItem && resolveProvider == other.resolveProvider && - listEqual(triggerCharacters, other.triggerCharacters, - (String a, String b) => a == b) && + const DeepCollectionEquality() + .equals(triggerCharacters, other.triggerCharacters) && workDoneProgress == other.workDoneProgress; } @@ -6183,17 +6183,14 @@ bool operator ==(Object other) { return other is CompletionRegistrationOptions && other.runtimeType == CompletionRegistrationOptions && - listEqual(allCommitCharacters, other.allCommitCharacters, - (String a, String b) => a == b) && + const DeepCollectionEquality() + .equals(allCommitCharacters, other.allCommitCharacters) && completionItem == other.completionItem && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && resolveProvider == other.resolveProvider && - listEqual(triggerCharacters, other.triggerCharacters, - (String a, String b) => a == b) && + const DeepCollectionEquality() + .equals(triggerCharacters, other.triggerCharacters) && workDoneProgress == other.workDoneProgress; } @@ -6367,8 +6364,7 @@ bool operator ==(Object other) { return other is ConfigurationParams && other.runtimeType == ConfigurationParams && - listEqual(items, other.items, - (ConfigurationItem a, ConfigurationItem b) => a == b); + const DeepCollectionEquality().equals(items, other.items); } @override @@ -6607,7 +6603,7 @@ bool operator ==(Object other) { return other is CreateFilesParams && other.runtimeType == CreateFilesParams && - listEqual(files, other.files, (FileCreate a, FileCreate b) => a == b); + const DeepCollectionEquality().equals(files, other.files); } @override @@ -6941,11 +6937,8 @@ bool operator ==(Object other) { return other is DeclarationRegistrationOptions && other.runtimeType == DeclarationRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -7268,11 +7261,8 @@ bool operator ==(Object other) { return other is DefinitionRegistrationOptions && other.runtimeType == DefinitionRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && workDoneProgress == other.workDoneProgress; } @@ -7515,7 +7505,7 @@ bool operator ==(Object other) { return other is DeleteFilesParams && other.runtimeType == DeleteFilesParams && - listEqual(files, other.files, (FileDelete a, FileDelete b) => a == b); + const DeepCollectionEquality().equals(files, other.files); } @override @@ -7702,15 +7692,11 @@ data == other.data && message == other.message && range == other.range && - listEqual( - relatedInformation, - other.relatedInformation, - (DiagnosticRelatedInformation a, DiagnosticRelatedInformation b) => - a == b) && + const DeepCollectionEquality() + .equals(relatedInformation, other.relatedInformation) && severity == other.severity && source == other.source && - listEqual( - tags, other.tags, (DiagnosticTag a, DiagnosticTag b) => a == b); + const DeepCollectionEquality().equals(tags, other.tags); } @override @@ -8045,11 +8031,8 @@ bool operator ==(Object other) { return other is DiagnosticRegistrationOptions && other.runtimeType == DiagnosticRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && identifier == other.identifier && interFileDependencies == other.interFileDependencies && @@ -8600,12 +8583,8 @@ bool operator ==(Object other) { return other is DidChangeTextDocumentParams && other.runtimeType == DidChangeTextDocumentParams && - listEqual( - contentChanges, - other.contentChanges, - (TextDocumentContentChangeEvent a, - TextDocumentContentChangeEvent b) => - a == b) && + const DeepCollectionEquality() + .equals(contentChanges, other.contentChanges) && textDocument == other.textDocument; } @@ -8741,7 +8720,7 @@ bool operator ==(Object other) { return other is DidChangeWatchedFilesParams && other.runtimeType == DidChangeWatchedFilesParams && - listEqual(changes, other.changes, (FileEvent a, FileEvent b) => a == b); + const DeepCollectionEquality().equals(changes, other.changes); } @override @@ -8797,8 +8776,7 @@ bool operator ==(Object other) { return other is DidChangeWatchedFilesRegistrationOptions && other.runtimeType == DidChangeWatchedFilesRegistrationOptions && - listEqual(watchers, other.watchers, - (FileSystemWatcher a, FileSystemWatcher b) => a == b); + const DeepCollectionEquality().equals(watchers, other.watchers); } @override @@ -8925,8 +8903,8 @@ bool operator ==(Object other) { return other is DidCloseNotebookDocumentParams && other.runtimeType == DidCloseNotebookDocumentParams && - listEqual(cellTextDocuments, other.cellTextDocuments, - (TextDocumentIdentifier a, TextDocumentIdentifier b) => a == b) && + const DeepCollectionEquality() + .equals(cellTextDocuments, other.cellTextDocuments) && notebookDocument == other.notebookDocument; } @@ -9053,8 +9031,8 @@ bool operator ==(Object other) { return other is DidOpenNotebookDocumentParams && other.runtimeType == DidOpenNotebookDocumentParams && - listEqual(cellTextDocuments, other.cellTextDocuments, - (TextDocumentItem a, TextDocumentItem b) => a == b) && + const DeepCollectionEquality() + .equals(cellTextDocuments, other.cellTextDocuments) && notebookDocument == other.notebookDocument; } @@ -9535,11 +9513,8 @@ bool operator ==(Object other) { return other is DocumentColorRegistrationOptions && other.runtimeType == DocumentColorRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -9768,16 +9743,8 @@ bool operator ==(Object other) { return other is DocumentDiagnosticReportPartialResult && other.runtimeType == DocumentDiagnosticReportPartialResult && - mapEqual( - relatedDocuments, - other.relatedDocuments, - (Either2<FullDocumentDiagnosticReport, - UnchangedDocumentDiagnosticReport> - a, - Either2<FullDocumentDiagnosticReport, - UnchangedDocumentDiagnosticReport> - b) => - a == b); + const DeepCollectionEquality() + .equals(relatedDocuments, other.relatedDocuments); } @override @@ -10056,11 +10023,8 @@ bool operator ==(Object other) { return other is DocumentFormattingRegistrationOptions && other.runtimeType == DocumentFormattingRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && workDoneProgress == other.workDoneProgress; } @@ -10475,11 +10439,8 @@ bool operator ==(Object other) { return other is DocumentHighlightRegistrationOptions && other.runtimeType == DocumentHighlightRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && workDoneProgress == other.workDoneProgress; } @@ -10922,11 +10883,8 @@ bool operator ==(Object other) { return other is DocumentLinkRegistrationOptions && other.runtimeType == DocumentLinkRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && resolveProvider == other.resolveProvider && workDoneProgress == other.workDoneProgress; } @@ -11061,8 +11019,8 @@ return other is DocumentOnTypeFormattingOptions && other.runtimeType == DocumentOnTypeFormattingOptions && firstTriggerCharacter == other.firstTriggerCharacter && - listEqual(moreTriggerCharacter, other.moreTriggerCharacter, - (String a, String b) => a == b); + const DeepCollectionEquality() + .equals(moreTriggerCharacter, other.moreTriggerCharacter); } @override @@ -11262,14 +11220,11 @@ bool operator ==(Object other) { return other is DocumentOnTypeFormattingRegistrationOptions && other.runtimeType == DocumentOnTypeFormattingRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && firstTriggerCharacter == other.firstTriggerCharacter && - listEqual(moreTriggerCharacter, other.moreTriggerCharacter, - (String a, String b) => a == b); + const DeepCollectionEquality() + .equals(moreTriggerCharacter, other.moreTriggerCharacter); } @override @@ -11568,11 +11523,8 @@ bool operator ==(Object other) { return other is DocumentRangeFormattingRegistrationOptions && other.runtimeType == DocumentRangeFormattingRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && workDoneProgress == other.workDoneProgress; } @@ -11738,15 +11690,14 @@ bool operator ==(Object other) { return other is DocumentSymbol && other.runtimeType == DocumentSymbol && - listEqual(children, other.children, - (DocumentSymbol a, DocumentSymbol b) => a == b) && + const DeepCollectionEquality().equals(children, other.children) && deprecated == other.deprecated && detail == other.detail && kind == other.kind && name == other.name && range == other.range && selectionRange == other.selectionRange && - listEqual(tags, other.tags, (SymbolTag a, SymbolTag b) => a == b); + const DeepCollectionEquality().equals(tags, other.tags); } @override @@ -11957,8 +11908,7 @@ bool operator ==(Object other) { return other is DocumentSymbolClientCapabilitiesSymbolKind && other.runtimeType == DocumentSymbolClientCapabilitiesSymbolKind && - listEqual( - valueSet, other.valueSet, (SymbolKind a, SymbolKind b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override @@ -12013,8 +11963,7 @@ bool operator ==(Object other) { return other is DocumentSymbolClientCapabilitiesTagSupport && other.runtimeType == DocumentSymbolClientCapabilitiesTagSupport && - listEqual( - valueSet, other.valueSet, (SymbolTag a, SymbolTag b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override @@ -12278,11 +12227,8 @@ bool operator ==(Object other) { return other is DocumentSymbolRegistrationOptions && other.runtimeType == DocumentSymbolRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && label == other.label && workDoneProgress == other.workDoneProgress; } @@ -12469,7 +12415,7 @@ bool operator ==(Object other) { return other is ExecuteCommandOptions && other.runtimeType == ExecuteCommandOptions && - listEqual(commands, other.commands, (String a, String b) => a == b) && + const DeepCollectionEquality().equals(commands, other.commands) && workDoneProgress == other.workDoneProgress; } @@ -12556,7 +12502,7 @@ bool operator ==(Object other) { return other is ExecuteCommandParams && other.runtimeType == ExecuteCommandParams && - listEqual(arguments, other.arguments, (LSPAny a, LSPAny b) => a == b) && + const DeepCollectionEquality().equals(arguments, other.arguments) && command == other.command && workDoneToken == other.workDoneToken; } @@ -12630,7 +12576,7 @@ bool operator ==(Object other) { return other is ExecuteCommandRegistrationOptions && other.runtimeType == ExecuteCommandRegistrationOptions && - listEqual(commands, other.commands, (String a, String b) => a == b) && + const DeepCollectionEquality().equals(commands, other.commands) && workDoneProgress == other.workDoneProgress; } @@ -13604,8 +13550,7 @@ bool operator ==(Object other) { return other is FileOperationRegistrationOptions && other.runtimeType == FileOperationRegistrationOptions && - listEqual(filters, other.filters, - (FileOperationFilter a, FileOperationFilter b) => a == b); + const DeepCollectionEquality().equals(filters, other.filters); } @override @@ -14150,8 +14095,7 @@ bool operator ==(Object other) { return other is FoldingRangeClientCapabilitiesFoldingRangeKind && other.runtimeType == FoldingRangeClientCapabilitiesFoldingRangeKind && - listEqual(valueSet, other.valueSet, - (FoldingRangeKind a, FoldingRangeKind b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override @@ -14424,11 +14368,8 @@ bool operator ==(Object other) { return other is FoldingRangeRegistrationOptions && other.runtimeType == FoldingRangeRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -14651,7 +14592,7 @@ bool operator ==(Object other) { return other is FullDocumentDiagnosticReport && other.runtimeType == FullDocumentDiagnosticReport && - listEqual(items, other.items, (Diagnostic a, Diagnostic b) => a == b) && + const DeepCollectionEquality().equals(items, other.items) && kind == other.kind && resultId == other.resultId; } @@ -14793,8 +14734,8 @@ return other is GeneralClientCapabilities && other.runtimeType == GeneralClientCapabilities && markdown == other.markdown && - listEqual(positionEncodings, other.positionEncodings, - (PositionEncodingKind a, PositionEncodingKind b) => a == b) && + const DeepCollectionEquality() + .equals(positionEncodings, other.positionEncodings) && regularExpressions == other.regularExpressions && staleRequestSupport == other.staleRequestSupport; } @@ -14870,8 +14811,8 @@ return other is GeneralClientCapabilitiesStaleRequestSupport && other.runtimeType == GeneralClientCapabilitiesStaleRequestSupport && cancel == other.cancel && - listEqual(retryOnContentModified, other.retryOnContentModified, - (String a, String b) => a == b); + const DeepCollectionEquality() + .equals(retryOnContentModified, other.retryOnContentModified); } @override @@ -15018,8 +14959,8 @@ bool operator ==(Object other) { return other is HoverClientCapabilities && other.runtimeType == HoverClientCapabilities && - listEqual(contentFormat, other.contentFormat, - (MarkupKind a, MarkupKind b) => a == b) && + const DeepCollectionEquality() + .equals(contentFormat, other.contentFormat) && dynamicRegistration == other.dynamicRegistration; } @@ -15242,11 +15183,8 @@ bool operator ==(Object other) { return other is HoverRegistrationOptions && other.runtimeType == HoverRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && workDoneProgress == other.workDoneProgress; } @@ -15586,11 +15524,8 @@ bool operator ==(Object other) { return other is ImplementationRegistrationOptions && other.runtimeType == ImplementationRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -15808,8 +15743,8 @@ rootUri == other.rootUri && trace == other.trace && workDoneToken == other.workDoneToken && - listEqual(workspaceFolders, other.workspaceFolders, - (WorkspaceFolder a, WorkspaceFolder b) => a == b); + const DeepCollectionEquality() + .equals(workspaceFolders, other.workspaceFolders); } @override @@ -16241,8 +16176,7 @@ paddingLeft == other.paddingLeft && paddingRight == other.paddingRight && position == other.position && - listEqual( - textEdits, other.textEdits, (TextEdit a, TextEdit b) => a == b) && + const DeepCollectionEquality().equals(textEdits, other.textEdits) && tooltip == other.tooltip; } @@ -16385,7 +16319,7 @@ bool operator ==(Object other) { return other is InlayHintClientCapabilitiesResolveSupport && other.runtimeType == InlayHintClientCapabilitiesResolveSupport && - listEqual(properties, other.properties, (String a, String b) => a == b); + const DeepCollectionEquality().equals(properties, other.properties); } @override @@ -16816,11 +16750,8 @@ bool operator ==(Object other) { return other is InlayHintRegistrationOptions && other.runtimeType == InlayHintRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && resolveProvider == other.resolveProvider && workDoneProgress == other.workDoneProgress; @@ -17352,11 +17283,8 @@ bool operator ==(Object other) { return other is InlineValueRegistrationOptions && other.runtimeType == InlineValueRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -18053,11 +17981,8 @@ bool operator ==(Object other) { return other is LinkedEditingRangeRegistrationOptions && other.runtimeType == LinkedEditingRangeRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -18137,7 +18062,7 @@ bool operator ==(Object other) { return other is LinkedEditingRanges && other.runtimeType == LinkedEditingRanges && - listEqual(ranges, other.ranges, (Range a, Range b) => a == b) && + const DeepCollectionEquality().equals(ranges, other.ranges) && wordPattern == other.wordPattern; } @@ -18537,8 +18462,7 @@ bool operator ==(Object other) { return other is MarkdownClientCapabilities && other.runtimeType == MarkdownClientCapabilities && - listEqual( - allowedTags, other.allowedTags, (String a, String b) => a == b) && + const DeepCollectionEquality().equals(allowedTags, other.allowedTags) && parser == other.parser && version == other.version; } @@ -19522,11 +19446,8 @@ bool operator ==(Object other) { return other is MonikerRegistrationOptions && other.runtimeType == MonikerRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && workDoneProgress == other.workDoneProgress; } @@ -19723,8 +19644,7 @@ bool operator ==(Object other) { return other is NotebookCellArrayChange && other.runtimeType == NotebookCellArrayChange && - listEqual( - cells, other.cells, (NotebookCell a, NotebookCell b) => a == b) && + const DeepCollectionEquality().equals(cells, other.cells) && deleteCount == other.deleteCount && start == other.start; } @@ -19951,8 +19871,7 @@ bool operator ==(Object other) { return other is NotebookDocument && other.runtimeType == NotebookDocument && - listEqual( - cells, other.cells, (NotebookCell a, NotebookCell b) => a == b) && + const DeepCollectionEquality().equals(cells, other.cells) && metadata == other.metadata && notebookType == other.notebookType && uri == other.uri && @@ -20134,15 +20053,9 @@ bool operator ==(Object other) { return other is NotebookDocumentChangeEventCells && other.runtimeType == NotebookDocumentChangeEventCells && - listEqual( - data, other.data, (NotebookCell a, NotebookCell b) => a == b) && + const DeepCollectionEquality().equals(data, other.data) && structure == other.structure && - listEqual( - textContent, - other.textContent, - (NotebookDocumentChangeEventCellsTextContent a, - NotebookDocumentChangeEventCellsTextContent b) => - a == b); + const DeepCollectionEquality().equals(textContent, other.textContent); } @override @@ -20234,10 +20147,8 @@ return other is NotebookDocumentChangeEventCellsStructure && other.runtimeType == NotebookDocumentChangeEventCellsStructure && array == other.array && - listEqual(didClose, other.didClose, - (TextDocumentIdentifier a, TextDocumentIdentifier b) => a == b) && - listEqual(didOpen, other.didOpen, - (TextDocumentItem a, TextDocumentItem b) => a == b); + const DeepCollectionEquality().equals(didClose, other.didClose) && + const DeepCollectionEquality().equals(didOpen, other.didOpen); } @override @@ -20309,12 +20220,7 @@ bool operator ==(Object other) { return other is NotebookDocumentChangeEventCellsTextContent && other.runtimeType == NotebookDocumentChangeEventCellsTextContent && - listEqual( - changes, - other.changes, - (TextDocumentContentChangeEvent a, - TextDocumentContentChangeEvent b) => - a == b) && + const DeepCollectionEquality().equals(changes, other.changes) && document == other.document; } @@ -20853,16 +20759,8 @@ bool operator ==(Object other) { return other is NotebookDocumentSyncOptions && other.runtimeType == NotebookDocumentSyncOptions && - listEqual( - notebookSelector, - other.notebookSelector, - (Either2<NotebookDocumentSyncOptionsNotebookSelector, - NotebookDocumentSyncOptionsNotebookSelector2> - a, - Either2<NotebookDocumentSyncOptionsNotebookSelector, - NotebookDocumentSyncOptionsNotebookSelector2> - b) => - a == b) && + const DeepCollectionEquality() + .equals(notebookSelector, other.notebookSelector) && save == other.save; } @@ -20942,12 +20840,7 @@ bool operator ==(Object other) { return other is NotebookDocumentSyncOptionsNotebookSelector && other.runtimeType == NotebookDocumentSyncOptionsNotebookSelector && - listEqual( - cells, - other.cells, - (NotebookDocumentSyncOptionsNotebookSelectorCells a, - NotebookDocumentSyncOptionsNotebookSelectorCells b) => - a == b) && + const DeepCollectionEquality().equals(cells, other.cells) && notebook == other.notebook; } @@ -21028,12 +20921,7 @@ bool operator ==(Object other) { return other is NotebookDocumentSyncOptionsNotebookSelector2 && other.runtimeType == NotebookDocumentSyncOptionsNotebookSelector2 && - listEqual( - cells, - other.cells, - (NotebookDocumentSyncOptionsNotebookSelector2Cells a, - NotebookDocumentSyncOptionsNotebookSelector2Cells b) => - a == b) && + const DeepCollectionEquality().equals(cells, other.cells) && notebook == other.notebook; } @@ -21243,16 +21131,8 @@ return other is NotebookDocumentSyncRegistrationOptions && other.runtimeType == NotebookDocumentSyncRegistrationOptions && id == other.id && - listEqual( - notebookSelector, - other.notebookSelector, - (Either2<NotebookDocumentSyncOptionsNotebookSelector, - NotebookDocumentSyncOptionsNotebookSelector2> - a, - Either2<NotebookDocumentSyncOptionsNotebookSelector, - NotebookDocumentSyncOptionsNotebookSelector2> - b) => - a == b) && + const DeepCollectionEquality() + .equals(notebookSelector, other.notebookSelector) && save == other.save; } @@ -22250,8 +22130,7 @@ bool operator ==(Object other) { return other is PublishDiagnosticsClientCapabilitiesTagSupport && other.runtimeType == PublishDiagnosticsClientCapabilitiesTagSupport && - listEqual(valueSet, other.valueSet, - (DiagnosticTag a, DiagnosticTag b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override @@ -22334,8 +22213,7 @@ bool operator ==(Object other) { return other is PublishDiagnosticsParams && other.runtimeType == PublishDiagnosticsParams && - listEqual(diagnostics, other.diagnostics, - (Diagnostic a, Diagnostic b) => a == b) && + const DeepCollectionEquality().equals(diagnostics, other.diagnostics) && uri == other.uri && version == other.version; } @@ -22784,11 +22662,8 @@ bool operator ==(Object other) { return other is ReferenceRegistrationOptions && other.runtimeType == ReferenceRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && workDoneProgress == other.workDoneProgress; } @@ -22926,8 +22801,8 @@ bool operator ==(Object other) { return other is RegistrationParams && other.runtimeType == RegistrationParams && - listEqual(registrations, other.registrations, - (Registration a, Registration b) => a == b); + const DeepCollectionEquality() + .equals(registrations, other.registrations); } @override @@ -23123,18 +22998,10 @@ bool operator ==(Object other) { return other is RelatedFullDocumentDiagnosticReport && other.runtimeType == RelatedFullDocumentDiagnosticReport && - listEqual(items, other.items, (Diagnostic a, Diagnostic b) => a == b) && + const DeepCollectionEquality().equals(items, other.items) && kind == other.kind && - mapEqual( - relatedDocuments, - other.relatedDocuments, - (Either2<FullDocumentDiagnosticReport, - UnchangedDocumentDiagnosticReport> - a, - Either2<FullDocumentDiagnosticReport, - UnchangedDocumentDiagnosticReport> - b) => - a == b) && + const DeepCollectionEquality() + .equals(relatedDocuments, other.relatedDocuments) && resultId == other.resultId; } @@ -23247,16 +23114,8 @@ return other is RelatedUnchangedDocumentDiagnosticReport && other.runtimeType == RelatedUnchangedDocumentDiagnosticReport && kind == other.kind && - mapEqual( - relatedDocuments, - other.relatedDocuments, - (Either2<FullDocumentDiagnosticReport, - UnchangedDocumentDiagnosticReport> - a, - Either2<FullDocumentDiagnosticReport, - UnchangedDocumentDiagnosticReport> - b) => - a == b) && + const DeepCollectionEquality() + .equals(relatedDocuments, other.relatedDocuments) && resultId == other.resultId; } @@ -23710,7 +23569,7 @@ bool operator ==(Object other) { return other is RenameFilesParams && other.runtimeType == RenameFilesParams && - listEqual(files, other.files, (FileRename a, FileRename b) => a == b); + const DeepCollectionEquality().equals(files, other.files); } @override @@ -23977,11 +23836,8 @@ bool operator ==(Object other) { return other is RenameRegistrationOptions && other.runtimeType == RenameRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && prepareProvider == other.prepareProvider && workDoneProgress == other.workDoneProgress; } @@ -24454,8 +24310,7 @@ return other is SelectionRangeParams && other.runtimeType == SelectionRangeParams && partialResultToken == other.partialResultToken && - listEqual( - positions, other.positions, (Position a, Position b) => a == b) && + const DeepCollectionEquality().equals(positions, other.positions) && textDocument == other.textDocument && workDoneToken == other.workDoneToken; } @@ -24553,11 +24408,8 @@ bool operator ==(Object other) { return other is SelectionRangeRegistrationOptions && other.runtimeType == SelectionRangeRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -24723,7 +24575,7 @@ bool operator ==(Object other) { return other is SemanticTokens && other.runtimeType == SemanticTokens && - listEqual(data, other.data, (int a, int b) => a == b) && + const DeepCollectionEquality().equals(data, other.data) && resultId == other.resultId; } @@ -24916,15 +24768,14 @@ other.runtimeType == SemanticTokensClientCapabilities && augmentsSyntaxTokens == other.augmentsSyntaxTokens && dynamicRegistration == other.dynamicRegistration && - listEqual( - formats, other.formats, (TokenFormat a, TokenFormat b) => a == b) && + const DeepCollectionEquality().equals(formats, other.formats) && multilineTokenSupport == other.multilineTokenSupport && overlappingTokenSupport == other.overlappingTokenSupport && requests == other.requests && serverCancelSupport == other.serverCancelSupport && - listEqual(tokenModifiers, other.tokenModifiers, - (String a, String b) => a == b) && - listEqual(tokenTypes, other.tokenTypes, (String a, String b) => a == b); + const DeepCollectionEquality() + .equals(tokenModifiers, other.tokenModifiers) && + const DeepCollectionEquality().equals(tokenTypes, other.tokenTypes); } @override @@ -25175,8 +25026,7 @@ bool operator ==(Object other) { return other is SemanticTokensDelta && other.runtimeType == SemanticTokensDelta && - listEqual(edits, other.edits, - (SemanticTokensEdit a, SemanticTokensEdit b) => a == b) && + const DeepCollectionEquality().equals(edits, other.edits) && resultId == other.resultId; } @@ -25343,8 +25193,7 @@ bool operator ==(Object other) { return other is SemanticTokensDeltaPartialResult && other.runtimeType == SemanticTokensDeltaPartialResult && - listEqual(edits, other.edits, - (SemanticTokensEdit a, SemanticTokensEdit b) => a == b); + const DeepCollectionEquality().equals(edits, other.edits); } @override @@ -25423,7 +25272,7 @@ bool operator ==(Object other) { return other is SemanticTokensEdit && other.runtimeType == SemanticTokensEdit && - listEqual(data, other.data, (int a, int b) => a == b) && + const DeepCollectionEquality().equals(data, other.data) && deleteCount == other.deleteCount && start == other.start; } @@ -25497,9 +25346,9 @@ bool operator ==(Object other) { return other is SemanticTokensLegend && other.runtimeType == SemanticTokensLegend && - listEqual(tokenModifiers, other.tokenModifiers, - (String a, String b) => a == b) && - listEqual(tokenTypes, other.tokenTypes, (String a, String b) => a == b); + const DeepCollectionEquality() + .equals(tokenModifiers, other.tokenModifiers) && + const DeepCollectionEquality().equals(tokenTypes, other.tokenTypes); } @override @@ -25846,7 +25695,7 @@ bool operator ==(Object other) { return other is SemanticTokensPartialResult && other.runtimeType == SemanticTokensPartialResult && - listEqual(data, other.data, (int a, int b) => a == b); + const DeepCollectionEquality().equals(data, other.data); } @override @@ -26095,11 +25944,8 @@ bool operator ==(Object other) { return other is SemanticTokensRegistrationOptions && other.runtimeType == SemanticTokensRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && full == other.full && id == other.id && legend == other.legend && @@ -27561,8 +27407,7 @@ bool operator ==(Object other) { return other is ShowMessageRequestParams && other.runtimeType == ShowMessageRequestParams && - listEqual(actions, other.actions, - (MessageActionItem a, MessageActionItem b) => a == b) && + const DeepCollectionEquality().equals(actions, other.actions) && message == other.message && type == other.type; } @@ -27667,8 +27512,7 @@ other.runtimeType == SignatureHelp && activeParameter == other.activeParameter && activeSignature == other.activeSignature && - listEqual(signatures, other.signatures, - (SignatureInformation a, SignatureInformation b) => a == b); + const DeepCollectionEquality().equals(signatures, other.signatures); } @override @@ -27868,8 +27712,8 @@ other.runtimeType == SignatureHelpClientCapabilitiesSignatureInformation && activeParameterSupport == other.activeParameterSupport && - listEqual(documentationFormat, other.documentationFormat, - (MarkupKind a, MarkupKind b) => a == b) && + const DeepCollectionEquality() + .equals(documentationFormat, other.documentationFormat) && parameterInformation == other.parameterInformation; } @@ -28084,10 +27928,10 @@ bool operator ==(Object other) { return other is SignatureHelpOptions && other.runtimeType == SignatureHelpOptions && - listEqual(retriggerCharacters, other.retriggerCharacters, - (String a, String b) => a == b) && - listEqual(triggerCharacters, other.triggerCharacters, - (String a, String b) => a == b) && + const DeepCollectionEquality() + .equals(retriggerCharacters, other.retriggerCharacters) && + const DeepCollectionEquality() + .equals(triggerCharacters, other.triggerCharacters) && workDoneProgress == other.workDoneProgress; } @@ -28318,15 +28162,12 @@ bool operator ==(Object other) { return other is SignatureHelpRegistrationOptions && other.runtimeType == SignatureHelpRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && - listEqual(retriggerCharacters, other.retriggerCharacters, - (String a, String b) => a == b) && - listEqual(triggerCharacters, other.triggerCharacters, - (String a, String b) => a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && + const DeepCollectionEquality() + .equals(retriggerCharacters, other.retriggerCharacters) && + const DeepCollectionEquality() + .equals(triggerCharacters, other.triggerCharacters) && workDoneProgress == other.workDoneProgress; } @@ -28475,8 +28316,7 @@ activeParameter == other.activeParameter && documentation == other.documentation && label == other.label && - listEqual(parameters, other.parameters, - (ParameterInformation a, ParameterInformation b) => a == b); + const DeepCollectionEquality().equals(parameters, other.parameters); } @override @@ -28783,7 +28623,7 @@ kind == other.kind && location == other.location && name == other.name && - listEqual(tags, other.tags, (SymbolTag a, SymbolTag b) => a == b); + const DeepCollectionEquality().equals(tags, other.tags); } @override @@ -28940,11 +28780,8 @@ bool operator ==(Object other) { return other is TextDocumentChangeRegistrationOptions && other.runtimeType == TextDocumentChangeRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && syncKind == other.syncKind; } @@ -29816,12 +29653,7 @@ bool operator ==(Object other) { return other is TextDocumentEdit && other.runtimeType == TextDocumentEdit && - listEqual( - edits, - other.edits, - (Either3<AnnotatedTextEdit, SnippetTextEdit, TextEdit> a, - Either3<AnnotatedTextEdit, SnippetTextEdit, TextEdit> b) => - a == b) && + const DeepCollectionEquality().equals(edits, other.edits) && textDocument == other.textDocument; } @@ -30502,11 +30334,8 @@ bool operator ==(Object other) { return other is TextDocumentRegistrationOptions && other.runtimeType == TextDocumentRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b); + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector); } @override @@ -30615,11 +30444,8 @@ bool operator ==(Object other) { return other is TextDocumentSaveRegistrationOptions && other.runtimeType == TextDocumentSaveRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && includeText == other.includeText; } @@ -31365,11 +31191,8 @@ bool operator ==(Object other) { return other is TypeDefinitionRegistrationOptions && other.runtimeType == TypeDefinitionRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -31591,7 +31414,7 @@ name == other.name && range == other.range && selectionRange == other.selectionRange && - listEqual(tags, other.tags, (SymbolTag a, SymbolTag b) => a == b) && + const DeepCollectionEquality().equals(tags, other.tags) && uri == other.uri; } @@ -31846,11 +31669,8 @@ bool operator ==(Object other) { return other is TypeHierarchyRegistrationOptions && other.runtimeType == TypeHierarchyRegistrationOptions && - listEqual( - documentSelector, - other.documentSelector, - (TextDocumentFilterWithScheme a, TextDocumentFilterWithScheme b) => - a == b) && + const DeepCollectionEquality() + .equals(documentSelector, other.documentSelector) && id == other.id && workDoneProgress == other.workDoneProgress; } @@ -32291,8 +32111,8 @@ bool operator ==(Object other) { return other is UnregistrationParams && other.runtimeType == UnregistrationParams && - listEqual(unregisterations, other.unregisterations, - (Unregistration a, Unregistration b) => a == b); + const DeepCollectionEquality() + .equals(unregisterations, other.unregisterations); } @override @@ -33809,8 +33629,8 @@ other.runtimeType == WorkspaceDiagnosticParams && identifier == other.identifier && partialResultToken == other.partialResultToken && - listEqual(previousResultIds, other.previousResultIds, - (PreviousResultId a, PreviousResultId b) => a == b) && + const DeepCollectionEquality() + .equals(previousResultIds, other.previousResultIds) && workDoneToken == other.workDoneToken; } @@ -33874,12 +33694,7 @@ bool operator ==(Object other) { return other is WorkspaceDiagnosticReport && other.runtimeType == WorkspaceDiagnosticReport && - listEqual( - items, - other.items, - (WorkspaceDocumentDiagnosticReport a, - WorkspaceDocumentDiagnosticReport b) => - a == b); + const DeepCollectionEquality().equals(items, other.items); } @override @@ -33939,12 +33754,7 @@ bool operator ==(Object other) { return other is WorkspaceDiagnosticReportPartialResult && other.runtimeType == WorkspaceDiagnosticReportPartialResult && - listEqual( - items, - other.items, - (WorkspaceDocumentDiagnosticReport a, - WorkspaceDocumentDiagnosticReport b) => - a == b); + const DeepCollectionEquality().equals(items, other.items); } @override @@ -34073,21 +33883,11 @@ bool operator ==(Object other) { return other is WorkspaceEdit && other.runtimeType == WorkspaceEdit && - mapEqual(changeAnnotations, other.changeAnnotations, - (ChangeAnnotation a, ChangeAnnotation b) => a == b) && - mapEqual( - changes, - other.changes, - (List<TextEdit> a, List<TextEdit> b) => - listEqual(a, b, (TextEdit a, TextEdit b) => a == b)) && - listEqual( - documentChanges, - other.documentChanges, - (Either4<CreateFile, DeleteFile, RenameFile, TextDocumentEdit> a, - Either4<CreateFile, DeleteFile, RenameFile, - TextDocumentEdit> - b) => - a == b); + const DeepCollectionEquality() + .equals(changeAnnotations, other.changeAnnotations) && + const DeepCollectionEquality().equals(changes, other.changes) && + const DeepCollectionEquality() + .equals(documentChanges, other.documentChanges); } @override @@ -34228,8 +34028,8 @@ documentChanges == other.documentChanges && failureHandling == other.failureHandling && normalizesLineEndings == other.normalizesLineEndings && - listEqual(resourceOperations, other.resourceOperations, - (ResourceOperationKind a, ResourceOperationKind b) => a == b); + const DeepCollectionEquality() + .equals(resourceOperations, other.resourceOperations); } @override @@ -34431,10 +34231,8 @@ bool operator ==(Object other) { return other is WorkspaceFoldersChangeEvent && other.runtimeType == WorkspaceFoldersChangeEvent && - listEqual(added, other.added, - (WorkspaceFolder a, WorkspaceFolder b) => a == b) && - listEqual(removed, other.removed, - (WorkspaceFolder a, WorkspaceFolder b) => a == b); + const DeepCollectionEquality().equals(added, other.added) && + const DeepCollectionEquality().equals(removed, other.removed); } @override @@ -34635,7 +34433,7 @@ bool operator ==(Object other) { return other is WorkspaceFullDocumentDiagnosticReport && other.runtimeType == WorkspaceFullDocumentDiagnosticReport && - listEqual(items, other.items, (Diagnostic a, Diagnostic b) => a == b) && + const DeepCollectionEquality().equals(items, other.items) && kind == other.kind && resultId == other.resultId && uri == other.uri && @@ -34784,7 +34582,7 @@ kind == other.kind && location == other.location && name == other.name && - listEqual(tags, other.tags, (SymbolTag a, SymbolTag b) => a == b); + const DeepCollectionEquality().equals(tags, other.tags); } @override @@ -34970,7 +34768,7 @@ bool operator ==(Object other) { return other is WorkspaceSymbolClientCapabilitiesResolveSupport && other.runtimeType == WorkspaceSymbolClientCapabilitiesResolveSupport && - listEqual(properties, other.properties, (String a, String b) => a == b); + const DeepCollectionEquality().equals(properties, other.properties); } @override @@ -35032,8 +34830,7 @@ bool operator ==(Object other) { return other is WorkspaceSymbolClientCapabilitiesSymbolKind && other.runtimeType == WorkspaceSymbolClientCapabilitiesSymbolKind && - listEqual( - valueSet, other.valueSet, (SymbolKind a, SymbolKind b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override @@ -35088,8 +34885,7 @@ bool operator ==(Object other) { return other is WorkspaceSymbolClientCapabilitiesTagSupport && other.runtimeType == WorkspaceSymbolClientCapabilitiesTagSupport && - listEqual( - valueSet, other.valueSet, (SymbolTag a, SymbolTag b) => a == b); + const DeepCollectionEquality().equals(valueSet, other.valueSet); } @override
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart b/third_party/pkg/language_server_protocol/lib/protocol_special.dart similarity index 90% rename from pkg/analysis_server/lib/lsp_protocol/protocol_special.dart rename to third_party/pkg/language_server_protocol/lib/protocol_special.dart index d546e2d..1c6175e 100644 --- a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart +++ b/third_party/pkg/language_server_protocol/lib/protocol_special.dart
@@ -4,11 +4,10 @@ import 'dart:async'; -import 'package:analysis_server/lsp_protocol/protocol_generated.dart'; -import 'package:analysis_server/src/lsp/json_parsing.dart'; -import 'package:analysis_server/src/protocol/protocol_internal.dart'; - -import 'protocol_custom_generated.dart'; +import 'package:collection/collection.dart'; +import 'package:language_server_protocol/json_parsing.dart'; +import 'package:language_server_protocol/protocol_custom_generated.dart'; +import 'package:language_server_protocol/protocol_generated.dart'; const jsonRpcVersion = '2.0'; @@ -25,27 +24,13 @@ /// Returns if two objects are equal, recursively checking items in /// Maps/Lists. bool lspEquals(dynamic obj1, dynamic obj2) { - if (obj1 is List && obj2 is List) { - return listEqual(obj1, obj2, lspEquals); - } else if (obj1 is Map && obj2 is Map) { - return mapEqual(obj1, obj2, lspEquals); - } else { - return obj1.runtimeType == obj2.runtimeType && obj1 == obj2; - } + return const DeepCollectionEquality().equals(obj1, obj2); } /// Returns an objects hash code, recursively combining hashes for items in /// Maps/Lists. int lspHashCode(dynamic obj) { - if (obj is List) { - return Object.hashAll(obj.map(lspHashCode)); - } else if (obj is Map) { - return Object.hashAll(obj.entries - .expand((element) => [element.key, element.value]) - .map(lspHashCode)); - } else { - return obj.hashCode; - } + return const DeepCollectionEquality().hash(obj); } Object? specToJson(Object? obj) {
diff --git a/pkg/analysis_server/tool/lsp_spec/lsp_meta_model.json b/third_party/pkg/language_server_protocol/lsp_meta_model.json similarity index 100% rename from pkg/analysis_server/tool/lsp_spec/lsp_meta_model.json rename to third_party/pkg/language_server_protocol/lsp_meta_model.json
diff --git a/third_party/pkg/language_server_protocol/pubspec.yaml b/third_party/pkg/language_server_protocol/pubspec.yaml new file mode 100644 index 0000000..aca4312 --- /dev/null +++ b/third_party/pkg/language_server_protocol/pubspec.yaml
@@ -0,0 +1,16 @@ +name: language_server_protocol +version: 0.0.0 +description: >- + A Dart implementation of the language server protocol. +repository: https://github.com/dart-lang/sdk/tree/main/third_party/pkg/language_server_protocol +publish_to: none + +environment: + sdk: '>=3.0.0 <4.0.0' + +dependencies: + collection: 'any' + +dependency_overrides: + collection: + path: ../collection