@@ -2394,7 +2394,7 @@ export function getCompletionEntriesFromSymbols(
23942394 includeSymbol = false
23952395) : UniqueNameSet {
23962396 const start = timestamp ( ) ;
2397- const variableOrParameterDeclaration = getVariableOrParameterDeclaration ( contextToken ) ;
2397+ const variableOrParameterDeclaration = getVariableOrParameterDeclaration ( contextToken , location ) ;
23982398 const useSemicolons = probablyUsesSemicolons ( sourceFile ) ;
23992399 const typeChecker = program . getTypeChecker ( ) ;
24002400 // Tracks unique names.
@@ -5464,14 +5464,20 @@ function isModuleSpecifierMissingOrEmpty(specifier: ModuleReference | Expression
54645464 return ! tryCast ( isExternalModuleReference ( specifier ) ? specifier . expression : specifier , isStringLiteralLike ) ?. text ;
54655465}
54665466
5467- function getVariableOrParameterDeclaration ( contextToken : Node | undefined ) {
5467+ function getVariableOrParameterDeclaration ( contextToken : Node | undefined , location : Node ) {
54685468 if ( ! contextToken ) return ;
54695469
5470- const declaration = findAncestor ( contextToken , node =>
5470+ const possiblyParameterDeclaration = findAncestor ( contextToken , node =>
54715471 isFunctionBlock ( node ) || isArrowFunctionBody ( node ) || isBindingPattern ( node )
54725472 ? "quit"
5473- : isVariableDeclaration ( node ) || ( ( isParameter ( node ) || isTypeParameterDeclaration ( node ) ) && ! isIndexSignatureDeclaration ( node . parent ) ) ) ;
5474- return declaration as ParameterDeclaration | TypeParameterDeclaration | VariableDeclaration | undefined ;
5473+ : ( ( isParameter ( node ) || isTypeParameterDeclaration ( node ) ) && ! isIndexSignatureDeclaration ( node . parent ) ) ) ;
5474+
5475+ const possiblyVariableDeclaration = findAncestor ( location , node =>
5476+ isFunctionBlock ( node ) || isArrowFunctionBody ( node ) || isBindingPattern ( node )
5477+ ? "quit"
5478+ : isVariableDeclaration ( node ) ) ;
5479+
5480+ return ( possiblyParameterDeclaration || possiblyVariableDeclaration ) as ParameterDeclaration | TypeParameterDeclaration | VariableDeclaration | undefined ;
54755481}
54765482
54775483function isArrowFunctionBody ( node : Node ) {
0 commit comments