From efea728f29d6ebe4bf945e20d6518463641241f7 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 10 Jul 2015 23:00:19 -0500 Subject: [PATCH] Improve identification of relevant nodes for QuickInfo in Roslyn Fixes #119 --- .../Intellisense/IntellisenseContractsHelper.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Microsoft.Research/ContractAdornments/CSharp.Roslyn/Intellisense/IntellisenseContractsHelper.cs b/Microsoft.Research/ContractAdornments/CSharp.Roslyn/Intellisense/IntellisenseContractsHelper.cs index 6c12ff60..042f5aba 100644 --- a/Microsoft.Research/ContractAdornments/CSharp.Roslyn/Intellisense/IntellisenseContractsHelper.cs +++ b/Microsoft.Research/ContractAdornments/CSharp.Roslyn/Intellisense/IntellisenseContractsHelper.cs @@ -141,11 +141,18 @@ public static SyntaxNode GetTargetAtTriggerPoint(ITrackingPoint triggerPoint, IT if (asCall != null) { //Make sure we aren't on the right side of the call + if (asCall.Expression == leafNode) + return asCall; + MemberAccessExpressionSyntax memberAccessExpression = asCall.Expression as MemberAccessExpressionSyntax; - if (memberAccessExpression == null || memberAccessExpression.Name == leafNode) - return null; + if (memberAccessExpression != null && memberAccessExpression.Name == leafNode) + return asCall; - return asCall; + GenericNameSyntax genericNameSyntax = asCall.Expression as GenericNameSyntax; + if (genericNameSyntax != null && genericNameSyntax.Identifier == leafToken) + return asCall; + + return null; } var asProp = nodeInQuestion as MemberAccessExpressionSyntax;