From 77bf07a87f98c3dc4a6c3ee87e14ab023172f063 Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Wed, 22 Jun 2022 14:05:24 +0000 Subject: [PATCH] [analysis_server] Rename LSP `Pattern` alias to not conflict with Dart `Pattern` type Change-Id: Ib3178eb2fd3f3e2d41844d5fb492775da7e3171a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249487 Reviewed-by: Brian Wilkerson Commit-Queue: Brian Wilkerson --- .../lib/lsp_protocol/protocol_generated.dart | 40 ++++++++++--------- .../tool/lsp_spec/meta_model_cleaner.dart | 1 + 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart index 04d9334fbdc..00f7c4c6105 100644 --- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart +++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart @@ -84,7 +84,7 @@ typedef DocumentSelector = List>; /// The glob pattern. Either a string pattern or a relative pattern. /// /// @since 3.17.0 -typedef GlobPattern = Either2; +typedef GlobPattern = Either2; /// Inline value information can be provided by different means: /// - directly as a text value (class InlineValueText). @@ -100,19 +100,6 @@ typedef InlineValue = Either3; -/// A tagging type for string properties that are actually URIs -/// -/// @since 3.16.0 -typedef LspUri = String; - -/// A notebook document filter denotes a notebook document by different -/// properties. The properties will be match against the notebook's URI (same as -/// with documents) -/// -/// @since 3.17.0 -typedef NotebookDocumentFilter = Either3; - /// The glob pattern to watch relative to the base path. Glob patterns can have /// the following syntax: /// - `*` to match one or more characters in a path segment @@ -126,7 +113,20 @@ typedef NotebookDocumentFilter = Either3; typedef PrepareRenameResult = Either3; typedef ProgressToken = Either2; @@ -23298,7 +23298,7 @@ class RelativePattern implements ToJsonable { final Either2 baseUri; /// The actual glob pattern; - final Pattern pattern; + final LspPattern pattern; @override Map toJson() { @@ -41631,7 +41631,8 @@ bool _canParseStringRelativePattern( } if ((!nullCheck || value != null) && (value is! String && !RelativePattern.canParse(value, reporter))) { - reporter.reportError('must be of type Either2'); + reporter + .reportError('must be of type Either2'); return false; } } finally { @@ -42900,12 +42901,13 @@ Either2 : throw '$value was not one of (SemanticTokensOptions, SemanticTokensRegistrationOptions)'; } -Either2 _eitherStringRelativePattern(Object? value) { +Either2 _eitherStringRelativePattern( + Object? value) { return value is String ? Either2.t1(value) : RelativePattern.canParse(value, nullLspJsonReporter) ? Either2.t2(RelativePattern.fromJson(value as Map)) - : throw '$value was not one of (Pattern, RelativePattern)'; + : throw '$value was not one of (LspPattern, RelativePattern)'; } Either2 _eitherStringWorkspaceFolder(Object? value) { diff --git a/pkg/analysis_server/tool/lsp_spec/meta_model_cleaner.dart b/pkg/analysis_server/tool/lsp_spec/meta_model_cleaner.dart index 77a5af9bf55..b1b77efd803 100644 --- a/pkg/analysis_server/tool/lsp_spec/meta_model_cleaner.dart +++ b/pkg/analysis_server/tool/lsp_spec/meta_model_cleaner.dart @@ -364,6 +364,7 @@ class LspMetaModelCleaner { 'SignatureInformationParameterInformation', 'TextDocumentFilter2': 'TextDocumentFilterWithScheme', 'PrepareRenameResult1': 'PlaceholderAndRange', + 'Pattern': 'LspPattern', 'URI': 'LspUri', };