Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/services/jsDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ namespace ts.JsDoc {
case SyntaxKind.JSDocParameterTag:
case SyntaxKind.JSDocSeeTag:
const { name } = tag as JSDocTypedefTag | JSDocCallbackTag | JSDocPropertyTag | JSDocParameterTag | JSDocSeeTag;
return name ? withNode(name) : comment === undefined ? undefined : getDisplayPartsFromComment(comment, checker);
return name ? withNode(name)
: comment === undefined ? undefined
: getDisplayPartsFromComment(comment, checker);
default:
return comment === undefined ? undefined : getDisplayPartsFromComment(comment, checker);
}
Expand All @@ -169,9 +171,17 @@ namespace ts.JsDoc {
}

function addComment(s: string) {
return comment
? [namePart(s), spacePart(), ...getDisplayPartsFromComment(comment, checker)]
: [textPart(s)];
if (comment) {
if (s.match(/^https?$/)) {
return [textPart(s), ...getDisplayPartsFromComment(comment, checker)];
}
else {
return [namePart(s), spacePart(), ...getDisplayPartsFromComment(comment, checker)];
}
}
else {
return [textPart(s)];
}
}
}

Expand Down
360 changes: 360 additions & 0 deletions tests/baselines/reference/quickInfoForJSDocWithHttpLinks.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,360 @@
[
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoForJSDocWithHttpLinks.js",
"position": 22,
"name": "1"
},
"quickInfo": {
"kind": "type",
"kindModifiers": "",
"textSpan": {
"start": 22,
"length": 5
},
"displayParts": [
{
"text": "type",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "https",
"kind": "aliasName"
},
{
"text": " ",
"kind": "space"
},
{
"text": "=",
"kind": "operator"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"documentation": [
{
"text": "://wat",
"kind": "text"
}
]
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoForJSDocWithHttpLinks.js",
"position": 88,
"name": "2"
},
"quickInfo": {
"kind": "property",
"kindModifiers": "",
"textSpan": {
"start": 88,
"length": 5
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "https",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"documentation": [
{
"text": "://wass",
"kind": "text"
}
]
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoForJSDocWithHttpLinks.js",
"position": 120,
"name": "3"
},
"quickInfo": {
"kind": "type",
"kindModifiers": "",
"textSpan": {
"start": 120,
"length": 4
},
"displayParts": [
{
"text": "type",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "http",
"kind": "aliasName"
},
{
"text": " ",
"kind": "space"
},
{
"text": "=",
"kind": "operator"
},
{
"text": " ",
"kind": "space"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "=>",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "any",
"kind": "keyword"
}
],
"documentation": [
{
"text": "://vad",
"kind": "text"
}
]
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoForJSDocWithHttpLinks.js",
"position": 164,
"name": "4"
},
"quickInfo": {
"kind": "var",
"kindModifiers": "",
"textSpan": {
"start": 164,
"length": 4
},
"displayParts": [
{
"text": "var",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "see1",
"kind": "localName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "boolean",
"kind": "keyword"
}
],
"documentation": [],
"tags": [
{
"name": "see",
"text": [
{
"text": "https",
"kind": "text"
},
{
"text": "://hvad",
"kind": "text"
}
]
}
]
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoForJSDocWithHttpLinks.js",
"position": 213,
"name": "5"
},
"quickInfo": {
"kind": "var",
"kindModifiers": "",
"textSpan": {
"start": 213,
"length": 4
},
"displayParts": [
{
"text": "var",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "see2",
"kind": "localName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "boolean",
"kind": "keyword"
}
],
"documentation": [],
"tags": [
{
"name": "see",
"text": [
{
"text": "",
"kind": "text"
},
{
"text": "{@link ",
"kind": "link"
},
{
"text": "https://hva",
"kind": "linkText"
},
{
"text": "}",
"kind": "link"
}
]
}
]
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoForJSDocWithHttpLinks.js",
"position": 258,
"name": "6"
},
"quickInfo": {
"kind": "var",
"kindModifiers": "",
"textSpan": {
"start": 258,
"length": 4
},
"displayParts": [
{
"text": "var",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "see3",
"kind": "localName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "boolean",
"kind": "keyword"
}
],
"documentation": [
{
"text": "",
"kind": "text"
},
{
"text": "{@link ",
"kind": "link"
},
{
"text": "https://hvaD",
"kind": "linkText"
},
{
"text": "}",
"kind": "link"
}
]
}
}
]
Loading