anchor.diff:      LspClientCapabilities capabilities,
       ResolvedUnitResult unit,
       CompletionPerformance completionPerformance,
  -    OperationPerformanceImpl operationPerformance,
  +    OperationPerformanceImpl performance,
       int offset,
       String? triggerCharacter,
       CancellationToken token, {
  
positive.code:     if (fileExtension == '.dart' && !unit.isError) {
        final result = unit.result;
        var performanceOperation = OperationPerformanceImpl('<root>');
        completionPerformance = CompletionPerformance(
          operation: performanceOperation,
          path: result.path,
          content: result.content,
          offset: offset,
        );
        server.performanceStats.completion.add(completionPerformance);
  
        serverResultsFuture = _getServerDartItems(
          clientCapabilities,
          unit.result,
          completionPerformance,
          performanceOperation,
          offset,
          triggerCharacter,
          token,
          maxResults: maxResults,
        );
      } else if (fileExtension == '.yaml') {
        YamlCompletionGenerator? generator;
  
negative.code:     final useSuggestionSets =
          suggestFromUnimportedLibraries && capabilities.applyEdit;
  
      final completionRequest = DartCompletionRequest.forResolvedUnit(
        resolvedUnit: unit,
        offset: offset,
        dartdocDirectiveInfo: server.getDartdocDirectiveInfoFor(unit),
        completionPreference: CompletionPreference.replace,
      );
      final target = completionRequest.target;
  
      if (triggerCharacter != null) {
        if (!_triggerCharacterValid(offset, triggerCharacter, target)) {
          return success(CompletionList(isIncomplete: false, items: []));
        }
      }
  
      Set<ElementKind>? includedElementKinds;
      Set<String>? includedElementNames;
      List<IncludedSuggestionRelevanceTag>? includedSuggestionRelevanceTags;
      if (useSuggestionSets) {
        includedElementKinds = <ElementKind>{};
        includedElementNames = <String>{};
        includedSuggestionRelevanceTags = <IncludedSuggestionRelevanceTag>[];
      }
  
      try {
        var contributor = DartCompletionManager(
          budget: CompletionBudget(CompletionBudget.defaultDuration),
          includedElementKinds: includedElementKinds,
          includedElementNames: includedElementNames,
          includedSuggestionRelevanceTags: includedSuggestionRelevanceTags,
        );
  
        final serverSuggestions2 = await contributor.computeSuggestions(
          completionRequest,
          performance,
        );
  
        final serverSuggestions = serverSuggestions2.map((serverSuggestion) {
          return serverSuggestion.build();
        }).toList();
  
        final insertLength = _computeInsertLength(
          offset,
          completionRequest.replacementOffset,
          completionRequest.replacementLength,
        );
  
        if (token.isCancellationRequested) {
          return cancelled();
        }
  
        /// completeFunctionCalls should be suppressed if the target is an
        /// invocation that already has an argument list, otherwise we would
        /// insert dupes.
        final completeFunctionCalls = _hasExistingArgList(target.entity)
            ? false
            : server.clientConfiguration.global.completeFunctionCalls;
  
        final results = serverSuggestions.map(
          (item) {
            var itemReplacementOffset =
                item.replacementOffset ?? completionRequest.replacementOffset;
            var itemReplacementLength =
                item.replacementLength ?? completionRequest.replacementLength;
            var itemInsertLength = insertLength;
  
            // Recompute the insert length if it may be affected by the above.
            if (item.replacementOffset != null ||
                item.replacementLength != null) {
              itemInsertLength = _computeInsertLength(
                  offset, itemReplacementOffset, itemInsertLength);
            }
  
            // Convert to LSP ranges using the LineInfo.
            Range? replacementRange = toRange(
                unit.lineInfo, itemReplacementOffset, itemReplacementLength);
            Range? insertionRange =
                toRange(unit.lineInfo, itemReplacementOffset, itemInsertLength);
  
            return toCompletionItem(
              capabilities,
              unit.lineInfo,
              item,
              replacementRange: replacementRange,
              insertionRange: insertionRange,
              // TODO(dantup): Move commit characters to the main response
              // and remove from each individual item (to reduce payload size)
              // once the following change ships (and the Dart VS Code
              // extension is updated to use it).
              // https://github.com/microsoft/vscode-languageserver-node/issues/673
              includeCommitCharacters:
                  server.clientConfiguration.global.previewCommitCharacters,
              completeFunctionCalls: completeFunctionCalls,
            );
          },
        ).toList();
  
        // Now compute items in suggestion sets.
        var includedSuggestionSets = <IncludedSuggestionSet>[];
        final declarationsTracker = server.declarationsTracker;
        if (declarationsTracker != null &&
            includedElementKinds != null &&
            includedElementNames != null &&
            includedSuggestionRelevanceTags != null) {
          computeIncludedSetList(
            declarationsTracker,
            completionRequest,
            includedSuggestionSets,
            includedElementNames,
          );
  
          // Build a fast lookup for imported symbols so that we can filter out
          // duplicates.
          final alreadyImportedSymbols = _buildLookupOfImportedSymbols(unit);
  
          includedSuggestionSets.forEach((includedSet) {
            final library = declarationsTracker.getLibrary(includedSet.id);
            if (library == null) {
              return;
            }
  
            // Make a fast lookup for tag relevance.
            final tagBoosts = <String, int>{};
            includedSuggestionRelevanceTags!
                .forEach((t) => tagBoosts[t.tag] = t.relevanceBoost);
  
            // Only specific types of child declarations should be included.
            // This list matches what's in _protocolAvailableSuggestion in
            // the DAS implementation.
            bool shouldIncludeChild(Declaration child) =>
                child.kind == DeclarationKind.CONSTRUCTOR ||
                child.kind == DeclarationKind.ENUM_CONSTANT ||
                (child.kind == DeclarationKind.GETTER && child.isStatic) ||
                (child.kind == DeclarationKind.FIELD && child.isStatic);
  
            // Collect declarations and their children.
            final allDeclarations = library.declarations
                .followedBy(library.declarations
                    .expand((decl) => decl.children.where(shouldIncludeChild)))
                .toList();
  
            final setResults = allDeclarations
                // Filter to only the kinds we should return.
                .where((item) => includedElementKinds!
                    .contains(protocolElementKind(item.kind)))
                .where((item) {
              // Check existing imports to ensure we don't already import
              // this element (this exact element from its declaring
              // library, not just something with the same name). If we do
              // we'll want to skip it.
              final declaringUri =
                  item.parent?.locationLibraryUri ?? item.locationLibraryUri!;
  
              // For enums and named constructors, only the parent enum/class is in
              // the list of imported symbols so we use the parents name.
              final nameKey = item.kind == DeclarationKind.ENUM_CONSTANT ||
                      item.kind == DeclarationKind.CONSTRUCTOR
                  ? item.parent!.name
                  : item.name;
              final key = _createImportedSymbolKey(nameKey, declaringUri);
              final importingUris = alreadyImportedSymbols[key];
  
              // Keep it only if:
              // - no existing imports include it
              //     (in which case all libraries will be offered as
              //     auto-imports)
              // - this is the first imported URI that includes it
              //     (we don't want to repeat it for each imported library that
              //     includes it)
              return importingUris == null ||
                  importingUris.first == '${library.uri}';
            }).map((item) => declarationToCompletionItem(
                      capabilities,
                      unit.path,
                      offset,
                      includedSet,
                      library,
                      tagBoosts,
                      unit.lineInfo,
                      item,
                      completionRequest.replacementOffset,
                      insertLength,
                      completionRequest.replacementLength,
                      // TODO(dantup): Move commit characters to the main response
                      // and remove from each individual item (to reduce payload size)
                      // once the following change ships (and the Dart VS Code
                      // extension is updated to use it).
                      // https://github.com/microsoft/vscode-languageserver-node/issues/673
                      includeCommitCharacters: server
                          .clientConfiguration.global.previewCommitCharacters,
                      completeFunctionCalls: completeFunctionCalls,
                    ));
            results.addAll(setResults);
          });
        }
  
        // Add in any snippets.
        final snippetsEnabled =
            server.clientConfiguration.forResource(unit.path).enableSnippets;
        // We can only produce edits with edit builders for files inside
        // the root, so skip snippets entirely if not.
        final isEditableFile =
            unit.session.analysisContext.contextRoot.isAnalyzed(unit.path);
        if (capabilities.completionSnippets &&
            snippetsEnabled &&
            isEditableFile) {
          results.addAll(await _getDartSnippetItems(
            clientCapabilities: capabilities,
            unit: unit,
            offset: offset,
            lineInfo: unit.lineInfo,
          ));
        }
  
        // Perform fuzzy matching based on the identifier in front of the caret to
        // reduce the size of the payload.
        final fuzzyPattern = completionRequest.targetPrefix;
        final fuzzyMatcher =
            FuzzyMatcher(fuzzyPattern, matchStyle: MatchStyle.TEXT);
  
        final matchingResults = results
            .where((e) => fuzzyMatcher.score(e.filterText ?? e.label) > 0)
            .toList();
  
        // Transmitted count will be set after combining with plugins.
        completionPerformance.computedSuggestionCount = matchingResults.length;
  
        return success(
            CompletionList(isIncomplete: false, items: matchingResults));
      } on AbortCompletion {
        return success(CompletionList(isIncomplete: false, items: []));
      } on InconsistentAnalysisException {
        return success(CompletionList(isIncomplete: false, items: []));
      }
    }
  
    Future<ErrorOr<CompletionList>> _getServerYamlItems(
  