Skip to content

Commit 46fb1c3

Browse files
committed
fix
1 parent 8f93a48 commit 46fb1c3

File tree

3 files changed

+305
-3
lines changed

3 files changed

+305
-3
lines changed

src/services/services.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,13 +643,12 @@ namespace ts {
643643
}
644644

645645
function findBaseOfDeclaration<T>(checker: TypeChecker, declaration: Declaration, cb: (symbol: Symbol) => T[] | undefined): T[] | undefined {
646-
if (hasStaticModifier(declaration)) return;
647-
648646
const classOrInterfaceDeclaration = declaration.parent?.kind === SyntaxKind.Constructor ? declaration.parent.parent : declaration.parent;
649647
if (!classOrInterfaceDeclaration) return;
650648

649+
const isStaticMember = hasStaticModifier(declaration);
651650
return firstDefined(getAllSuperTypeNodes(classOrInterfaceDeclaration), superTypeNode => {
652-
if (declaration.modifiers?.some(modifier => modifier.kind === SyntaxKind.StaticKeyword)) {
651+
if (isStaticMember) {
653652
// For nodes like `class Foo extends Bar {}`, superTypeNode refers to an ExpressionWithTypeArguments with its expression being `Bar`.
654653
const baseClassSymbol = checker.getSymbolAtLocation(isExpressionWithTypeArguments(superTypeNode) && !superTypeNode.typeArguments?.length ? superTypeNode.expression : superTypeNode);
655654
const symbol = baseClassSymbol?.declarations?.[0] && checker.getPropertyOfType(checker.getTypeOfSymbolAtLocation(baseClassSymbol, baseClassSymbol.declarations[0]), declaration.symbol.name);
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
[
2+
{
3+
"marker": {
4+
"fileName": "/tests/cases/fourslash/quickInfoJsDocTags7.ts",
5+
"position": 629,
6+
"name": "1"
7+
},
8+
"quickInfo": {
9+
"kind": "method",
10+
"kindModifiers": "public,static",
11+
"textSpan": {
12+
"start": 629,
13+
"length": 17
14+
},
15+
"displayParts": [
16+
{
17+
"text": "(",
18+
"kind": "punctuation"
19+
},
20+
{
21+
"text": "method",
22+
"kind": "text"
23+
},
24+
{
25+
"text": ")",
26+
"kind": "punctuation"
27+
},
28+
{
29+
"text": " ",
30+
"kind": "space"
31+
},
32+
{
33+
"text": "SubClass",
34+
"kind": "className"
35+
},
36+
{
37+
"text": ".",
38+
"kind": "punctuation"
39+
},
40+
{
41+
"text": "doSomethingUseful",
42+
"kind": "methodName"
43+
},
44+
{
45+
"text": "(",
46+
"kind": "punctuation"
47+
},
48+
{
49+
"text": "mySpecificStuff",
50+
"kind": "parameterName"
51+
},
52+
{
53+
"text": "?",
54+
"kind": "punctuation"
55+
},
56+
{
57+
"text": ":",
58+
"kind": "punctuation"
59+
},
60+
{
61+
"text": " ",
62+
"kind": "space"
63+
},
64+
{
65+
"text": "{",
66+
"kind": "punctuation"
67+
},
68+
{
69+
"text": "\n",
70+
"kind": "lineBreak"
71+
},
72+
{
73+
"text": " ",
74+
"kind": "space"
75+
},
76+
{
77+
"text": "tiger",
78+
"kind": "propertyName"
79+
},
80+
{
81+
"text": ":",
82+
"kind": "punctuation"
83+
},
84+
{
85+
"text": " ",
86+
"kind": "space"
87+
},
88+
{
89+
"text": "string",
90+
"kind": "keyword"
91+
},
92+
{
93+
"text": ";",
94+
"kind": "punctuation"
95+
},
96+
{
97+
"text": "\n",
98+
"kind": "lineBreak"
99+
},
100+
{
101+
"text": " ",
102+
"kind": "space"
103+
},
104+
{
105+
"text": "lion",
106+
"kind": "propertyName"
107+
},
108+
{
109+
"text": ":",
110+
"kind": "punctuation"
111+
},
112+
{
113+
"text": " ",
114+
"kind": "space"
115+
},
116+
{
117+
"text": "string",
118+
"kind": "keyword"
119+
},
120+
{
121+
"text": ";",
122+
"kind": "punctuation"
123+
},
124+
{
125+
"text": "\n",
126+
"kind": "lineBreak"
127+
},
128+
{
129+
"text": "}",
130+
"kind": "punctuation"
131+
},
132+
{
133+
"text": ")",
134+
"kind": "punctuation"
135+
},
136+
{
137+
"text": ":",
138+
"kind": "punctuation"
139+
},
140+
{
141+
"text": " ",
142+
"kind": "space"
143+
},
144+
{
145+
"text": "string",
146+
"kind": "keyword"
147+
}
148+
],
149+
"documentation": [
150+
{
151+
"text": "Useful description always applicable",
152+
"kind": "text"
153+
}
154+
],
155+
"tags": [
156+
{
157+
"name": "returns",
158+
"text": [
159+
{
160+
"text": "Useful description of return value always applicable.",
161+
"kind": "text"
162+
}
163+
]
164+
},
165+
{
166+
"name": "inheritDoc"
167+
},
168+
{
169+
"name": "param",
170+
"text": [
171+
{
172+
"text": "mySpecificStuff",
173+
"kind": "parameterName"
174+
},
175+
{
176+
"text": " ",
177+
"kind": "space"
178+
},
179+
{
180+
"text": "Description of my specific parameter.",
181+
"kind": "text"
182+
}
183+
]
184+
}
185+
]
186+
}
187+
},
188+
{
189+
"marker": {
190+
"fileName": "/tests/cases/fourslash/quickInfoJsDocTags7.ts",
191+
"position": 869,
192+
"name": "2"
193+
},
194+
"quickInfo": {
195+
"kind": "property",
196+
"kindModifiers": "public,static",
197+
"textSpan": {
198+
"start": 869,
199+
"length": 12
200+
},
201+
"displayParts": [
202+
{
203+
"text": "(",
204+
"kind": "punctuation"
205+
},
206+
{
207+
"text": "property",
208+
"kind": "text"
209+
},
210+
{
211+
"text": ")",
212+
"kind": "punctuation"
213+
},
214+
{
215+
"text": " ",
216+
"kind": "space"
217+
},
218+
{
219+
"text": "SubClass",
220+
"kind": "className"
221+
},
222+
{
223+
"text": ".",
224+
"kind": "punctuation"
225+
},
226+
{
227+
"text": "someProperty",
228+
"kind": "propertyName"
229+
},
230+
{
231+
"text": ":",
232+
"kind": "punctuation"
233+
},
234+
{
235+
"text": " ",
236+
"kind": "space"
237+
},
238+
{
239+
"text": "string",
240+
"kind": "keyword"
241+
}
242+
],
243+
"documentation": [
244+
{
245+
"text": "Applicable description always.",
246+
"kind": "text"
247+
}
248+
],
249+
"tags": [
250+
{
251+
"name": "inheritDoc"
252+
}
253+
]
254+
}
255+
}
256+
]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @noEmit: true
4+
// @allowJs: true
5+
6+
// @Filename: quickInfoJsDocTags7.ts
7+
////abstract class BaseClass {
8+
//// /**
9+
//// * Useful description always applicable
10+
//// *
11+
//// * @returns {string} Useful description of return value always applicable.
12+
//// */
13+
//// public static doSomethingUseful(stuff?: any): string {
14+
//// throw new Error('Must be implemented by subclass');
15+
//// }
16+
////
17+
//// /**
18+
//// * Applicable description always.
19+
//// */
20+
//// public static readonly someProperty: string = 'general value';
21+
////}
22+
////
23+
////
24+
////
25+
////
26+
////class SubClass extends BaseClass {
27+
////
28+
//// /**
29+
//// * @inheritDoc
30+
//// *
31+
//// * @param {{ tiger: string; lion: string; }} [mySpecificStuff] Description of my specific parameter.
32+
//// */
33+
//// public static /*1*/doSomethingUseful(mySpecificStuff?: { tiger: string; lion: string; }): string {
34+
//// let useful = '';
35+
////
36+
//// // do something useful to useful
37+
////
38+
//// return useful;
39+
//// }
40+
////
41+
//// /**
42+
//// * @inheritDoc
43+
//// */
44+
//// public static readonly /*2*/someProperty: string = 'specific to this class value'
45+
////}
46+
47+
verify.baselineQuickInfo();

0 commit comments

Comments
 (0)