Repository: dotnet/roslyn
File: src/Features/Core/Portable/FindUsages/FindUsagesHelpers.cs (C#)

Code before:
    private static readonly SymbolDisplayFormat s_definitionFormat =
        new(
            typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypes,
            genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
            parameterOptions: SymbolDisplayParameterOptions.IncludeType,
            propertyStyle: SymbolDisplayPropertyStyle.ShowReadWriteDescriptor,
            delegateStyle: SymbolDisplayDelegateStyle.NameAndSignature,
            kindOptions: SymbolDisplayKindOptions.IncludeMemberKeyword | SymbolDisplayKindOptions.IncludeNamespaceKeyword | SymbolDisplayKindOptions.IncludeTypeKeyword,
            localOptions: SymbolDisplayLocalOptions.IncludeType,
            memberOptions:
                SymbolDisplayMemberOptions.IncludeContainingType |
                SymbolDisplayMemberOptions.IncludeExplicitInterface |
                SymbolDisplayMemberOptions.IncludeModifiers |
                SymbolDisplayMemberOptions.IncludeParameters |
                SymbolDisplayMemberOptions.IncludeType,
            globalNamespaceStyle: SymbolDisplayGlobalNamespaceStyle.OmittedAsContaining,
            miscellaneousOptions:
                SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers |
                SymbolDisplayMiscellaneousOptions.UseSpecialTypes);

    private static readonly SymbolDisplayFormat s_parameterDefinitionFormat = s_definitionFormat
        .AddParameterOptions(SymbolDisplayParameterOptions.IncludeName);

    public static ImmutableArray<TaggedText> GetDisplayParts(ISymbol definition)
        => definition.ToDisplayParts(GetFormat(definition)).ToTaggedText();
}


Review comment (bug):
Is this a bug in the compiler though? I'm having a hard time imagining why the regular symbol wouldn't have what it needs.

Code after:
    private static readonly SymbolDisplayFormat s_definitionFormat =
        new(
            typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypes,
            genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
            parameterOptions: SymbolDisplayParameterOptions.IncludeType,
            propertyStyle: SymbolDisplayPropertyStyle.ShowReadWriteDescriptor,
            delegateStyle: SymbolDisplayDelegateStyle.NameAndSignature,
            kindOptions: SymbolDisplayKindOptions.IncludeMemberKeyword | SymbolDisplayKindOptions.IncludeNamespaceKeyword | SymbolDisplayKindOptions.IncludeTypeKeyword,
            localOptions: SymbolDisplayLocalOptions.IncludeType,
            memberOptions:
                SymbolDisplayMemberOptions.IncludeContainingType |
                SymbolDisplayMemberOptions.IncludeExplicitInterface |
                SymbolDisplayMemberOptions.IncludeModifiers |
                SymbolDisplayMemberOptions.IncludeParameters |
                SymbolDisplayMemberOptions.IncludeType,
            globalNamespaceStyle: SymbolDisplayGlobalNamespaceStyle.OmittedAsContaining,
            miscellaneousOptions:
                SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers |
                SymbolDisplayMiscellaneousOptions.UseSpecialTypes);

    private static readonly SymbolDisplayFormat s_parameterDefinitionFormat = s_definitionFormat
        .AddParameterOptions(SymbolDisplayParameterOptions.IncludeName);

    public static ImmutableArray<TaggedText> GetDisplayParts(ISymbol definition)
        // Range variables have to be specially handled as only ToMinimalDisplayParts can pass enough information 
        // to the compiler to properly display the pseudo-return-type they have.
        => (definition is IRangeVariableSymbol rangeVariable
            ? GetDisplayPartsForRangeVariable(rangeVariable)
            : definition.ToDisplayParts(GetFormat(definition))).ToTaggedText();

    private static ImmutableArray<SymbolDisplayPart> GetDisplayPartsForRangeVariable(IRangeVariableSymbol rangeVariable)
    {
        if (rangeVariable is
            {
                ContainingAssembly: ISourceAssemblySymbol sourceAssembly,
                Locations: [{ SourceTree: { } syntaxTree, SourceSpan: var sourceSpan }, ..],
            })
        {
            var compilation = sourceAssembly.Compilation;
            var semanticModel = compilation.GetSemanticModel(syntaxTree);
            return rangeVariable.ToMinimalDisplayParts(semanticModel, sourceSpan.Start);
        }

        return rangeVariable.ToDisplayParts(GetFormat(rangeVariable));
    }
}