Skip to content

Commit 8f209be

Browse files
committed
fixed the comments
1 parent ca749b1 commit 8f209be

File tree

5 files changed

+17
-418
lines changed

5 files changed

+17
-418
lines changed

src/services/services.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ namespace ts {
14671467
}
14681468

14691469
const typeChecker = program.getTypeChecker();
1470-
const nodeForQuickInfo = getNodeForQuickInfo(node, typeChecker);
1470+
const nodeForQuickInfo = getNodeForQuickInfo(node);
14711471
const symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker);
14721472

14731473
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
@@ -1495,17 +1495,9 @@ namespace ts {
14951495
};
14961496
}
14971497

1498-
function getNodeForQuickInfo(node: Node, typeChecker: TypeChecker): Node {
1499-
const firstParentNode = node.parent.getFirstToken();
1500-
const firstNodeSyntaxKind = firstParentNode ? firstParentNode.kind : undefined;
1501-
1502-
if (node.kind === SyntaxKind.NewKeyword || firstNodeSyntaxKind === SyntaxKind.NewKeyword) {
1503-
for (const singleNode of node.parent.getChildren()) {
1504-
const symbol = getSymbolAtLocationForQuickInfo(singleNode, typeChecker);
1505-
if (symbol) {
1506-
return singleNode;
1507-
}
1508-
}
1498+
function getNodeForQuickInfo(node: Node): Node {
1499+
if (isNewExpression(node.parent) && node.pos === node.parent.pos) {
1500+
return node.parent.expression;
15091501
}
15101502
return node;
15111503
}

tests/baselines/reference/jsDocTags.baseline

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -79,76 +79,6 @@
7979
"marker": {
8080
"fileName": "/tests/cases/fourslash/jsDocTags.ts",
8181
"position": 981
82-
},
83-
"quickInfo": {
84-
"kind": "constructor",
85-
"kindModifiers": "",
86-
"textSpan": {
87-
"start": 977,
88-
"length": 3
89-
},
90-
"displayParts": [
91-
{
92-
"text": "constructor",
93-
"kind": "keyword"
94-
},
95-
{
96-
"text": " ",
97-
"kind": "space"
98-
},
99-
{
100-
"text": "Foo",
101-
"kind": "className"
102-
},
103-
{
104-
"text": "(",
105-
"kind": "punctuation"
106-
},
107-
{
108-
"text": "value",
109-
"kind": "parameterName"
110-
},
111-
{
112-
"text": ":",
113-
"kind": "punctuation"
114-
},
115-
{
116-
"text": " ",
117-
"kind": "space"
118-
},
119-
{
120-
"text": "number",
121-
"kind": "keyword"
122-
},
123-
{
124-
"text": ")",
125-
"kind": "punctuation"
126-
},
127-
{
128-
"text": ":",
129-
"kind": "punctuation"
130-
},
131-
{
132-
"text": " ",
133-
"kind": "space"
134-
},
135-
{
136-
"text": "Foo",
137-
"kind": "className"
138-
}
139-
],
140-
"documentation": [
141-
{
142-
"text": "This is the constructor.",
143-
"kind": "text"
144-
}
145-
],
146-
"tags": [
147-
{
148-
"name": "myjsdoctag",
149-
"text": "this is a comment"
150-
}
151-
]
15282
}
15383
},
15484
{

tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,84 +2991,24 @@
29912991
"position": 337
29922992
},
29932993
"quickInfo": {
2994-
"kind": "constructor",
2994+
"kind": "var",
29952995
"kindModifiers": "",
29962996
"textSpan": {
2997-
"start": 334,
2998-
"length": 2
2997+
"start": 337,
2998+
"length": 9
29992999
},
30003000
"displayParts": [
30013001
{
3002-
"text": "constructor",
3002+
"text": "var",
30033003
"kind": "keyword"
30043004
},
30053005
{
30063006
"text": " ",
30073007
"kind": "space"
30083008
},
30093009
{
3010-
"text": "c2",
3011-
"kind": "className"
3012-
},
3013-
{
3014-
"text": "<",
3015-
"kind": "punctuation"
3016-
},
3017-
{
3018-
"text": "c",
3019-
"kind": "className"
3020-
},
3021-
{
3022-
"text": "<",
3023-
"kind": "punctuation"
3024-
},
3025-
{
3026-
"text": "string",
3027-
"kind": "keyword"
3028-
},
3029-
{
3030-
"text": ">",
3031-
"kind": "punctuation"
3032-
},
3033-
{
3034-
"text": ">",
3035-
"kind": "punctuation"
3036-
},
3037-
{
3038-
"text": "(",
3039-
"kind": "punctuation"
3040-
},
3041-
{
3042-
"text": "a",
3043-
"kind": "parameterName"
3044-
},
3045-
{
3046-
"text": ":",
3047-
"kind": "punctuation"
3048-
},
3049-
{
3050-
"text": " ",
3051-
"kind": "space"
3052-
},
3053-
{
3054-
"text": "c",
3055-
"kind": "className"
3056-
},
3057-
{
3058-
"text": "<",
3059-
"kind": "punctuation"
3060-
},
3061-
{
3062-
"text": "string",
3063-
"kind": "keyword"
3064-
},
3065-
{
3066-
"text": ">",
3067-
"kind": "punctuation"
3068-
},
3069-
{
3070-
"text": ")",
3071-
"kind": "punctuation"
3010+
"text": "cInstance",
3011+
"kind": "localName"
30723012
},
30733013
{
30743014
"text": ":",
@@ -3078,14 +3018,6 @@
30783018
"text": " ",
30793019
"kind": "space"
30803020
},
3081-
{
3082-
"text": "c2",
3083-
"kind": "className"
3084-
},
3085-
{
3086-
"text": "<",
3087-
"kind": "punctuation"
3088-
},
30893021
{
30903022
"text": "c",
30913023
"kind": "className"
@@ -3098,10 +3030,6 @@
30983030
"text": "string",
30993031
"kind": "keyword"
31003032
},
3101-
{
3102-
"text": ">",
3103-
"kind": "punctuation"
3104-
},
31053033
{
31063034
"text": ">",
31073035
"kind": "punctuation"

0 commit comments

Comments
 (0)