@@ -77,7 +77,7 @@ export class FileIndexer {
77
77
this . visitSymbolOccurrence ( node , sym )
78
78
}
79
79
}
80
-
80
+
81
81
ts . forEachChild ( node , node => this . visit ( node ) )
82
82
}
83
83
@@ -117,7 +117,9 @@ export class FileIndexer {
117
117
if ( isDefinitionNode ) {
118
118
role |= scip . scip . SymbolRole . Definition
119
119
}
120
- const declarations = ts . isConstructorDeclaration ( node ) ? [ node ] : isDefinitionNode
120
+ const declarations = ts . isConstructorDeclaration ( node )
121
+ ? [ node ]
122
+ : isDefinitionNode
121
123
? // Don't emit ambiguous definition at definition-site. You can reproduce
122
124
// ambiguous results by triggering "Go to definition" in VS Code on `Conflict`
123
125
// in the example below:
@@ -131,19 +133,15 @@ export class FileIndexer {
131
133
let scipSymbol = this . scipSymbol ( declaration )
132
134
133
135
if (
134
- (
135
- (
136
- ts . isIdentifier ( node ) &&
137
- ts . isNewExpression ( node . parent )
138
- ) ||
139
- (
140
- ts . isPropertyAccessExpression ( node . parent ) &&
141
- ts . isNewExpression ( node . parent . parent )
142
- )
143
- ) &&
136
+ ( ( ts . isIdentifier ( node ) && ts . isNewExpression ( node . parent ) ) ||
137
+ ( ts . isPropertyAccessExpression ( node . parent ) &&
138
+ ts . isNewExpression ( node . parent . parent ) ) ) &&
144
139
ts . isClassDeclaration ( declaration )
145
140
) {
146
- scipSymbol = ScipSymbol . global ( scipSymbol , methodDescriptor ( "<constructor>" ) )
141
+ scipSymbol = ScipSymbol . global (
142
+ scipSymbol ,
143
+ methodDescriptor ( '<constructor>' )
144
+ )
147
145
}
148
146
149
147
if ( scipSymbol . isEmpty ( ) ) {
@@ -491,26 +489,28 @@ export class FileIndexer {
491
489
return undefined
492
490
}
493
491
494
- private asSignatureDeclaration ( node : ts . Node , sym : ts . Symbol ) : ts . SignatureDeclaration | undefined {
495
- const declaration = sym . declarations ?. [ 0 ]
496
- if ( ! declaration ) {
497
- return undefined
498
- }
499
- return ts . isConstructorDeclaration ( node )
500
- ? node
501
- : ts . isFunctionDeclaration ( declaration )
502
- ? declaration
503
- : ts . isMethodDeclaration ( declaration )
504
- ? declaration
505
- : undefined
506
- }
507
-
508
492
private signatureForDocumentation ( node : ts . Node , sym : ts . Symbol ) : string {
509
493
const kind = scriptElementKind ( node , sym )
510
494
const type = ( ) : string =>
511
495
this . checker . typeToString ( this . checker . getTypeAtLocation ( node ) )
496
+ const asSignatureDeclaration = (
497
+ node : ts . Node ,
498
+ sym : ts . Symbol
499
+ ) : ts . SignatureDeclaration | undefined => {
500
+ const declaration = sym . declarations ?. [ 0 ]
501
+ if ( ! declaration ) {
502
+ return undefined
503
+ }
504
+ return ts . isConstructorDeclaration ( node )
505
+ ? node
506
+ : ts . isFunctionDeclaration ( declaration )
507
+ ? declaration
508
+ : ts . isMethodDeclaration ( declaration )
509
+ ? declaration
510
+ : undefined
511
+ }
512
512
const signature = ( ) : string | undefined => {
513
- const signatureDeclaration = this . asSignatureDeclaration ( node , sym )
513
+ const signatureDeclaration = asSignatureDeclaration ( node , sym )
514
514
if ( ! signatureDeclaration ) {
515
515
return undefined
516
516
}
@@ -535,7 +535,7 @@ export class FileIndexer {
535
535
case ts . ScriptElementKind . classElement :
536
536
case ts . ScriptElementKind . localClassElement :
537
537
if ( ts . isConstructorDeclaration ( node ) ) {
538
- return 'constructor' + signature ( )
538
+ return 'constructor' + signature ( ) !
539
539
}
540
540
return 'class ' + node . getText ( )
541
541
case ts . ScriptElementKind . interfaceElement :
@@ -798,5 +798,7 @@ function declarationName(node: ts.Node): ts.Node | undefined {
798
798
* ^^^^^^^^^^^^^^^^^^^^^ node.parent
799
799
*/
800
800
function isDefinition ( node : ts . Node ) : boolean {
801
- return declarationName ( node . parent ) === node || ts . isConstructorDeclaration ( node )
801
+ return (
802
+ declarationName ( node . parent ) === node || ts . isConstructorDeclaration ( node )
803
+ )
802
804
}
0 commit comments