@@ -169,54 +169,57 @@ export function getDefinitionAtPosition(program: Program, sourceFile: SourceFile
169169 let symbol : Symbol | undefined ;
170170 let failedAliasResolution : boolean | undefined ;
171171
172- if ( isPropertyAccessExpression ( parent ) ) {
173- const nodeType = typeChecker . getTypeAtLocation ( node ) ;
174- if ( nodeType . symbol && isTsPlusSymbol ( nodeType . symbol ) ) {
175- if ( parent . parent && isCallExpression ( parent . parent ) && parent . parent . expression === parent ) {
176- const declaration = getDeclarationForTsPlus ( typeChecker , parent . parent , nodeType . symbol )
177- if ( declaration ) {
178- symbol = declaration . symbol
172+ const nodeSymbol = typeChecker . getSymbolAtLocation ( node )
173+ if ( ! nodeSymbol ) {
174+ if ( isPropertyAccessExpression ( parent ) ) {
175+ const nodeType = typeChecker . getTypeAtLocation ( node ) ;
176+ if ( nodeType . symbol && isTsPlusSymbol ( nodeType . symbol ) ) {
177+ if ( parent . parent && isCallExpression ( parent . parent ) && parent . parent . expression === parent ) {
178+ const declaration = getDeclarationForTsPlus ( typeChecker , parent . parent , nodeType . symbol )
179+ if ( declaration ) {
180+ symbol = declaration . symbol
181+ }
182+ }
183+ if ( ! symbol && nodeType . symbol . tsPlusTag !== TsPlusSymbolTag . Fluent ) {
184+ symbol = nodeType . symbol . tsPlusDeclaration . symbol ;
179185 }
180186 }
181- if ( ! symbol && nodeType . symbol . tsPlusTag !== TsPlusSymbolTag . Fluent ) {
182- symbol = nodeType . symbol . tsPlusDeclaration . symbol ;
187+ else if ( isTsPlusTypeWithDeclaration ( nodeType ) ) {
188+ symbol = nodeType . tsPlusSymbol . tsPlusDeclaration . symbol ;
183189 }
184- }
185- else if ( isTsPlusTypeWithDeclaration ( nodeType ) ) {
186- symbol = nodeType . tsPlusSymbol . tsPlusDeclaration . symbol ;
187- }
188- else {
189- const type = typeChecker . getTypeAtLocation ( parent . expression ) ;
190- const extensions = typeChecker . getExtensions ( parent . expression ) ;
191-
192- if ( extensions ) {
193- const name = parent . name . escapedText . toString ( ) ;
194- const staticValueSymbol = typeChecker . getStaticExtension ( type , name ) ;
195- if ( staticValueSymbol ) {
196- // If execution gets here, it means we have a static variable extension,
197- // which needs to be treated a little differently
198- const declaration = staticValueSymbol . patched . valueDeclaration ;
199- if ( declaration && declaration . original ) {
200- symbol = ( declaration . original as Declaration ) . symbol ;
190+ else {
191+ const type = typeChecker . getTypeAtLocation ( parent . expression ) ;
192+ const extensions = typeChecker . getExtensions ( parent . expression ) ;
193+
194+ if ( extensions ) {
195+ const name = parent . name . escapedText . toString ( ) ;
196+ const staticValueSymbol = typeChecker . getStaticExtension ( type , name ) ;
197+ if ( staticValueSymbol ) {
198+ // If execution gets here, it means we have a static variable extension,
199+ // which needs to be treated a little differently
200+ const declaration = staticValueSymbol . patched . valueDeclaration ;
201+ if ( declaration && declaration . original ) {
202+ symbol = ( declaration . original as Declaration ) . symbol ;
203+ }
204+ } else {
205+ symbol = extensions . get ( name ) ;
201206 }
202- } else {
203- symbol = extensions . get ( name ) ;
204207 }
205208 }
206- }
207209
208- if ( ! symbol ) {
209- symbol = typeChecker . getNodeLinks ( node . parent ) . tsPlusSymbol
210- }
211- }
212- else if ( isBinaryOperatorToken ( node ) && isBinaryExpression ( parent ) ) {
213- const extension = typeChecker . getResolvedOperator ( parent ) ;
214- if ( extension && extension . declaration ) {
215- if ( isTsPlusSymbol ( extension . declaration . symbol ) && extension . declaration . symbol . tsPlusTag === TsPlusSymbolTag . PipeableDeclaration ) {
216- symbol = extension . declaration . symbol . tsPlusDeclaration . symbol
210+ if ( ! symbol ) {
211+ symbol = typeChecker . getNodeLinks ( node . parent ) . tsPlusSymbol
217212 }
218- else {
219- symbol = extension . declaration . symbol ;
213+ }
214+ else if ( isBinaryOperatorToken ( node ) && isBinaryExpression ( parent ) ) {
215+ const extension = typeChecker . getResolvedOperator ( parent ) ;
216+ if ( extension && extension . declaration ) {
217+ if ( isTsPlusSymbol ( extension . declaration . symbol ) && extension . declaration . symbol . tsPlusTag === TsPlusSymbolTag . PipeableDeclaration ) {
218+ symbol = extension . declaration . symbol . tsPlusDeclaration . symbol
219+ }
220+ else {
221+ symbol = extension . declaration . symbol ;
222+ }
220223 }
221224 }
222225 }
0 commit comments