Skip to content

Commit

Permalink
Merge pull request #72917 from CyrusNajmabadi/symbolDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi authored Apr 8, 2024
2 parents 8fffb1b + b02e351 commit 70316b7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,14 @@ private ImmutableArray<SymbolDisplayPart> GetDelegateAnonymousTypeParts(
SemanticModel semanticModel,
int position)
{
using var _ = ArrayBuilder<SymbolDisplayPart>.GetInstance(out var parts);

var invokeMethod = anonymousType.DelegateInvokeMethod ?? throw ExceptionUtilities.Unreachable();

parts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Keyword, symbol: null,
SyntaxFactsService.GetText(SyntaxFactsService.SyntaxKinds.DelegateKeyword)));
parts.AddRange(Space());
parts.AddRange(MassageDelegateParts(invokeMethod, invokeMethod.ToMinimalDisplayParts(
semanticModel, position, s_delegateDisplay)));

return parts.ToImmutable();
return
[
new SymbolDisplayPart(SymbolDisplayPartKind.Keyword, symbol: null, SyntaxFactsService.GetText(SyntaxFactsService.SyntaxKinds.DelegateKeyword)),
.. Space(),
.. MassageDelegateParts(invokeMethod, invokeMethod.ToMinimalDisplayParts(semanticModel, position, s_delegateDisplay))
];
}

private static ImmutableArray<SymbolDisplayPart> MassageDelegateParts(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,13 @@ protected void AddToGroup(SymbolDescriptionGroups group, params IEnumerable<Symb

private static IEnumerable<SymbolDisplayPart> Description(string description)
{
return Punctuation("(")
.Concat(PlainText(description))
.Concat(Punctuation(")"))
.Concat(Space());
return
[
.. Punctuation("("),
.. PlainText(description),
.. Punctuation(")"),
.. Space(),
];
}

protected static IEnumerable<SymbolDisplayPart> Keyword(string text)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Classification;
using Microsoft.CodeAnalysis.Host;

namespace Microsoft.CodeAnalysis.LanguageService;
Expand Down

0 comments on commit 70316b7

Please sign in to comment.