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

Code before:
            string helpMessage = null;
            if (param.Parameter.CompiledAttributes is not null)
            {
                foreach (Attribute attr in param.Parameter.CompiledAttributes)
                {
                    if (attr is ParameterAttribute pattr)
                    {
                        helpMessage = GetParameterHelpMessage(
                            pattr,
                            commandAssembly);
                        if (!string.IsNullOrEmpty(helpMessage))
                        {
                            break;
                        }
                    }
                }
            }
            if (!string.IsNullOrWhiteSpace(helpMessage))
            {
                helpMessage = $" - {helpMessage.Trim()}";
            }

            string colonSuffix = withColon ? ":" : string.Empty;
            if (pattern.IsMatch(matchedParameterName))
            {
                string completionText = "-" + matchedParameterName + colonSuffix;
                string tooltip = parameterType + matchedParameterName + helpMessage;
                result.Add(new CompletionResult(completionText, matchedParameterName, CompletionResultType.ParameterName, tooltip));
            }
            else
            {
                // Process alias when there is partial input
                foreach (var alias in param.Parameter.Aliases)
                {
                    if (pattern.IsMatch(alias))
                    {
                        result.Add(new CompletionResult(
                            $"-{alias}{colonSuffix}",
                            alias,
                            CompletionResultType.ParameterName,
                            parameterType + alias + helpMessage));
                    }
                }
            }

            return result;
        }

#nullable enable
        /// <summary>
        /// Gets the help message text for the parameter attribute.

Review comment (suggestion):
It is more readable:
```suggestion
                    if (attr is ParameterAttribute pattr && TryGetParameterHelpMessage(pattr, commandAssembly, out helpMessage))
                    {
                        helpMessage = $" - {helpMessage.Trim()}";
                        break;
                    }
```

Code after:
                // The pseudo binder has skipped a parameter
                // This will happen when completing parameters for commands with dynamic parameters.
                result = GetParameterCompletionResults(
                    parameterName,
                    bindingInfo.ValidParameterSetsFlags,
                    bindingInfo.UnboundParameters,
                    withColon,
                    commandAssembly);
                return result;
            }

            MergedCompiledCommandParameter param = bindingInfo.BoundParameters[matchedParameterName];

            WildcardPattern pattern = WildcardPattern.Get(parameterName + "*", WildcardOptions.IgnoreCase);
            string parameterType = "[" + ToStringCodeMethods.Type(param.Parameter.Type, dropNamespaces: true) + "] ";

            string helpMessage = string.Empty;
            if (param.Parameter.CompiledAttributes is not null)
            {
                foreach (Attribute attr in param.Parameter.CompiledAttributes)
                {
                    if (attr is ParameterAttribute pattr && TryGetParameterHelpMessage(pattr, commandAssembly, out string attrHelpMessage))
                    {
                        helpMessage = $" - {attrHelpMessage}";
                        break;
                    }
                }
            }

            string colonSuffix = withColon ? ":" : string.Empty;
            if (pattern.IsMatch(matchedParameterName))
            {
                string completionText = $"-{matchedParameterName}{colonSuffix}";
                string tooltip = $"{parameterType}{matchedParameterName}{helpMessage}";
                result.Add(new CompletionResult(completionText, matchedParameterName, CompletionResultType.ParameterName, tooltip));
            }
            else
            {
                // Process alias when there is partial input
                foreach (var alias in param.Parameter.Aliases)
                {
                    if (pattern.IsMatch(alias))
                    {
                        result.Add(new CompletionResult(
                            $"-{alias}{colonSuffix}",
                            alias,
                            CompletionResultType.ParameterName,
                            $"{parameterType}{alias}{helpMessage}"));
                    }
                }
            }