Version 2.18.0-144.0.dev

Merge commit 'f397ecb588e86e1ddead7abe315b094fd1d6deac' into 'dev'
diff --git a/pkg/analysis_server/analysis_options.yaml b/pkg/analysis_server/analysis_options.yaml
index a72e0f7..4cc8715 100644
--- a/pkg/analysis_server/analysis_options.yaml
+++ b/pkg/analysis_server/analysis_options.yaml
@@ -17,7 +17,6 @@
     file_names: ignore
     hash_and_equals: ignore
     implementation_imports: ignore
-    library_private_types_in_public_api: ignore
     non_constant_identifier_names: ignore
     overridden_fields: ignore
     prefer_function_declarations_over_variables: ignore
diff --git a/pkg/analysis_server/benchmark/integration/input_converter.dart b/pkg/analysis_server/benchmark/integration/input_converter.dart
index aec8d14..fd45405 100644
--- a/pkg/analysis_server/benchmark/integration/input_converter.dart
+++ b/pkg/analysis_server/benchmark/integration/input_converter.dart
@@ -284,7 +284,7 @@
   }
 
   @override
-  _InputSink startChunkedConversion(outSink) {
+  Sink<String> startChunkedConversion(outSink) {
     return _InputSink(this, outSink);
   }
 
diff --git a/pkg/analysis_server/lib/src/analytics/google_analytics_manager.dart b/pkg/analysis_server/lib/src/analytics/google_analytics_manager.dart
index 63ca84b..cf3b4b1 100644
--- a/pkg/analysis_server/lib/src/analytics/google_analytics_manager.dart
+++ b/pkg/analysis_server/lib/src/analytics/google_analytics_manager.dart
@@ -16,14 +16,14 @@
 
   /// Data about the current session, or `null` if the [startUp] method has not
   /// been invoked.
-  _SessionData? sessionData;
+  _SessionData? _sessionData;
 
   /// A map from the id of a request to data about the request.
-  Map<String, _ActiveRequestData> activeRequests = {};
+  final Map<String, _ActiveRequestData> _activeRequests = {};
 
   /// A map from the name of a request to data about all such requests that have
   /// been responded to.
-  Map<String, _RequestData> completedRequests = {};
+  final Map<String, _RequestData> _completedRequests = {};
 
   /// Initialize a newly created analytics manager to report to the [analytics]
   /// service.
@@ -47,7 +47,7 @@
 
   @override
   void shutdown() {
-    final sessionData = this.sessionData;
+    final sessionData = _sessionData;
     if (sessionData == null) {
       return;
     }
@@ -65,7 +65,7 @@
       'plugins': '',
     });
     // Send response data.
-    for (var data in completedRequests.values) {
+    for (var data in _completedRequests.values) {
       analytics.sendEvent('language_server', 'request', parameters: {
         'latency': data.latencyTimes.toAnalyticsString(),
         'name': data.method,
@@ -82,14 +82,14 @@
 
   @override
   void startedRequest({required Request request, required DateTime startTime}) {
-    activeRequests[request.id] = _ActiveRequestData(
+    _activeRequests[request.id] = _ActiveRequestData(
         request.method, request.clientRequestTime, startTime);
   }
 
   @override
   void startedRequestMessage(
       {required RequestMessage request, required DateTime startTime}) {
-    activeRequests[request.id.asString] = _ActiveRequestData(
+    _activeRequests[request.id.asString] = _ActiveRequestData(
         request.method.toString(), request.clientRequestTime, startTime);
   }
 
@@ -100,7 +100,7 @@
       required String clientId,
       required String? clientVersion,
       required String sdkVersion}) {
-    sessionData = _SessionData(
+    _sessionData = _SessionData(
         startTime: time,
         commandLineArguments: arguments.join(' '),
         clientId: clientId,
@@ -111,7 +111,7 @@
   /// Record that the request with the given [id] was responded to at the given
   /// [sendTime].
   void _recordResponseData(String id, DateTime sendTime) {
-    var data = activeRequests.remove(id);
+    var data = _activeRequests.remove(id);
     if (data == null) {
       return;
     }
@@ -120,7 +120,7 @@
     var clientRequestTime = data.clientRequestTime;
     var startTime = data.startTime.millisecondsSinceEpoch;
 
-    var requestData = completedRequests.putIfAbsent(
+    var requestData = _completedRequests.putIfAbsent(
         requestName, () => _RequestData(requestName));
 
     if (clientRequestTime != null) {
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index dc3afe6..bf2d198 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -210,7 +210,7 @@
   ///
   /// This is used when a new build is requested to cancel any in-progress
   /// rebuild and wait for it to terminate before starting the next.
-  final _CancellingTaskQueue currentContextRebuild = _CancellingTaskQueue();
+  final _CancellingTaskQueue _currentContextRebuild = _CancellingTaskQueue();
 
   ContextManagerImpl(
       this.resourceProvider,
@@ -579,7 +579,7 @@
       callbacks.afterContextsCreated();
     }
 
-    return currentContextRebuild.queue(performContextRebuildGuarded);
+    return _currentContextRebuild.queue(performContextRebuildGuarded);
   }
 
   /// Clean up and destroy the context associated with the given folder.
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart
index 27198de..59cf2cc 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart
@@ -32,6 +32,9 @@
       TypeDefinitionParams.jsonHandler;
 
   @override
+  // The private type in the return type is dictated by the signature of the
+  // super-method and the class's super-class.
+  // ignore: library_private_types_in_public_api
   Future<ErrorOr<_LocationsOrLinks>> handle(TypeDefinitionParams params,
       MessageInfo message, CancellationToken token) async {
     if (!isDartDocument(params.textDocument)) {
diff --git a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
index 7dc3e98..7c4e7ef 100644
--- a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
+++ b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
@@ -843,6 +843,8 @@
 
   /// A table mapping the id's of requests to the functions used to handle the
   /// response to those requests.
+  @visibleForTesting
+  // ignore: library_private_types_in_public_api
   Map<String, _PendingRequest> pendingRequests = <String, _PendingRequest>{};
 
   /// A boolean indicating whether the plugin is compatible with the version of
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index e7df797..9028362 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -30,7 +30,7 @@
   /// The [_VisibilityTracker] tracks the set of elements already added in the
   /// completion list, this object helps prevents suggesting elements that have
   /// been shadowed by local declarations.
-  _VisibilityTracker visibilityTracker = _VisibilityTracker();
+  final _VisibilityTracker _visibilityTracker = _VisibilityTracker();
 
   LocalReferenceContributor(super.request, super.builder);
 
@@ -68,7 +68,7 @@
           try {
             builder.laterReplacesEarlier = false;
             var localVisitor = _LocalVisitor(
-                request, builder, visibilityTracker,
+                request, builder, _visibilityTracker,
                 suggestLocalFields: suggestLocalFields);
             localVisitor.visit(node);
           } finally {
@@ -100,7 +100,7 @@
     if (!isFunctionalArgument) {
       for (var accessor in type.accessors) {
         if (!accessor.isStatic) {
-          if (visibilityTracker._isVisible(accessor.declaration)) {
+          if (_visibilityTracker._isVisible(accessor.declaration)) {
             if (accessor.isGetter) {
               if (opType.includeReturnValueSuggestions) {
                 memberBuilder.addSuggestionForAccessor(
@@ -120,7 +120,7 @@
     }
     for (var method in type.methods) {
       if (!method.isStatic) {
-        if (visibilityTracker._isVisible(method.declaration)) {
+        if (_visibilityTracker._isVisible(method.declaration)) {
           if (!method.returnType.isVoid) {
             if (opType.includeReturnValueSuggestions) {
               memberBuilder.addSuggestionForMethod(
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index 021701c..b93535a 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -47,104 +47,6 @@
   CompletionSuggestion build();
 }
 
-/// The implementation of [CompletionSuggestionBuilder] that is based on
-/// [ElementCompletionData] and location specific information.
-class CompletionSuggestionBuilderImpl implements CompletionSuggestionBuilder {
-  final ElementCompletionData element;
-
-  @override
-  final CompletionSuggestionKind kind;
-
-  @override
-  final int relevance;
-
-  final String? completionOverride;
-  final String? libraryUriStr;
-  final bool isNotImported;
-
-  CompletionSuggestionBuilderImpl({
-    required this.element,
-    required this.kind,
-    required this.completionOverride,
-    required this.relevance,
-    required this.libraryUriStr,
-    required this.isNotImported,
-  });
-
-  @override
-  String get completion => completionOverride ?? element.completion;
-
-  /// TODO(scheglov) implement better key for not-yet-imported
-  @override
-  String get key {
-    var key = completion;
-    if (element.element.kind == protocol.ElementKind.CONSTRUCTOR) {
-      key = '$key()';
-    }
-    return key;
-  }
-
-  @override
-  String get textToMatch => completion;
-
-  @override
-  CompletionSuggestion build() {
-    return CompletionSuggestion(
-      kind,
-      relevance,
-      completion,
-      completion.length /*selectionOffset*/,
-      0 /*selectionLength*/,
-      element.isDeprecated,
-      false /*isPotential*/,
-      element: element.element,
-      docSummary: element.documentation?.summary,
-      docComplete: element.documentation?.full,
-      declaringType: element.declaringType,
-      returnType: element.returnType,
-      requiredParameterCount: element.requiredParameterCount,
-      hasNamedParameters: element.hasNamedParameters,
-      parameterNames: element.parameterNames,
-      parameterTypes: element.parameterTypes,
-      defaultArgumentListString: element.defaultArgumentList?.text,
-      defaultArgumentListTextRanges: element.defaultArgumentList?.ranges,
-      libraryUri: libraryUriStr,
-      isNotImported: isNotImported ? true : null,
-    );
-  }
-}
-
-/// Information about an [Element] that does not depend on the location where
-/// this element is suggested. For some often used elements, such as classes,
-/// it might be cached, so created only once.
-class ElementCompletionData {
-  final String completion;
-  final bool isDeprecated;
-  final String? declaringType;
-  final String? returnType;
-  final List<String>? parameterNames;
-  final List<String>? parameterTypes;
-  final int? requiredParameterCount;
-  final bool? hasNamedParameters;
-  CompletionDefaultArgumentList? defaultArgumentList;
-  final _ElementDocumentation? documentation;
-  final protocol.Element element;
-
-  ElementCompletionData({
-    required this.completion,
-    required this.isDeprecated,
-    required this.declaringType,
-    required this.returnType,
-    required this.parameterNames,
-    required this.parameterTypes,
-    required this.requiredParameterCount,
-    required this.hasNamedParameters,
-    required this.defaultArgumentList,
-    required this.documentation,
-    required this.element,
-  });
-}
-
 /// This class provides suggestions based upon the visible instance members in
 /// an interface type.
 class MemberSuggestionBuilder {
@@ -1308,7 +1210,7 @@
       completion = '$prefix.$completion';
     }
 
-    return CompletionSuggestionBuilderImpl(
+    return _CompletionSuggestionBuilderImpl(
       element: elementData,
       kind: kind,
       completionOverride: completion,
@@ -1319,7 +1221,7 @@
   }
 
   /// The non-caching implementation of [_getElementCompletionData].
-  ElementCompletionData? _createElementCompletionData(Element element) {
+  _ElementCompletionData? _createElementCompletionData(Element element) {
     // Do not include operators in suggestions.
     if (element is ExecutableElement && element.isOperator) {
       return null;
@@ -1372,7 +1274,7 @@
           element, requiredParameters, namedParameters);
     }
 
-    return ElementCompletionData(
+    return _ElementCompletionData(
       completion: completion,
       isDeprecated: element.hasOrInheritsDeprecated,
       declaringType: declaringType,
@@ -1417,10 +1319,10 @@
     return null;
   }
 
-  /// Return [ElementCompletionData] for the [element], or `null` if the
+  /// Return [_ElementCompletionData] for the [element], or `null` if the
   /// element cannot be suggested for completion.
-  ElementCompletionData? _getElementCompletionData(Element element) {
-    ElementCompletionData? result;
+  _ElementCompletionData? _getElementCompletionData(Element element) {
+    _ElementCompletionData? result;
 
     var hasCompletionData = element.ifTypeOrNull<HasCompletionData>();
     if (hasCompletionData != null) {
@@ -1545,6 +1447,7 @@
 /// [CompletionSuggestionBuilder] that is based on a [CompletionSuggestion].
 class ValueCompletionSuggestionBuilder implements CompletionSuggestionBuilder {
   final CompletionSuggestion _suggestion;
+
   final String? _textToMatchOverride;
 
   ValueCompletionSuggestionBuilder(
@@ -1573,6 +1476,104 @@
   }
 }
 
+/// The implementation of [CompletionSuggestionBuilder] that is based on
+/// [ElementCompletionData] and location specific information.
+class _CompletionSuggestionBuilderImpl implements CompletionSuggestionBuilder {
+  final _ElementCompletionData element;
+
+  @override
+  final CompletionSuggestionKind kind;
+
+  @override
+  final int relevance;
+
+  final String? completionOverride;
+  final String? libraryUriStr;
+  final bool isNotImported;
+
+  _CompletionSuggestionBuilderImpl({
+    required this.element,
+    required this.kind,
+    required this.completionOverride,
+    required this.relevance,
+    required this.libraryUriStr,
+    required this.isNotImported,
+  });
+
+  @override
+  String get completion => completionOverride ?? element.completion;
+
+  /// TODO(scheglov) implement better key for not-yet-imported
+  @override
+  String get key {
+    var key = completion;
+    if (element.element.kind == protocol.ElementKind.CONSTRUCTOR) {
+      key = '$key()';
+    }
+    return key;
+  }
+
+  @override
+  String get textToMatch => completion;
+
+  @override
+  CompletionSuggestion build() {
+    return CompletionSuggestion(
+      kind,
+      relevance,
+      completion,
+      completion.length /*selectionOffset*/,
+      0 /*selectionLength*/,
+      element.isDeprecated,
+      false /*isPotential*/,
+      element: element.element,
+      docSummary: element.documentation?.summary,
+      docComplete: element.documentation?.full,
+      declaringType: element.declaringType,
+      returnType: element.returnType,
+      requiredParameterCount: element.requiredParameterCount,
+      hasNamedParameters: element.hasNamedParameters,
+      parameterNames: element.parameterNames,
+      parameterTypes: element.parameterTypes,
+      defaultArgumentListString: element.defaultArgumentList?.text,
+      defaultArgumentListTextRanges: element.defaultArgumentList?.ranges,
+      libraryUri: libraryUriStr,
+      isNotImported: isNotImported ? true : null,
+    );
+  }
+}
+
+/// Information about an [Element] that does not depend on the location where
+/// this element is suggested. For some often used elements, such as classes,
+/// it might be cached, so created only once.
+class _ElementCompletionData {
+  final String completion;
+  final bool isDeprecated;
+  final String? declaringType;
+  final String? returnType;
+  final List<String>? parameterNames;
+  final List<String>? parameterTypes;
+  final int? requiredParameterCount;
+  final bool? hasNamedParameters;
+  CompletionDefaultArgumentList? defaultArgumentList;
+  final _ElementDocumentation? documentation;
+  final protocol.Element element;
+
+  _ElementCompletionData({
+    required this.completion,
+    required this.isDeprecated,
+    required this.declaringType,
+    required this.returnType,
+    required this.parameterNames,
+    required this.parameterTypes,
+    required this.requiredParameterCount,
+    required this.hasNamedParameters,
+    required this.defaultArgumentList,
+    required this.documentation,
+    required this.element,
+  });
+}
+
 class _ElementDocumentation {
   final String full;
   final String? summary;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
index 14b09df..a77eb43 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
@@ -25,8 +25,6 @@
   @override
   bool canBeAppliedToFile;
 
-  CreateMethod(this._kind, this.canBeAppliedInBulk, this.canBeAppliedToFile);
-
   /// Initialize a newly created instance that will create either an equals
   /// (operator =) or `hashCode` method based on the existing other half of the
   /// pair.
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart
index 821cd87..be0d3d3 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart
@@ -11,11 +11,11 @@
 
 class ReplaceWithNullAware extends CorrectionProducer {
   /// The kind of correction to be made.
-  final _CorrectionKind correctionKind;
+  final _CorrectionKind _correctionKind;
 
-  ReplaceWithNullAware.inChain() : correctionKind = _CorrectionKind.inChain;
+  ReplaceWithNullAware.inChain() : _correctionKind = _CorrectionKind.inChain;
 
-  ReplaceWithNullAware.single() : correctionKind = _CorrectionKind.single;
+  ReplaceWithNullAware.single() : _correctionKind = _CorrectionKind.single;
 
   @override
   // NNBD makes this obsolete in the "chain" application; for the "single"
@@ -34,9 +34,9 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    if (correctionKind == _CorrectionKind.inChain) {
+    if (_correctionKind == _CorrectionKind.inChain) {
       await _computeInChain(builder);
-    } else if (correctionKind == _CorrectionKind.single) {
+    } else if (_correctionKind == _CorrectionKind.single) {
       await _computeSingle(builder);
     }
   }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/sort_constructor_first.dart b/pkg/analysis_server/lib/src/services/correction/dart/sort_constructor_first.dart
index f0a7e65..26c80f4 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/sort_constructor_first.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/sort_constructor_first.dart
@@ -4,6 +4,7 @@
 
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/utilities/extensions/ast.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
 import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
@@ -32,7 +33,7 @@
 
     await builder.addDartFileEdit(file, (builder) {
       var deletionRange = range.endEnd(
-        constructor.beginToken.previous!,
+        constructor.firstNonCommentToken.previous!,
         constructor.endToken,
       );
 
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart
index 1631742..1180800 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart
@@ -34,6 +34,9 @@
       : assert(index >= 0);
 
   @override
+  // The private type of the [data] parameter is dictated by the signature of
+  // the super-method and the class's super-class.
+  // ignore: library_private_types_in_public_api
   void apply(DartFileEditBuilder builder, DataDrivenFix fix, _Data data) {
     if (data is _TypeArgumentData) {
       _applyToTypeArguments(builder, fix, data);
@@ -45,6 +48,9 @@
   }
 
   @override
+  // The private return type is dictated by the signature of the super-method
+  // and the class's super-class.
+  // ignore: library_private_types_in_public_api
   _Data? validate(DataDrivenFix fix) {
     var node = fix.node;
     var context = TemplateContext.forInvocation(node, fix.utils);
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
index 3b561ca..e363d14 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
@@ -22,9 +22,9 @@
   int delta = 0;
 
   /// The tokens being parsed.
-  late List<_Token> tokens;
+  late List<_Token> _tokens;
 
-  /// The index in the [tokens] of the next token to be consumed.
+  /// The index in the [_tokens] of the next token to be consumed.
   int currentIndex = 0;
 
   /// Initialize a newly created parser to report errors to the [errorReporter].
@@ -33,12 +33,12 @@
 
   /// Return the current token, or `null` if the end of the tokens has been
   /// reached.
-  _Token? get currentToken =>
-      currentIndex < tokens.length ? tokens[currentIndex] : null;
+  _Token? get _currentToken =>
+      currentIndex < _tokens.length ? _tokens[currentIndex] : null;
 
   /// Advance to the next token.
   void advance() {
-    if (currentIndex < tokens.length) {
+    if (currentIndex < _tokens.length) {
       currentIndex++;
     }
   }
@@ -56,7 +56,7 @@
       // The error has already been reported.
       return null;
     }
-    tokens = scannedTokens;
+    _tokens = scannedTokens;
     currentIndex = 0;
     var accessors = <Accessor>[];
     var accessor = _parseAccessor();
@@ -64,8 +64,8 @@
       return accessors;
     }
     accessors.add(accessor);
-    while (currentIndex < tokens.length) {
-      var token = currentToken;
+    while (currentIndex < _tokens.length) {
+      var token = _currentToken;
       if (token == null) {
         return accessors;
       }
@@ -98,11 +98,11 @@
       // The error has already been reported.
       return null;
     }
-    tokens = scannedTokens;
+    _tokens = scannedTokens;
     currentIndex = 0;
     var expression = _parseLogicalAndExpression();
-    if (currentIndex < tokens.length) {
-      var token = tokens[currentIndex];
+    if (currentIndex < _tokens.length) {
+      var token = _tokens[currentIndex];
       errorReporter.reportErrorForOffset(TransformSetErrorCode.unexpectedToken,
           token.offset + delta, token.length, [token.kind.displayName]);
       return null;
@@ -128,12 +128,12 @@
       return buffer.toString();
     }
 
-    var token = currentToken;
+    var token = _currentToken;
     if (token == null) {
       var offset = 0;
       var length = 0;
-      if (tokens.isNotEmpty) {
-        var last = tokens.last;
+      if (_tokens.isNotEmpty) {
+        var last = _tokens.last;
         offset = last.offset;
         length = last.length;
       }
@@ -231,10 +231,10 @@
     if (expression == null) {
       return null;
     }
-    if (currentIndex >= tokens.length) {
+    if (currentIndex >= _tokens.length) {
       return expression;
     }
-    var kind = currentToken?.kind;
+    var kind = _currentToken?.kind;
     if (kind == _TokenKind.equal || kind == _TokenKind.notEqual) {
       advance();
       var operator =
@@ -257,11 +257,11 @@
     if (leftOperand == null) {
       return null;
     }
-    if (currentIndex >= tokens.length) {
+    if (currentIndex >= _tokens.length) {
       return leftOperand;
     }
     var expression = leftOperand;
-    var kind = currentToken?.kind;
+    var kind = _currentToken?.kind;
     while (kind == _TokenKind.and) {
       advance();
       var rightOperand = _parseEqualityExpression();
@@ -269,10 +269,10 @@
         return null;
       }
       expression = BinaryExpression(expression, Operator.and, rightOperand);
-      if (currentIndex >= tokens.length) {
+      if (currentIndex >= _tokens.length) {
         return expression;
       }
-      kind = currentToken?.kind;
+      kind = _currentToken?.kind;
     }
     return expression;
   }
@@ -282,7 +282,7 @@
   /// <primaryExpression> ::=
   ///   <identifier> | <string>
   Expression? _parsePrimaryExpression() {
-    var token = currentToken;
+    var token = _currentToken;
     if (token != null) {
       var kind = token.kind;
       if (kind == _TokenKind.identifier) {
@@ -308,8 +308,8 @@
     int offset;
     int length;
     if (token == null) {
-      if (tokens.isNotEmpty) {
-        token = tokens[tokens.length - 1];
+      if (_tokens.isNotEmpty) {
+        token = _tokens[_tokens.length - 1];
         offset = token.offset + delta;
         length = token.length;
       } else {
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart
index 7b052fa..a916ae6 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart
@@ -53,6 +53,9 @@
       : assert(modifications.isNotEmpty);
 
   @override
+  // The private type of the [data] parameter is dictated by the signature of
+  // the super-method and the class's super-class.
+  // ignore: library_private_types_in_public_api
   void apply(DartFileEditBuilder builder, DataDrivenFix fix, _Data data) {
     var argumentList = data.argumentList;
     var invocation = argumentList.parent;
@@ -229,6 +232,9 @@
   }
 
   @override
+  // The private return type is dictated by the signature of the super-method
+  // and the class's super-class.
+  // ignore: library_private_types_in_public_api
   _Data? validate(DataDrivenFix fix) {
     var node = fix.node;
     var parent = node.parent;
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart
index c825366..cb0fd92 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart
@@ -18,6 +18,9 @@
   Rename({required this.newName});
 
   @override
+  // The private type of the [data] parameter is dictated by the signature of
+  // the super-method and the class's super-class.
+  // ignore: library_private_types_in_public_api
   void apply(DartFileEditBuilder builder, DataDrivenFix fix, _Data data) {
     var nameNode = data.nameNode;
     if (fix.element.isConstructor) {
@@ -68,6 +71,9 @@
   }
 
   @override
+  // The private return type is dictated by the signature of the super-method
+  // and the class's super-class.
+  // ignore: library_private_types_in_public_api
   _Data? validate(DataDrivenFix fix) {
     var node = fix.node;
     if (node is SimpleIdentifier) {
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart
index 19ca94a..7522efe 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart
@@ -23,6 +23,9 @@
   RenameParameter({required this.newName, required this.oldName});
 
   @override
+  // The private type of the [data] parameter is dictated by the signature of
+  // the super-method and the class's super-class.
+  // ignore: library_private_types_in_public_api
   void apply(DartFileEditBuilder builder, DataDrivenFix fix, _Data data) {
     if (data is _InvocationData) {
       builder.addSimpleReplacement(range.node(data.nameNode), newName);
@@ -62,6 +65,9 @@
   }
 
   @override
+  // The private return type is dictated by the signature of the super-method
+  // and the class's super-class.
+  // ignore: library_private_types_in_public_api
   _Data validate(DataDrivenFix fix) {
     var node = fix.node;
     if (node is SimpleIdentifier) {
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart
index 961632b..d690c0b 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart
@@ -21,12 +21,18 @@
   ReplacedBy({required this.newElement});
 
   @override
+  // The private type of the [data] parameter is dictated by the signature of
+  // the super-method and the class's super-class.
+  // ignore: library_private_types_in_public_api
   void apply(DartFileEditBuilder builder, DataDrivenFix fix, _Data data) {
     var referenceRange = data.referenceRange;
     builder.addSimpleReplacement(referenceRange, _referenceTo(newElement));
   }
 
   @override
+  // The private return type is dictated by the signature of the super-method
+  // and the class's super-class.
+  // ignore: library_private_types_in_public_api
   _Data? validate(DataDrivenFix fix) {
     var node = fix.node;
     if (node is SimpleIdentifier) {
diff --git a/pkg/analysis_server/lib/src/services/correction/organize_imports.dart b/pkg/analysis_server/lib/src/services/correction/organize_imports.dart
index f3abafa..4a34d27 100644
--- a/pkg/analysis_server/lib/src/services/correction/organize_imports.dart
+++ b/pkg/analysis_server/lib/src/services/correction/organize_imports.dart
@@ -84,7 +84,7 @@
         hasLibraryDirective = true;
       }
       if (directive is UriBasedDirective) {
-        var priority = getDirectivePriority(directive);
+        var priority = _getDirectivePriority(directive);
         if (priority != null) {
           var offset = directive.offset;
           var end = directive.end;
@@ -274,36 +274,6 @@
     code = beforeDirectives + directivesCode + afterDirectives;
   }
 
-  static _DirectivePriority? getDirectivePriority(UriBasedDirective directive) {
-    var uriContent = directive.uri.stringValue ?? '';
-    if (directive is ImportDirective) {
-      if (uriContent.startsWith('dart:')) {
-        return _DirectivePriority.IMPORT_SDK;
-      } else if (uriContent.startsWith('package:')) {
-        return _DirectivePriority.IMPORT_PKG;
-      } else if (uriContent.contains('://')) {
-        return _DirectivePriority.IMPORT_OTHER;
-      } else {
-        return _DirectivePriority.IMPORT_REL;
-      }
-    }
-    if (directive is ExportDirective) {
-      if (uriContent.startsWith('dart:')) {
-        return _DirectivePriority.EXPORT_SDK;
-      } else if (uriContent.startsWith('package:')) {
-        return _DirectivePriority.EXPORT_PKG;
-      } else if (uriContent.contains('://')) {
-        return _DirectivePriority.EXPORT_OTHER;
-      } else {
-        return _DirectivePriority.EXPORT_REL;
-      }
-    }
-    if (directive is PartDirective) {
-      return _DirectivePriority.PART;
-    }
-    return null;
-  }
-
   /// Return the EOL to use for [code].
   static String getEOL(String code) {
     if (code.contains('\r\n')) {
@@ -386,6 +356,37 @@
     return null;
   }
 
+  static _DirectivePriority? _getDirectivePriority(
+      UriBasedDirective directive) {
+    var uriContent = directive.uri.stringValue ?? '';
+    if (directive is ImportDirective) {
+      if (uriContent.startsWith('dart:')) {
+        return _DirectivePriority.IMPORT_SDK;
+      } else if (uriContent.startsWith('package:')) {
+        return _DirectivePriority.IMPORT_PKG;
+      } else if (uriContent.contains('://')) {
+        return _DirectivePriority.IMPORT_OTHER;
+      } else {
+        return _DirectivePriority.IMPORT_REL;
+      }
+    }
+    if (directive is ExportDirective) {
+      if (uriContent.startsWith('dart:')) {
+        return _DirectivePriority.EXPORT_SDK;
+      } else if (uriContent.startsWith('package:')) {
+        return _DirectivePriority.EXPORT_PKG;
+      } else if (uriContent.contains('://')) {
+        return _DirectivePriority.EXPORT_OTHER;
+      } else {
+        return _DirectivePriority.EXPORT_REL;
+      }
+    }
+    if (directive is PartDirective) {
+      return _DirectivePriority.PART;
+    }
+    return null;
+  }
+
   /// Returns whether this token is a '// ignore:' comment (but not an
   /// '// ignore_for_file:' comment).
   static bool _isIgnoreComment(Token token) =>
diff --git a/pkg/analysis_server/lib/src/utilities/extensions/ast.dart b/pkg/analysis_server/lib/src/utilities/extensions/ast.dart
index b92d957..84e8908 100644
--- a/pkg/analysis_server/lib/src/utilities/extensions/ast.dart
+++ b/pkg/analysis_server/lib/src/utilities/extensions/ast.dart
@@ -7,6 +7,17 @@
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 
+extension AnnotatedNodeExtensions on AnnotatedNode {
+  /// Return the first token in this node that is not a comment.
+  Token get firstNonCommentToken {
+    final metadata = this.metadata;
+    if (metadata.isEmpty) {
+      return firstTokenAfterCommentAndMetadata;
+    }
+    return metadata.beginToken!;
+  }
+}
+
 extension AstNodeExtensions on AstNode {
   /// Return the [IfStatement] associated with `this`.
   IfStatement? get enclosingIfStatement {
diff --git a/pkg/analysis_server/native/cJSON b/pkg/analysis_server/native/cJSON
new file mode 160000
index 0000000..b45f48e
--- /dev/null
+++ b/pkg/analysis_server/native/cJSON
@@ -0,0 +1 @@
+Subproject commit b45f48e600671feade0b6bd65d1c69de7899f2be
diff --git a/pkg/analysis_server/test/lsp/semantic_tokens_test.dart b/pkg/analysis_server/test/lsp/semantic_tokens_test.dart
index 1acfef1..3c5a3a8 100644
--- a/pkg/analysis_server/test/lsp/semantic_tokens_test.dart
+++ b/pkg/analysis_server/test/lsp/semantic_tokens_test.dart
@@ -21,39 +21,6 @@
 
 @reflectiveTest
 class SemanticTokensTest extends AbstractLspAnalysisServerTest {
-  /// Decode tokens according to the LSP spec and pair with relevant file contents.
-  List<_Token> decodeSemanticTokens(String content, SemanticTokens tokens) {
-    final contentLines = content.split('\n').map((line) => '$line\n').toList();
-    final results = <_Token>[];
-
-    var lastLine = 0;
-    var lastColumn = 0;
-    for (var i = 0; i < tokens.data.length; i += 5) {
-      final lineDelta = tokens.data[i];
-      final columnDelta = tokens.data[i + 1];
-      final length = tokens.data[i + 2];
-      final tokenTypeIndex = tokens.data[i + 3];
-      final modifierBitmask = tokens.data[i + 4];
-
-      // Calculate the actual line/col from the deltas.
-      final line = lastLine + lineDelta;
-      final column = lineDelta == 0 ? lastColumn + columnDelta : columnDelta;
-
-      final tokenContent =
-          contentLines[line].substring(column, column + length);
-      results.add(_Token(
-        tokenContent,
-        semanticTokenLegend.typeForIndex(tokenTypeIndex),
-        semanticTokenLegend.modifiersForBitmask(modifierBitmask),
-      ));
-
-      lastLine = line;
-      lastColumn = column;
-    }
-
-    return results;
-  }
-
   Future<void> test_annotation() async {
     final content = '''
     import 'other_file.dart' as other;
@@ -152,7 +119,7 @@
     await openFile(otherFileUri, withoutMarkers(otherContent));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(
       // Only check the first expectedStart.length items since the test code
       // is mostly unrelated to the annotations.
@@ -185,7 +152,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -255,7 +222,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -316,7 +283,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -402,7 +369,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -482,7 +449,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -530,7 +497,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -572,7 +539,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -592,7 +559,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -623,7 +590,7 @@
     configureTestPlugin(notification: pluginResult.toNotification());
 
     final tokens = await getSemanticTokens(pluginAnalyzedFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -664,7 +631,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
 
     // Remove the tokens between the two expected sets.
     decoded.removeRange(expected1.length, decoded.length - expected2.length);
@@ -720,7 +687,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -737,7 +704,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -752,7 +719,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -774,7 +741,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -808,7 +775,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -865,7 +832,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -903,7 +870,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -939,7 +906,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -966,7 +933,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -991,7 +958,7 @@
 
     final tokens =
         await getSemanticTokensRange(mainFileUri, rangeFromMarkers(content));
-    final decoded = decodeSemanticTokens(withoutMarkers(content), tokens);
+    final decoded = _decodeSemanticTokens(withoutMarkers(content), tokens);
     expect(decoded, equals(expected));
   }
 
@@ -1020,7 +987,7 @@
 
     final tokens =
         await getSemanticTokensRange(mainFileUri, rangeFromMarkers(content));
-    final decoded = decodeSemanticTokens(withoutMarkers(content), tokens);
+    final decoded = _decodeSemanticTokens(withoutMarkers(content), tokens);
     expect(decoded, equals(expected));
   }
 
@@ -1050,7 +1017,7 @@
 
     final tokens =
         await getSemanticTokensRange(mainFileUri, rangeFromMarkers(content));
-    final decoded = decodeSemanticTokens(withoutMarkers(content), tokens);
+    final decoded = _decodeSemanticTokens(withoutMarkers(content), tokens);
     expect(decoded, equals(expected));
   }
 
@@ -1122,7 +1089,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -1178,7 +1145,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -1248,7 +1215,7 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
 
@@ -1292,9 +1259,42 @@
     await openFile(mainFileUri, withoutMarkers(content));
 
     final tokens = await getSemanticTokens(mainFileUri);
-    final decoded = decodeSemanticTokens(content, tokens);
+    final decoded = _decodeSemanticTokens(content, tokens);
     expect(decoded, equals(expected));
   }
+
+  /// Decode tokens according to the LSP spec and pair with relevant file contents.
+  List<_Token> _decodeSemanticTokens(String content, SemanticTokens tokens) {
+    final contentLines = content.split('\n').map((line) => '$line\n').toList();
+    final results = <_Token>[];
+
+    var lastLine = 0;
+    var lastColumn = 0;
+    for (var i = 0; i < tokens.data.length; i += 5) {
+      final lineDelta = tokens.data[i];
+      final columnDelta = tokens.data[i + 1];
+      final length = tokens.data[i + 2];
+      final tokenTypeIndex = tokens.data[i + 3];
+      final modifierBitmask = tokens.data[i + 4];
+
+      // Calculate the actual line/col from the deltas.
+      final line = lastLine + lineDelta;
+      final column = lineDelta == 0 ? lastColumn + columnDelta : columnDelta;
+
+      final tokenContent =
+          contentLines[line].substring(column, column + length);
+      results.add(_Token(
+        tokenContent,
+        semanticTokenLegend.typeForIndex(tokenTypeIndex),
+        semanticTokenLegend.modifiersForBitmask(modifierBitmask),
+      ));
+
+      lastLine = line;
+      lastColumn = column;
+    }
+
+    return results;
+  }
 }
 
 class _Token {
diff --git a/pkg/analysis_server/test/search/abstract_search_domain.dart b/pkg/analysis_server/test/search/abstract_search_domain.dart
index 85ffa59..70b5071 100644
--- a/pkg/analysis_server/test/search/abstract_search_domain.dart
+++ b/pkg/analysis_server/test/search/abstract_search_domain.dart
@@ -12,7 +12,7 @@
 import '../analysis_server_base.dart';
 
 class AbstractSearchDomainTest extends PubPackageAnalysisServerTest {
-  final Map<String, _ResultSet> resultSets = {};
+  final Map<String, _ResultSet> _resultSets = {};
   String? searchId;
   List<SearchResult> results = <SearchResult>[];
   late SearchResult result;
@@ -68,10 +68,10 @@
     if (notification.event == SEARCH_NOTIFICATION_RESULTS) {
       var params = SearchResultsParams.fromNotification(notification);
       var id = params.id;
-      var resultSet = resultSets[id];
+      var resultSet = _resultSets[id];
       if (resultSet == null) {
         resultSet = _ResultSet(id);
-        resultSets[id] = resultSet;
+        _resultSets[id] = resultSet;
       }
       resultSet.results.addAll(params.results);
       resultSet.done = params.isLast;
@@ -85,7 +85,7 @@
   }
 
   Future waitForSearchResults() {
-    var resultSet = resultSets[searchId];
+    var resultSet = _resultSets[searchId];
     if (resultSet != null && resultSet.done) {
       results = resultSet.results;
       return Future.value();
diff --git a/pkg/analysis_server/test/src/services/correction/fix/sort_constructor_first_test.dart b/pkg/analysis_server/test/src/services/correction/fix/sort_constructor_first_test.dart
index c6a9dc9..db02f56 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/sort_constructor_first_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/sort_constructor_first_test.dart
@@ -80,10 +80,6 @@
   @override
   String get lintCode => LintNames.sort_constructors_first;
 
-  @FailingTest(
-    reason: 'The beginToken is the comment, which has no previous token.',
-    issue: 'https://github.com/dart-lang/sdk/issues/48966',
-  )
   Future<void> test_hasComment() async {
     await resolveTestCode('''
 class A {
@@ -101,10 +97,6 @@
 ''');
   }
 
-  @FailingTest(
-    reason: 'The beginToken is the comment, which has no previous token.',
-    issue: 'https://github.com/dart-lang/sdk/issues/48966',
-  )
   Future<void> test_hasComment_hasMetadata_afterComment() async {
     await resolveTestCode('''
 const a = 0;
diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart b/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart
index ad666a8..00e636e 100644
--- a/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart
+++ b/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart
@@ -39,7 +39,7 @@
   var options = CompletionMetricsOptions(result);
   var stopwatch = Stopwatch()..start();
   var client = _AnalysisServerClient(Directory(_sdk.sdkPath), targets);
-  CompletionClientMetricsComputer(rootPath, options, client).computeMetrics();
+  _CompletionClientMetricsComputer(rootPath, options, client).computeMetrics();
   stopwatch.stop();
 
   var duration = Duration(milliseconds: stopwatch.elapsedMilliseconds);
@@ -128,95 +128,6 @@
   return validateDir(parser, result.rest[0]);
 }
 
-class CompletionClientMetricsComputer extends CompletionMetricsComputer {
-  final _AnalysisServerClient client;
-
-  final CompletionMetrics targetMetric = CompletionMetrics();
-
-  final metrics = CompletionMetrics();
-
-  CompletionClientMetricsComputer(super.rootPath, super.options, this.client);
-
-  @override
-  Future<void> applyOverlay(
-    AnalysisContext context,
-    String filePath,
-    ExpectedCompletion expectedCompletion,
-  ) async {
-    if (options.overlay != OverlayMode.none) {
-      final overlayContent = CompletionMetricsComputer.getOverlayContent(
-        resolvedUnitResult.content,
-        expectedCompletion,
-        options.overlay,
-        options.prefixLength,
-      );
-
-      provider.setOverlay(
-        filePath,
-        content: overlayContent,
-        modificationStamp: overlayModificationStamp++,
-      );
-      await client.addOverlay(filePath, overlayContent);
-    }
-  }
-
-  @override
-  Future<void> computeMetrics() async {
-    await client.start();
-    await super.computeMetrics();
-    await client.shutdown();
-
-    // A row containing the name, median, p90, and p95 scores in [computer].
-    List<String> m9095Row(PercentileComputer computer) => [
-          computer.name,
-          computer.median.toString(),
-          computer.p90.toString(),
-          computer.p95.toString(),
-        ];
-
-    var table = [
-      ['', 'median', 'p90', 'p95'],
-      m9095Row(metrics.totalPercentileComputer),
-      m9095Row(metrics.requestResponsePercentileComputer),
-      m9095Row(metrics.decodePercentileComputer),
-      m9095Row(metrics.deserializePercentileComputer),
-    ];
-
-    rightJustifyColumns(table, range(1, table[0].length));
-    printTable(table);
-  }
-
-  @override
-  Future<void> computeSuggestionsAndMetrics(
-    ExpectedCompletion expectedCompletion,
-    AnalysisContext context,
-    DocumentationCache documentationCache,
-  ) async {
-    var stopwatch = Stopwatch()..start();
-    var suggestionsData = await client.requestCompletion(
-        expectedCompletion.filePath, expectedCompletion.offset, 1000);
-    stopwatch.stop();
-    var metadata = suggestionsData.metadata;
-
-    metrics.totalPercentileComputer.addValue(stopwatch.elapsedMilliseconds);
-    metrics.requestResponsePercentileComputer
-        .addValue(metadata.requestResponseDuration);
-    metrics.decodePercentileComputer.addValue(metadata.decodeDuration);
-    metrics.deserializePercentileComputer
-        .addValue(metadata.deserializeDuration);
-  }
-
-  @override
-  Future<void> removeOverlay(String filePath) async {
-    if (options.overlay != OverlayMode.none) {
-      await client.removeOverlay(filePath);
-    }
-  }
-
-  @override
-  void setupForResolution(AnalysisContext context) {}
-}
-
 class CompletionMetrics {
   /// A percentile computer which tracks the total time to create and send a
   /// completion request, and receive and decode a completion response, using
@@ -533,6 +444,95 @@
   }
 }
 
+class _CompletionClientMetricsComputer extends CompletionMetricsComputer {
+  final _AnalysisServerClient client;
+
+  final CompletionMetrics targetMetric = CompletionMetrics();
+
+  final metrics = CompletionMetrics();
+
+  _CompletionClientMetricsComputer(super.rootPath, super.options, this.client);
+
+  @override
+  Future<void> applyOverlay(
+    AnalysisContext context,
+    String filePath,
+    ExpectedCompletion expectedCompletion,
+  ) async {
+    if (options.overlay != OverlayMode.none) {
+      final overlayContent = CompletionMetricsComputer.getOverlayContent(
+        resolvedUnitResult.content,
+        expectedCompletion,
+        options.overlay,
+        options.prefixLength,
+      );
+
+      provider.setOverlay(
+        filePath,
+        content: overlayContent,
+        modificationStamp: overlayModificationStamp++,
+      );
+      await client.addOverlay(filePath, overlayContent);
+    }
+  }
+
+  @override
+  Future<void> computeMetrics() async {
+    await client.start();
+    await super.computeMetrics();
+    await client.shutdown();
+
+    // A row containing the name, median, p90, and p95 scores in [computer].
+    List<String> m9095Row(PercentileComputer computer) => [
+          computer.name,
+          computer.median.toString(),
+          computer.p90.toString(),
+          computer.p95.toString(),
+        ];
+
+    var table = [
+      ['', 'median', 'p90', 'p95'],
+      m9095Row(metrics.totalPercentileComputer),
+      m9095Row(metrics.requestResponsePercentileComputer),
+      m9095Row(metrics.decodePercentileComputer),
+      m9095Row(metrics.deserializePercentileComputer),
+    ];
+
+    rightJustifyColumns(table, range(1, table[0].length));
+    printTable(table);
+  }
+
+  @override
+  Future<void> computeSuggestionsAndMetrics(
+    ExpectedCompletion expectedCompletion,
+    AnalysisContext context,
+    DocumentationCache documentationCache,
+  ) async {
+    var stopwatch = Stopwatch()..start();
+    var suggestionsData = await client.requestCompletion(
+        expectedCompletion.filePath, expectedCompletion.offset, 1000);
+    stopwatch.stop();
+    var metadata = suggestionsData.metadata;
+
+    metrics.totalPercentileComputer.addValue(stopwatch.elapsedMilliseconds);
+    metrics.requestResponsePercentileComputer
+        .addValue(metadata.requestResponseDuration);
+    metrics.decodePercentileComputer.addValue(metadata.decodeDuration);
+    metrics.deserializePercentileComputer
+        .addValue(metadata.deserializeDuration);
+  }
+
+  @override
+  Future<void> removeOverlay(String filePath) async {
+    if (options.overlay != OverlayMode.none) {
+      await client.removeOverlay(filePath);
+    }
+  }
+
+  @override
+  void setupForResolution(AnalysisContext context) {}
+}
+
 class _RequestError {
   // This is copied from package:dartdev/src/analysis_server.dart.
 
diff --git a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
index 34b7f53..c13b51a 100644
--- a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
@@ -146,7 +146,7 @@
   Map<int, int> tokenDistances = {};
 
   /// A table mapping percentage data names to the percentage data collected.
-  Map<String, _PercentageData> percentageData = {};
+  final Map<String, _PercentageData> _percentageData = {};
 
   /// Initialize a newly created set of relevance data to be empty.
   RelevanceData();
@@ -189,7 +189,7 @@
   /// found. If [wasPositive] is `true` then the data point is a positive data
   /// point.
   void recordPercentage(String name, bool wasPositive) {
-    var data = percentageData.putIfAbsent(name, () => _PercentageData());
+    var data = _percentageData.putIfAbsent(name, () => _PercentageData());
     data.addDataPoint(wasPositive);
   }
 
@@ -1903,7 +1903,7 @@
     sink.writeln();
     _writeCounts(sink, data.simpleCounts);
     sink.writeln();
-    _writePercentageData(sink, data.percentageData);
+    _writePercentageData(sink, data._percentageData);
     sink.writeln();
     _writeSideBySide(sink, [data.byTokenType, data.byElementKind],
         ['Token Types', 'Element Kinds']);
diff --git a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
index a50093b..419ffe5 100644
--- a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
+++ b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
@@ -174,7 +174,7 @@
 /// An object that records the data used to compute the tables.
 class RelevanceData {
   /// A table mapping element kinds and keywords to counts by context.
-  Map<String, Map<_Kind, int>> byKind = {};
+  final Map<String, Map<_Kind, int>> _byKind = {};
 
   /// Initialize a newly created set of relevance data to be empty.
   RelevanceData();
@@ -184,7 +184,7 @@
   RelevanceData.fromJson(String encoded) {
     var map = json.decode(encoded) as Map<String, dynamic>;
     for (var contextEntry in map.entries) {
-      var contextMap = byKind.putIfAbsent(contextEntry.key, () => {});
+      var contextMap = _byKind.putIfAbsent(contextEntry.key, () => {});
       for (var kindEntry
           in (contextEntry.value as Map<String, dynamic>).entries) {
         _Kind kind;
@@ -204,8 +204,8 @@
   /// Add the data from the given relevance [data] to this set of relevance
   /// data.
   void addData(RelevanceData data) {
-    for (var contextEntry in data.byKind.entries) {
-      var contextMap = byKind.putIfAbsent(contextEntry.key, () => {});
+    for (var contextEntry in data._byKind.entries) {
+      var contextMap = _byKind.putIfAbsent(contextEntry.key, () => {});
       for (var kindEntry in contextEntry.value.entries) {
         var kind = kindEntry.key;
         contextMap[kind] = (contextMap[kind] ?? 0) + kindEntry.value;
@@ -216,14 +216,14 @@
   /// Record that an element of the given [kind] was found in the given
   /// [context].
   void recordElementKind(String context, ElementKind kind) {
-    var contextMap = byKind.putIfAbsent(context, () => {});
+    var contextMap = _byKind.putIfAbsent(context, () => {});
     var key = _ElementKind(kind);
     contextMap[key] = (contextMap[key] ?? 0) + 1;
   }
 
   /// Record that the given [keyword] was found in the given [context].
   void recordKeyword(String context, Keyword keyword) {
-    var contextMap = byKind.putIfAbsent(context, () => {});
+    var contextMap = _byKind.putIfAbsent(context, () => {});
     var key = _Keyword(keyword);
     contextMap[key] = (contextMap[key] ?? 0) + 1;
   }
@@ -231,7 +231,7 @@
   /// Convert this data to a JSON encoded format.
   String toJson() {
     var map = <String, Map<String, String>>{};
-    for (var contextEntry in byKind.entries) {
+    for (var contextEntry in _byKind.entries) {
       var kindMap = <String, String>{};
       for (var kindEntry in contextEntry.value.entries) {
         kindMap[kindEntry.key.uniqueKey] = kindEntry.value.toString();
@@ -1525,7 +1525,7 @@
 const defaultElementKindRelevance = {
 ''');
 
-    var byKind = data.byKind;
+    var byKind = data._byKind;
     var entries = byKind.entries.toList()
       ..sort((first, second) => first.key.compareTo(second.key));
     for (var entry in entries) {
@@ -1601,7 +1601,7 @@
 const defaultKeywordRelevance = {
 ''');
 
-    var byKind = data.byKind;
+    var byKind = data._byKind;
     var entries = byKind.entries.toList()
       ..sort((first, second) => first.key.compareTo(second.key));
     for (var entry in entries) {
diff --git a/pkg/analysis_server/tool/spec/codegen_protocol_constants.dart b/pkg/analysis_server/tool/spec/codegen_protocol_constants.dart
index 1ea7024..151faef 100644
--- a/pkg/analysis_server/tool/spec/codegen_protocol_constants.dart
+++ b/pkg/analysis_server/tool/spec/codegen_protocol_constants.dart
@@ -11,13 +11,13 @@
 final GeneratedFile clientTarget = GeneratedFile(
     '../analysis_server_client/lib/src/protocol/protocol_constants.dart',
     (String pkgPath) async {
-  var visitor = CodegenVisitor(readApi(pkgPath));
+  var visitor = _CodegenVisitor(readApi(pkgPath));
   return visitor.collectCode(visitor.visitApi);
 });
 
 final GeneratedFile serverTarget = GeneratedFile(
     'lib/protocol/protocol_constants.dart', (String pkgPath) async {
-  var visitor = CodegenVisitor(readApi(pkgPath));
+  var visitor = _CodegenVisitor(readApi(pkgPath));
   return visitor.collectCode(visitor.visitApi);
 });
 
@@ -53,8 +53,8 @@
 
 /// A visitor that produces Dart code defining constants associated with the
 /// API.
-class CodegenVisitor extends DartCodegenVisitor with CodeGenerator {
-  CodegenVisitor(super.api) {
+class _CodegenVisitor extends DartCodegenVisitor with CodeGenerator {
+  _CodegenVisitor(super.api) {
     codeGeneratorSettings.commentLineLength = 79;
     codeGeneratorSettings.docCommentStartMarker = null;
     codeGeneratorSettings.docCommentLineLeader = '/// ';
diff --git a/tools/VERSION b/tools/VERSION
index 0355602..8edebc2 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 18
 PATCH 0
-PRERELEASE 143
+PRERELEASE 144
 PRERELEASE_PATCH 0
\ No newline at end of file