fixed the comments

This commit is contained in:
rpgeeganage 2019-05-06 21:21:37 +02:00
parent ca749b107c
commit 8f209be149
5 changed files with 17 additions and 418 deletions

View File

@ -1467,7 +1467,7 @@ namespace ts {
}
const typeChecker = program.getTypeChecker();
const nodeForQuickInfo = getNodeForQuickInfo(node, typeChecker);
const nodeForQuickInfo = getNodeForQuickInfo(node);
const symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker);
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
@ -1495,17 +1495,9 @@ namespace ts {
};
}
function getNodeForQuickInfo(node: Node, typeChecker: TypeChecker): Node {
const firstParentNode = node.parent.getFirstToken();
const firstNodeSyntaxKind = firstParentNode ? firstParentNode.kind : undefined;
if (node.kind === SyntaxKind.NewKeyword || firstNodeSyntaxKind === SyntaxKind.NewKeyword) {
for (const singleNode of node.parent.getChildren()) {
const symbol = getSymbolAtLocationForQuickInfo(singleNode, typeChecker);
if (symbol) {
return singleNode;
}
}
function getNodeForQuickInfo(node: Node): Node {
if (isNewExpression(node.parent) && node.pos === node.parent.pos) {
return node.parent.expression;
}
return node;
}

View File

@ -79,76 +79,6 @@
"marker": {
"fileName": "/tests/cases/fourslash/jsDocTags.ts",
"position": 981
},
"quickInfo": {
"kind": "constructor",
"kindModifiers": "",
"textSpan": {
"start": 977,
"length": 3
},
"displayParts": [
{
"text": "constructor",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "Foo",
"kind": "className"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "value",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "Foo",
"kind": "className"
}
],
"documentation": [
{
"text": "This is the constructor.",
"kind": "text"
}
],
"tags": [
{
"name": "myjsdoctag",
"text": "this is a comment"
}
]
}
},
{

View File

@ -2991,15 +2991,15 @@
"position": 337
},
"quickInfo": {
"kind": "constructor",
"kind": "var",
"kindModifiers": "",
"textSpan": {
"start": 334,
"length": 2
"start": 337,
"length": 9
},
"displayParts": [
{
"text": "constructor",
"text": "var",
"kind": "keyword"
},
{
@ -3007,40 +3007,8 @@
"kind": "space"
},
{
"text": "c2",
"kind": "className"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "c",
"kind": "className"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "a",
"kind": "parameterName"
"text": "cInstance",
"kind": "localName"
},
{
"text": ":",
@ -3062,46 +3030,6 @@
"text": "string",
"kind": "keyword"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "c2",
"kind": "className"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "c",
"kind": "className"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": ">",
"kind": "punctuation"

View File

@ -5568,8 +5568,8 @@
"kind": "var",
"kindModifiers": "",
"textSpan": {
"start": 409,
"length": 5
"start": 415,
"length": 4
},
"displayParts": [
{
@ -5581,7 +5581,7 @@
"kind": "space"
},
{
"text": "iVal1",
"text": "iVal",
"kind": "localName"
},
{
@ -5592,130 +5592,6 @@
"text": " ",
"kind": "space"
},
{
"text": "I1",
"kind": "interfaceName"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "new",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "I",
"kind": "interfaceName"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "a",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "I",
"kind": "interfaceName"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": ",",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "I",
"kind": "interfaceName"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "=>",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "I",
"kind": "interfaceName"
@ -5745,8 +5621,8 @@
"kind": "var",
"kindModifiers": "",
"textSpan": {
"start": 409,
"length": 5
"start": 421,
"length": 4
},
"displayParts": [
{
@ -5758,7 +5634,7 @@
"kind": "space"
},
{
"text": "iVal1",
"text": "iVal",
"kind": "localName"
},
{
@ -5769,130 +5645,6 @@
"text": " ",
"kind": "space"
},
{
"text": "I1",
"kind": "interfaceName"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "new",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "I",
"kind": "interfaceName"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "a",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "I",
"kind": "interfaceName"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": ",",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "I",
"kind": "interfaceName"
},
{
"text": "<",
"kind": "punctuation"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ">",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "=>",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "I",
"kind": "interfaceName"

View File

@ -9,13 +9,10 @@
//// static makeCat() { new Cat(); }
////}
////
////ne/*1*/w Ca/*2*/t(/*3*/);
////ne/*1*/w Ca/*2*/t();
verify.quickInfoAt('1', 'constructor Cat(): Cat',
'NOTE: this constructor is private! Please use the factory function');
verify.quickInfoAt('2', 'constructor Cat(): Cat',
'NOTE: this constructor is private! Please use the factory function');
verify.quickInfoAt('3', 'constructor Cat(): Cat',
'NOTE: this constructor is private! Please use the factory function');