Update LKG

This commit is contained in:
Mohamed Hegazy
2017-04-04 14:47:47 -07:00
parent 57913d2e2a
commit 154d25c5fa
9 changed files with 265 additions and 33 deletions
+54 -8
View File
@@ -8043,6 +8043,7 @@ var ts;
cache = ts.concatenate(cache, node.jsDoc);
}
}
ts.getJSDocs = getJSDocs;
function getJSDocParameterTags(param) {
if (!isParameter(param)) {
return undefined;
@@ -20403,7 +20404,7 @@ var ts;
}
function parseTagComments(indent) {
var comments = [];
var state = 1 /* SawAsterisk */;
var state = 0 /* BeginningOfLine */;
var margin;
function pushComment(text) {
if (!margin) {
@@ -72593,13 +72594,14 @@ var ts;
// completion entry.
var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_1) === entryName ? s : undefined; });
if (symbol) {
var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags;
return {
name: entryName,
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
kind: symbolKind,
displayParts: displayParts,
documentation: documentation
documentation: documentation,
tags: tags
};
}
}
@@ -72611,7 +72613,8 @@ var ts;
kind: ts.ScriptElementKind.keyword,
kindModifiers: ts.ScriptElementKindModifier.none,
displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)],
documentation: undefined
documentation: undefined,
tags: undefined
};
}
return undefined;
@@ -75815,6 +75818,30 @@ var ts;
return documentationComment;
}
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
function getJsDocTagsFromDeclarations(declarations) {
// Only collect doc comments from duplicate declarations once.
var tags = [];
forEachUnique(declarations, function (declaration) {
var jsDocs = ts.getJSDocs(declaration);
if (!jsDocs) {
return;
}
for (var _i = 0, jsDocs_1 = jsDocs; _i < jsDocs_1.length; _i++) {
var doc = jsDocs_1[_i];
var tagsForDoc = doc.tags;
if (tagsForDoc) {
tags.push.apply(tags, tagsForDoc.filter(function (tag) { return tag.kind === 283 /* JSDocTag */; }).map(function (jsDocTag) {
return {
name: jsDocTag.tagName.text,
text: jsDocTag.comment
};
}));
}
}
});
return tags;
}
JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations;
/**
* Iterates through 'array' by index and performs the callback on each element of array until the callback
* returns a truthy value, then returns that value.
@@ -78634,7 +78661,8 @@ var ts;
suffixDisplayParts: suffixDisplayParts,
separatorDisplayParts: [ts.punctuationPart(25 /* CommaToken */), ts.spacePart()],
parameters: signatureHelpParameters,
documentation: candidateSignature.getDocumentationComment()
documentation: candidateSignature.getDocumentationComment(),
tags: candidateSignature.getJsDocTags()
};
});
var argumentIndex = argumentListInfo.argumentIndex;
@@ -78782,6 +78810,7 @@ var ts;
if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); }
var displayParts = [];
var documentation;
var tags;
var symbolFlags = symbol.flags;
var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location);
var hasAddedSymbolInfo;
@@ -79092,6 +79121,7 @@ var ts;
}
if (!documentation) {
documentation = symbol.getDocumentationComment();
tags = symbol.getJsDocTags();
if (documentation.length === 0 && symbol.flags & 4 /* Property */) {
// For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo`
// there documentation comments might be attached to the right hand side symbol of their declarations.
@@ -79107,6 +79137,7 @@ var ts;
continue;
}
documentation = rhsSymbol.getDocumentationComment();
tags = rhsSymbol.getJsDocTags();
if (documentation.length > 0) {
break;
}
@@ -79114,7 +79145,7 @@ var ts;
}
}
}
return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind };
return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind, tags: tags };
function addNewLineIfDisplayPartsExist() {
if (displayParts.length) {
displayParts.push(ts.lineBreakPart());
@@ -79165,6 +79196,7 @@ var ts;
displayParts.push(ts.punctuationPart(19 /* CloseParenToken */));
}
documentation = signature.getDocumentationComment();
tags = signature.getJsDocTags();
}
function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {
var typeParameterParts = ts.mapToDisplayParts(function (writer) {
@@ -84399,6 +84431,12 @@ var ts;
}
return this.documentationComment;
};
SymbolObject.prototype.getJsDocTags = function () {
if (this.tags === undefined) {
this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations);
}
return this.tags;
};
return SymbolObject;
}());
var TokenObject = (function (_super) {
@@ -84482,6 +84520,12 @@ var ts;
}
return this.documentationComment;
};
SignatureObject.prototype.getJsDocTags = function () {
if (this.jsDocTags === undefined) {
this.jsDocTags = this.declaration ? ts.JsDoc.getJsDocTagsFromDeclarations([this.declaration]) : [];
}
return this.jsDocTags;
};
return SignatureObject;
}());
var SourceFileObject = (function (_super) {
@@ -85221,7 +85265,8 @@ var ts;
kindModifiers: ts.ScriptElementKindModifier.none,
textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),
displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)),
documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined
documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined,
tags: type.symbol ? type.symbol.getJsDocTags() : undefined
};
}
}
@@ -85233,7 +85278,8 @@ var ts;
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),
displayParts: displayPartsDocumentationsAndKind.displayParts,
documentation: displayPartsDocumentationsAndKind.documentation
documentation: displayPartsDocumentationsAndKind.documentation,
tags: displayPartsDocumentationsAndKind.tags
};
}
/// Goto definition