@@ -126,10 +126,10 @@ async Task<QuickInfoItem> InternalGetQuickInfoItemAsync(IAsyncQuickInfoSession s
126126 case SyntaxKind . OrderByKeyword :
127127 symbol = semanticModel . GetTypeInfo ( unitCompilation . FindNode ( token . Span ) ) . ConvertedType ;
128128 if ( symbol == null ) {
129- if ( Config . Instance . QuickInfoOptions . MatchFlags ( QuickInfoOptions . Parameter ) ) {
130- break ;
131- }
132- return null ;
129+ if ( Config . Instance . QuickInfoOptions . MatchFlags ( QuickInfoOptions . Parameter ) ) {
130+ break ;
131+ }
132+ return null ;
133133 }
134134 break ;
135135 case SyntaxKind . AsKeyword :
@@ -141,7 +141,7 @@ async Task<QuickInfoItem> InternalGetQuickInfoItemAsync(IAsyncQuickInfoSession s
141141 break ;
142142 case SyntaxKind . ReturnKeyword :
143143 var tb = ShowReturnInfo ( unitCompilation . FindNode ( token . Span ) as ReturnStatementSyntax , semanticModel , cancellationToken ) ;
144- return tb != null ? new QuickInfoItem ( token . Span . CreateSnapshotSpan ( currentSnapshot ) . ToTrackingSpan ( ) , tb ) : null ;
144+ return tb != null ? CreateQuickInfoItem ( session , token , tb ) : null ;
145145 case SyntaxKind . AwaitKeyword :
146146 node = ( unitCompilation . FindNode ( token . Span , false , true ) as AwaitExpressionSyntax ) ? . Expression ;
147147 goto PROCESS ;
@@ -173,7 +173,7 @@ async Task<QuickInfoItem> InternalGetQuickInfoItemAsync(IAsyncQuickInfoSession s
173173 . SetGlyph ( ThemeHelper . GetImage ( IconIds . Region ) )
174174 . Append ( ( unitCompilation . FindNode ( token . Span , true , false ) as EndRegionDirectiveTriviaSyntax ) . GetRegion ( ) ? . GetDeclarationSignature ( ) , true )
175175 ) ;
176- return new QuickInfoItem ( currentSnapshot . CreateTrackingSpan ( token . SpanStart , token . Span . Length , SpanTrackingMode . EdgeInclusive ) , qiContent . ToUI ( ) ) ;
176+ return CreateQuickInfoItem ( session , token , qiContent . ToUI ( ) ) ;
177177 case SyntaxKind . VoidKeyword :
178178 return null ;
179179 case SyntaxKind . TypeOfKeyword :
@@ -197,7 +197,7 @@ async Task<QuickInfoItem> InternalGetQuickInfoItemAsync(IAsyncQuickInfoSession s
197197 ShowBlockInfo ( qiContent , currentSnapshot , node , semanticModel ) ;
198198 }
199199 if ( qiContent . Count > 0 ) {
200- return new QuickInfoItem ( currentSnapshot . CreateTrackingSpan ( token . SpanStart , token . Span . Length , SpanTrackingMode . EdgeInclusive ) , qiContent . ToUI ( ) ) ;
200+ return CreateQuickInfoItem ( session , token , qiContent . ToUI ( ) ) ;
201201 }
202202 return null ;
203203 }
@@ -292,9 +292,14 @@ async Task<QuickInfoItem> InternalGetQuickInfoItemAsync(IAsyncQuickInfoSession s
292292 }
293293 qiWrapper . ApplyClickAndGo ( symbol , buffer , session ) ;
294294 }
295- return new QuickInfoItem ( ( qiContent . Count > 0 || symbol != null && Config . Instance . QuickInfoOptions . MatchFlags ( QuickInfoOptions . AlternativeStyle ) ) && session . TextView . TextSnapshot == currentSnapshot
296- ? currentSnapshot . CreateTrackingSpan ( token . SpanStart , token . Span . Length , SpanTrackingMode . EdgeExclusive )
297- : null , qiContent . ToUI ( ) ) ;
295+ return CreateQuickInfoItem ( session , ( qiContent . Count > 0 || symbol != null && Config . Instance . QuickInfoOptions . MatchFlags ( QuickInfoOptions . AlternativeStyle ) ) && session . TextView . TextSnapshot == currentSnapshot
296+ ? token
297+ : ( SyntaxToken ? ) null , qiContent . ToUI ( ) ) ;
298+ }
299+
300+ static QuickInfoItem CreateQuickInfoItem ( IAsyncQuickInfoSession session , SyntaxToken ? token , object item ) {
301+ session . KeepViewPosition ( ) ;
302+ return new QuickInfoItem ( token ? . Span . CreateSnapshotSpan ( session . TextView . TextSnapshot ) . ToTrackingSpan ( ) , item ) ;
298303 }
299304
300305 static async Task < ThemedTipDocument > ShowAvailabilityAsync ( Document doc , SyntaxToken token , CancellationToken cancellationToken ) {
@@ -343,6 +348,8 @@ static ISymbol GetSymbol(SemanticModel semanticModel, SyntaxNode node, ref Immut
343348 || node . Parent . IsKind ( SyntaxKind . DeclarationPattern )
344349 || node . Parent . IsKind ( SyntaxKind . ParenthesizedVariableDesignation ) )
345350 ? semanticModel . GetDeclaredSymbol ( node , cancellationToken )
351+ // : kind == SyntaxKind.ArrowExpressionClause
352+ // ? semanticModel.GetDeclaredSymbol(node.Parent, cancellationToken)
346353 : kind == SyntaxKind . IdentifierName && node . Parent . IsKind ( SyntaxKind . NameEquals ) && ( node = node . Parent . Parent ) != null && node . IsKind ( SyntaxKind . UsingDirective )
347354 ? semanticModel . GetDeclaredSymbol ( node , cancellationToken ) ? . GetAliasTarget ( )
348355 : semanticModel . GetSymbolExt ( node , cancellationToken ) ) ;
0 commit comments