Skip to content

Commit 808dfd5

Browse files
committed
Format code
1 parent c60d510 commit 808dfd5

File tree

3 files changed

+23
-32
lines changed

3 files changed

+23
-32
lines changed

snapshots/input/syntax/src/constructor.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
// export class Constructor {
2-
// constructor(public readonly property: number) {}
3-
// }
4-
51
namespace Yay {
62
export class SuperConstructor {
7-
constructor(public readonly property: number) {
8-
}
3+
constructor(public readonly property: number) {}
94
}
105

116
export namespace Woo {
@@ -16,8 +11,7 @@ namespace Yay {
1611
}
1712

1813
export class SuperConstructor2 {
19-
constructor(public readonly property: number) {
20-
}
14+
constructor(public readonly property: number) {}
2115
}
2216

2317
export function useConstructor(): Yay.SuperConstructor {

snapshots/output/syntax/src/constructor.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
// export class Constructor {
1+
namespace Yay {
22
// definition syntax 1.0.0 src/`constructor.ts`/
33
//documentation ```ts\nmodule "constructor.ts"\n```
4-
// constructor(public readonly property: number) {}
5-
// }
6-
7-
namespace Yay {
84
// ^^^ definition syntax 1.0.0 src/`constructor.ts`/Yay/
95
// documentation ```ts\nYay: typeof Yay\n```
106
export class SuperConstructor {
117
// ^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`constructor.ts`/Yay/SuperConstructor#
128
// documentation ```ts\nclass SuperConstructor\n```
13-
constructor(public readonly property: number) {
9+
constructor(public readonly property: number) {}
1410
// ^^^^^^^^^^^ definition syntax 1.0.0 src/`constructor.ts`/Yay/SuperConstructor#`<constructor>`().
1511
// documentation ```ts\nconstructor(property: number): SuperConstructor\n```
1612
// ^^^^^^^^ definition syntax 1.0.0 src/`constructor.ts`/Yay/SuperConstructor#`<constructor>`().(property)
1713
// documentation ```ts\n(property) property: number\n```
18-
}
1914
}
2015

2116
export namespace Woo {
@@ -34,12 +29,11 @@
3429
export class SuperConstructor2 {
3530
// ^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`constructor.ts`/SuperConstructor2#
3631
// documentation ```ts\nclass SuperConstructor2\n```
37-
constructor(public readonly property: number) {
32+
constructor(public readonly property: number) {}
3833
// ^^^^^^^^^^^ definition syntax 1.0.0 src/`constructor.ts`/SuperConstructor2#`<constructor>`().
3934
// documentation ```ts\nconstructor(property: number): SuperConstructor2\n```
4035
// ^^^^^^^^ definition syntax 1.0.0 src/`constructor.ts`/SuperConstructor2#`<constructor>`().(property)
4136
// documentation ```ts\n(property) property: number\n```
42-
}
4337
}
4438

4539
export function useConstructor(): Yay.SuperConstructor {

src/FileIndexer.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class FileIndexer {
7777
this.visitSymbolOccurrence(node, sym)
7878
}
7979
}
80-
80+
8181
ts.forEachChild(node, node => this.visit(node))
8282
}
8383

@@ -117,7 +117,9 @@ export class FileIndexer {
117117
if (isDefinitionNode) {
118118
role |= scip.scip.SymbolRole.Definition
119119
}
120-
const declarations = ts.isConstructorDeclaration(node) ? [node] : isDefinitionNode
120+
const declarations = ts.isConstructorDeclaration(node)
121+
? [node]
122+
: isDefinitionNode
121123
? // Don't emit ambiguous definition at definition-site. You can reproduce
122124
// ambiguous results by triggering "Go to definition" in VS Code on `Conflict`
123125
// in the example below:
@@ -131,19 +133,15 @@ export class FileIndexer {
131133
let scipSymbol = this.scipSymbol(declaration)
132134

133135
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))) &&
144139
ts.isClassDeclaration(declaration)
145140
) {
146-
scipSymbol = ScipSymbol.global(scipSymbol, methodDescriptor("<constructor>"))
141+
scipSymbol = ScipSymbol.global(
142+
scipSymbol,
143+
methodDescriptor('<constructor>')
144+
)
147145
}
148146

149147
if (scipSymbol.isEmpty()) {
@@ -491,7 +489,10 @@ export class FileIndexer {
491489
return undefined
492490
}
493491

494-
private asSignatureDeclaration(node: ts.Node, sym: ts.Symbol): ts.SignatureDeclaration | undefined {
492+
private asSignatureDeclaration(
493+
node: ts.Node,
494+
sym: ts.Symbol
495+
): ts.SignatureDeclaration | undefined {
495496
const declaration = sym.declarations?.[0]
496497
if (!declaration) {
497498
return undefined
@@ -798,5 +799,7 @@ function declarationName(node: ts.Node): ts.Node | undefined {
798799
* ^^^^^^^^^^^^^^^^^^^^^ node.parent
799800
*/
800801
function isDefinition(node: ts.Node): boolean {
801-
return declarationName(node.parent) === node || ts.isConstructorDeclaration(node)
802+
return (
803+
declarationName(node.parent) === node || ts.isConstructorDeclaration(node)
804+
)
802805
}

0 commit comments

Comments
 (0)