Repository: PowerShell/PowerShell
File: src/System.Management.Automation/engine/CommandCompletion/CompletionHelpers.cs (C#)

Code before:
        /// <returns>List of matching completion results.</returns>
        internal static IEnumerable<CompletionResult> GetMatchingResults(
            string wordToComplete,
            IEnumerable<string> possibleCompletionValues,
            CompletionDisplayInfoMapper displayInfoMapper = null,
            CompletionResultType resultType = CompletionResultType.Text,
            MatchStrategy matchStrategy = null)
        {
            displayInfoMapper ??= DefaultDisplayInfoMapper;
            matchStrategy ??= DefaultMatch;

            string quote = HandleDoubleAndSingleQuote(ref wordToComplete);
            if (quote != SingleQuote)
            {
                wordToComplete = NormalizeToExpandableString(wordToComplete);
            }

            foreach (string value in possibleCompletionValues)
            {
                if (matchStrategy(value, wordToComplete))
                {
                    string completionText = QuoteCompletionText(value, quote);

                    (string ToolTip, string ListItemText) displayInfo = displayInfoMapper(value);
                    string toolTip = displayInfo.ToolTip;
                    string listItemText = displayInfo.ListItemText;

                    yield return new CompletionResult(completionText, listItemText, resultType, toolTip);
                }
            }
        }

        /// <summary>
        /// Provides the display information for a completion result.
        /// This delegate is used to map a string value to its corresponding display information.
        /// </summary>
        /// <param name="value">The input value to be mapped</param>
        /// <returns>Completion display info containing tool tip and list item text.</returns>
        internal delegate (string ToolTip, string ListItemText) CompletionDisplayInfoMapper(string value);

        /// <summary>
        /// Provides the default display information for a completion result.
        /// Defaults to using the input value for both the tool tip and list item text.
        /// </summary>
        /// <returns>Completion display info containing tool tip and list item text.</returns>
        internal static readonly CompletionDisplayInfoMapper DefaultDisplayInfoMapper = value
            => (value, value);

        /// <summary>
        /// Normalizes the input string to an expandable string format for PowerShell.
        /// </summary>

Review comment (suggestion):
```suggestion
                    (string toolTip, string listItemText) = displayInfoMapper(value);
```

Code after:
        /// <returns>List of matching completion results.</returns>
        internal static IEnumerable<CompletionResult> GetMatchingResults(
            string wordToComplete,
            IEnumerable<string> possibleCompletionValues,
            CompletionDisplayInfoMapper displayInfoMapper = null,
            CompletionResultType resultType = CompletionResultType.Text,
            MatchStrategy matchStrategy = null)
        {
            displayInfoMapper ??= DefaultDisplayInfoMapper;
            matchStrategy ??= DefaultMatch;

            string quote = HandleDoubleAndSingleQuote(ref wordToComplete);
            if (quote != SingleQuote)
            {
                wordToComplete = NormalizeToExpandableString(wordToComplete);
            }

            foreach (string value in possibleCompletionValues)
            {
                if (matchStrategy(value, wordToComplete))
                {
                    string completionText = QuoteCompletionText(value, quote);

                    (string toolTip, string listItemText) = displayInfoMapper(value);

                    yield return new CompletionResult(completionText, listItemText, resultType, toolTip);
                }
            }
        }

        /// <summary>
        /// Provides the display information for a completion result.
        /// This delegate is used to map a string value to its corresponding display information.
        /// </summary>
        /// <param name="value">The input value to be mapped</param>
        /// <returns>Completion display info containing tool tip and list item text.</returns>
        internal delegate (string ToolTip, string ListItemText) CompletionDisplayInfoMapper(string value);

        /// <summary>
        /// Provides the default display information for a completion result.
        /// Defaults to using the input value for both the tool tip and list item text.
        /// </summary>
        /// <returns>Completion display info containing tool tip and list item text.</returns>
        internal static readonly CompletionDisplayInfoMapper DefaultDisplayInfoMapper = value
            => (value, value);

        /// <summary>
        /// Normalizes the input string to an expandable string format for PowerShell.
        /// </summary>
        /// <param name="value">The input string to be normalized.</param>
        /// <returns>The normalized string with special characters replaced by their PowerShell escape sequences.</returns>