mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
committed by
GitHub
parent
0487b38d06
commit
7c10135d9d
@@ -7655,8 +7655,9 @@ namespace ts {
|
||||
indent = 0;
|
||||
break;
|
||||
case SyntaxKind.AtToken:
|
||||
if (state === JSDocState.SavingBackticks || !previousWhitespace && state === JSDocState.SavingComments) {
|
||||
// @ doesn't start a new tag inside ``, and inside a comment, only after whitespace
|
||||
if (state === JSDocState.SavingBackticks
|
||||
|| state === JSDocState.SavingComments && (!previousWhitespace || lookAhead(isNextJSDocTokenWhitespace))) {
|
||||
// @ doesn't start a new tag inside ``, and inside a comment, only after whitespace or not before whitespace
|
||||
comments.push(scanner.getTokenText());
|
||||
break;
|
||||
}
|
||||
@@ -7735,6 +7736,11 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isNextJSDocTokenWhitespace() {
|
||||
const next = nextTokenJSDoc();
|
||||
return next === SyntaxKind.WhitespaceTrivia || next === SyntaxKind.NewLineTrivia;
|
||||
}
|
||||
|
||||
function parseJSDocLink(start: number) {
|
||||
if (!tryParse(parseJSDocLinkPrefix)) {
|
||||
return undefined;
|
||||
|
||||
185
tests/baselines/reference/quickInfoJSDocAtBeforeSpace.baseline
Normal file
185
tests/baselines/reference/quickInfoJSDocAtBeforeSpace.baseline
Normal file
@@ -0,0 +1,185 @@
|
||||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoJSDocAtBeforeSpace.ts",
|
||||
"position": 39,
|
||||
"name": "f"
|
||||
},
|
||||
"quickInfo": {
|
||||
"kind": "function",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 39,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "function",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "f",
|
||||
"kind": "functionName"
|
||||
},
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ":",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "void",
|
||||
"kind": "keyword"
|
||||
}
|
||||
],
|
||||
"documentation": [],
|
||||
"tags": [
|
||||
{
|
||||
"name": "return",
|
||||
"text": [
|
||||
{
|
||||
"text": "Don't @ me",
|
||||
"kind": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoJSDocAtBeforeSpace.ts",
|
||||
"position": 87,
|
||||
"name": "g"
|
||||
},
|
||||
"quickInfo": {
|
||||
"kind": "function",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 87,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "function",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "g",
|
||||
"kind": "functionName"
|
||||
},
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ":",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "void",
|
||||
"kind": "keyword"
|
||||
}
|
||||
],
|
||||
"documentation": [],
|
||||
"tags": [
|
||||
{
|
||||
"name": "return",
|
||||
"text": [
|
||||
{
|
||||
"text": "One final @",
|
||||
"kind": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoJSDocAtBeforeSpace.ts",
|
||||
"position": 148,
|
||||
"name": "h"
|
||||
},
|
||||
"quickInfo": {
|
||||
"kind": "function",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 148,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "function",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "h",
|
||||
"kind": "functionName"
|
||||
},
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ":",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "void",
|
||||
"kind": "keyword"
|
||||
}
|
||||
],
|
||||
"documentation": [],
|
||||
"tags": [
|
||||
{
|
||||
"name": "return",
|
||||
"text": [
|
||||
{
|
||||
"text": "An @\nBut another line",
|
||||
"kind": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
19
tests/cases/fourslash/quickInfoJSDocAtBeforeSpace.ts
Normal file
19
tests/cases/fourslash/quickInfoJSDocAtBeforeSpace.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// /**
|
||||
//// * @return Don't @ me
|
||||
//// */
|
||||
//// function /*f*/f() { }
|
||||
//// /**
|
||||
//// * @return One final @
|
||||
//// */
|
||||
//// function /*g*/g() { }
|
||||
//// /**
|
||||
//// * @return An @
|
||||
//// * But another line
|
||||
//// */
|
||||
//// function /*h*/h() { }
|
||||
|
||||
|
||||
verify.baselineQuickInfo()
|
||||
|
||||
Reference in New Issue
Block a user