Skip to content

Commit 154d25c

Browse files
committed
Update LKG
1 parent 57913d2 commit 154d25c

File tree

9 files changed

+265
-33
lines changed

9 files changed

+265
-33
lines changed

lib/protocol.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,10 @@ declare namespace ts.server.protocol {
973973
* Documentation associated with symbol.
974974
*/
975975
documentation: string;
976+
/**
977+
* JSDoc tags associated with symbol.
978+
*/
979+
tags: JSDocTagInfo[];
976980
}
977981
/**
978982
* Quickinfo response message.
@@ -1174,6 +1178,10 @@ declare namespace ts.server.protocol {
11741178
* Documentation strings for the symbol.
11751179
*/
11761180
documentation: SymbolDisplayPart[];
1181+
/**
1182+
* JSDoc tags for the symbol.
1183+
*/
1184+
tags: JSDocTagInfo[];
11771185
}
11781186
interface CompletionsResponse extends Response {
11791187
body?: CompletionEntry[];
@@ -1230,6 +1238,10 @@ declare namespace ts.server.protocol {
12301238
* The signature's documentation
12311239
*/
12321240
documentation: SymbolDisplayPart[];
1241+
/**
1242+
* The signature's JSDoc tags
1243+
*/
1244+
tags: JSDocTagInfo[];
12331245
}
12341246
/**
12351247
* Signature help items found in the response of a signature help request.
@@ -1891,6 +1903,11 @@ declare namespace ts.server.protocol {
18911903
isMixedContent: boolean;
18921904
}
18931905

1906+
interface JSDocTagInfo {
1907+
name: string;
1908+
text?: string;
1909+
}
1910+
18941911
/**
18951912
* Type of objects whose values are all of the same type.
18961913
* The `in` and `for-in` operators can *not* be safely used,

lib/tsc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6243,6 +6243,7 @@ var ts;
62436243
cache = ts.concatenate(cache, node.jsDoc);
62446244
}
62456245
}
6246+
ts.getJSDocs = getJSDocs;
62466247
function getJSDocParameterTags(param) {
62476248
if (!isParameter(param)) {
62486249
return undefined;
@@ -16627,7 +16628,7 @@ var ts;
1662716628
}
1662816629
function parseTagComments(indent) {
1662916630
var comments = [];
16630-
var state = 1;
16631+
var state = 0;
1663116632
var margin;
1663216633
function pushComment(text) {
1663316634
if (!margin) {

lib/tsserver.js

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6417,6 +6417,7 @@ var ts;
64176417
cache = ts.concatenate(cache, node.jsDoc);
64186418
}
64196419
}
6420+
ts.getJSDocs = getJSDocs;
64206421
function getJSDocParameterTags(param) {
64216422
if (!isParameter(param)) {
64226423
return undefined;
@@ -18434,7 +18435,7 @@ var ts;
1843418435
}
1843518436
function parseTagComments(indent) {
1843618437
var comments = [];
18437-
var state = 1;
18438+
var state = 0;
1843818439
var margin;
1843918440
function pushComment(text) {
1844018441
if (!margin) {
@@ -60253,13 +60254,14 @@ var ts;
6025360254
var symbols = completionData.symbols, location_1 = completionData.location;
6025460255
var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_1) === entryName ? s : undefined; });
6025560256
if (symbol) {
60256-
var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
60257+
var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags;
6025760258
return {
6025860259
name: entryName,
6025960260
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
6026060261
kind: symbolKind,
6026160262
displayParts: displayParts,
60262-
documentation: documentation
60263+
documentation: documentation,
60264+
tags: tags
6026360265
};
6026460266
}
6026560267
}
@@ -60270,7 +60272,8 @@ var ts;
6027060272
kind: ts.ScriptElementKind.keyword,
6027160273
kindModifiers: ts.ScriptElementKindModifier.none,
6027260274
displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)],
60273-
documentation: undefined
60275+
documentation: undefined,
60276+
tags: undefined
6027460277
};
6027560278
}
6027660279
return undefined;
@@ -62939,6 +62942,29 @@ var ts;
6293962942
return documentationComment;
6294062943
}
6294162944
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
62945+
function getJsDocTagsFromDeclarations(declarations) {
62946+
var tags = [];
62947+
forEachUnique(declarations, function (declaration) {
62948+
var jsDocs = ts.getJSDocs(declaration);
62949+
if (!jsDocs) {
62950+
return;
62951+
}
62952+
for (var _i = 0, jsDocs_1 = jsDocs; _i < jsDocs_1.length; _i++) {
62953+
var doc = jsDocs_1[_i];
62954+
var tagsForDoc = doc.tags;
62955+
if (tagsForDoc) {
62956+
tags.push.apply(tags, tagsForDoc.filter(function (tag) { return tag.kind === 283; }).map(function (jsDocTag) {
62957+
return {
62958+
name: jsDocTag.tagName.text,
62959+
text: jsDocTag.comment
62960+
};
62961+
}));
62962+
}
62963+
}
62964+
});
62965+
return tags;
62966+
}
62967+
JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations;
6294262968
function forEachUnique(array, callback) {
6294362969
if (array) {
6294462970
for (var i = 0; i < array.length; i++) {
@@ -65130,7 +65156,8 @@ var ts;
6513065156
suffixDisplayParts: suffixDisplayParts,
6513165157
separatorDisplayParts: [ts.punctuationPart(25), ts.spacePart()],
6513265158
parameters: signatureHelpParameters,
65133-
documentation: candidateSignature.getDocumentationComment()
65159+
documentation: candidateSignature.getDocumentationComment(),
65160+
tags: candidateSignature.getJsDocTags()
6513465161
};
6513565162
});
6513665163
var argumentIndex = argumentListInfo.argumentIndex;
@@ -65271,6 +65298,7 @@ var ts;
6527165298
if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); }
6527265299
var displayParts = [];
6527365300
var documentation;
65301+
var tags;
6527465302
var symbolFlags = symbol.flags;
6527565303
var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location);
6527665304
var hasAddedSymbolInfo;
@@ -65557,6 +65585,7 @@ var ts;
6555765585
}
6555865586
if (!documentation) {
6555965587
documentation = symbol.getDocumentationComment();
65588+
tags = symbol.getJsDocTags();
6556065589
if (documentation.length === 0 && symbol.flags & 4) {
6556165590
if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 264; })) {
6556265591
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
@@ -65569,14 +65598,15 @@ var ts;
6556965598
continue;
6557065599
}
6557165600
documentation = rhsSymbol.getDocumentationComment();
65601+
tags = rhsSymbol.getJsDocTags();
6557265602
if (documentation.length > 0) {
6557365603
break;
6557465604
}
6557565605
}
6557665606
}
6557765607
}
6557865608
}
65579-
return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind };
65609+
return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind, tags: tags };
6558065610
function addNewLineIfDisplayPartsExist() {
6558165611
if (displayParts.length) {
6558265612
displayParts.push(ts.lineBreakPart());
@@ -65627,6 +65657,7 @@ var ts;
6562765657
displayParts.push(ts.punctuationPart(19));
6562865658
}
6562965659
documentation = signature.getDocumentationComment();
65660+
tags = signature.getJsDocTags();
6563065661
}
6563165662
function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {
6563265663
var typeParameterParts = ts.mapToDisplayParts(function (writer) {
@@ -70133,6 +70164,12 @@ var ts;
7013370164
}
7013470165
return this.documentationComment;
7013570166
};
70167+
SymbolObject.prototype.getJsDocTags = function () {
70168+
if (this.tags === undefined) {
70169+
this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations);
70170+
}
70171+
return this.tags;
70172+
};
7013670173
return SymbolObject;
7013770174
}());
7013870175
var TokenObject = (function (_super) {
@@ -70216,6 +70253,12 @@ var ts;
7021670253
}
7021770254
return this.documentationComment;
7021870255
};
70256+
SignatureObject.prototype.getJsDocTags = function () {
70257+
if (this.jsDocTags === undefined) {
70258+
this.jsDocTags = this.declaration ? ts.JsDoc.getJsDocTagsFromDeclarations([this.declaration]) : [];
70259+
}
70260+
return this.jsDocTags;
70261+
};
7021970262
return SignatureObject;
7022070263
}());
7022170264
var SourceFileObject = (function (_super) {
@@ -70847,7 +70890,8 @@ var ts;
7084770890
kindModifiers: ts.ScriptElementKindModifier.none,
7084870891
textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),
7084970892
displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)),
70850-
documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined
70893+
documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined,
70894+
tags: type.symbol ? type.symbol.getJsDocTags() : undefined
7085170895
};
7085270896
}
7085370897
}
@@ -70859,7 +70903,8 @@ var ts;
7085970903
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
7086070904
textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),
7086170905
displayParts: displayPartsDocumentationsAndKind.displayParts,
70862-
documentation: displayPartsDocumentationsAndKind.documentation
70906+
documentation: displayPartsDocumentationsAndKind.documentation,
70907+
tags: displayPartsDocumentationsAndKind.tags
7086370908
};
7086470909
}
7086570910
function getDefinitionAtPosition(fileName, position) {
@@ -76212,6 +76257,7 @@ var ts;
7621276257
end: scriptInfo.positionToLineOffset(ts.textSpanEnd(quickInfo.textSpan)),
7621376258
displayString: displayString,
7621476259
documentation: docString,
76260+
tags: quickInfo.tags || []
7621576261
};
7621676262
}
7621776263
else {

lib/tsserverlibrary.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2809,6 +2809,7 @@ declare namespace ts {
28092809
getName(): string;
28102810
getDeclarations(): Declaration[];
28112811
getDocumentationComment(): SymbolDisplayPart[];
2812+
getJsDocTags(): JSDocTagInfo[];
28122813
}
28132814
interface Type {
28142815
getFlags(): TypeFlags;
@@ -2829,6 +2830,7 @@ declare namespace ts {
28292830
getParameters(): Symbol[];
28302831
getReturnType(): Type;
28312832
getDocumentationComment(): SymbolDisplayPart[];
2833+
getJsDocTags(): JSDocTagInfo[];
28322834
}
28332835
interface SourceFile {
28342836
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
@@ -3119,12 +3121,17 @@ declare namespace ts {
31193121
text: string;
31203122
kind: string;
31213123
}
3124+
interface JSDocTagInfo {
3125+
name: string;
3126+
text?: string;
3127+
}
31223128
interface QuickInfo {
31233129
kind: string;
31243130
kindModifiers: string;
31253131
textSpan: TextSpan;
31263132
displayParts: SymbolDisplayPart[];
31273133
documentation: SymbolDisplayPart[];
3134+
tags: JSDocTagInfo[];
31283135
}
31293136
interface RenameInfo {
31303137
canRename: boolean;
@@ -3148,6 +3155,7 @@ declare namespace ts {
31483155
separatorDisplayParts: SymbolDisplayPart[];
31493156
parameters: SignatureHelpParameter[];
31503157
documentation: SymbolDisplayPart[];
3158+
tags: JSDocTagInfo[];
31513159
}
31523160
interface SignatureHelpItems {
31533161
items: SignatureHelpItem[];
@@ -3175,6 +3183,7 @@ declare namespace ts {
31753183
kindModifiers: string;
31763184
displayParts: SymbolDisplayPart[];
31773185
documentation: SymbolDisplayPart[];
3186+
tags: JSDocTagInfo[];
31783187
}
31793188
interface OutliningSpan {
31803189
textSpan: TextSpan;
@@ -3936,6 +3945,7 @@ declare namespace ts.server.protocol {
39363945
end: Location;
39373946
displayString: string;
39383947
documentation: string;
3948+
tags: JSDocTagInfo[];
39393949
}
39403950
interface QuickInfoResponse extends Response {
39413951
body?: QuickInfoResponseBody;
@@ -4007,6 +4017,7 @@ declare namespace ts.server.protocol {
40074017
kindModifiers: string;
40084018
displayParts: SymbolDisplayPart[];
40094019
documentation: SymbolDisplayPart[];
4020+
tags: JSDocTagInfo[];
40104021
}
40114022
interface CompletionsResponse extends Response {
40124023
body?: CompletionEntry[];
@@ -4027,6 +4038,7 @@ declare namespace ts.server.protocol {
40274038
separatorDisplayParts: SymbolDisplayPart[];
40284039
parameters: SignatureHelpParameter[];
40294040
documentation: SymbolDisplayPart[];
4041+
tags: JSDocTagInfo[];
40304042
}
40314043
interface SignatureHelpItems {
40324044
items: SignatureHelpItem[];

0 commit comments

Comments
 (0)