Skip to content

Commit

Permalink
- Fix incorrect Quick Info for qualified C# constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
wmjordan committed Feb 7, 2024
1 parent d866947 commit 6051aeb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Codist/QuickInfo/CSharpQuickInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ async Task<QuickInfoItem> InternalGetQuickInfoItemAsync(IAsyncQuickInfoSession s
? QuickInfoOverride.CreateOverride(session)
: null;
var container = new InfoContainer();
ClassifyToken:
ObjectCreationExpressionSyntax ctor = null;
ClassifyToken:
switch (token.Kind()) {
case SyntaxKind.WhitespaceTrivia:
case SyntaxKind.SingleLineCommentTrivia:
Expand Down Expand Up @@ -286,7 +287,6 @@ async Task<QuickInfoItem> InternalGetQuickInfoItemAsync(IAsyncQuickInfoSession s
return null;
}

ObjectCreationExpressionSyntax ctor;
PROCESS:
if (Config.Instance.QuickInfoOptions.MatchFlags(QuickInfoOptions.Parameter)) {
ShowParameterInfo(container, node, semanticModel, cancellationToken);
Expand Down Expand Up @@ -342,10 +342,10 @@ async Task<QuickInfoItem> InternalGetQuickInfoItemAsync(IAsyncQuickInfoSession s
if (isConvertedType == false) {
container.Add(await ShowAvailabilityAsync(ctx.Document, token, cancellationToken).ConfigureAwait(false));
}
ctor = node.Parent as ObjectCreationExpressionSyntax;
ctor = node.Parent.UnqualifyExceptNamespace() as ObjectCreationExpressionSyntax;
OverrideDocumentation(node,
o,
ctor?.Type == node
ctor != null
? semanticModel.GetSymbolInfo(ctor, cancellationToken).Symbol ?? symbol
: symbol,
semanticModel,
Expand All @@ -358,8 +358,10 @@ async Task<QuickInfoItem> InternalGetQuickInfoItemAsync(IAsyncQuickInfoSession s
ShowSymbolInfo(session, container, node, symbol, semanticModel, cancellationToken);
}
RETURN:
ctor = node.Parent as ObjectCreationExpressionSyntax;
if (ctor != null && ctor.Type == node) {
if (ctor == null) {
ctor = node.Parent.UnqualifyExceptNamespace() as ObjectCreationExpressionSyntax;
}
if (ctor != null) {
symbol = semanticModel.GetSymbolOrFirstCandidate(ctor, cancellationToken) ?? symbol;
if (symbol == null) {
return null;
Expand Down

0 comments on commit 6051aeb

Please sign in to comment.