Clean up per CR comments

This commit is contained in:
Mine Yalcinalp Starks 2016-12-12 13:51:43 -08:00
parent 5130e95008
commit d7c4001b2b
5 changed files with 16 additions and 25 deletions

View File

@ -853,11 +853,7 @@ namespace ts.server {
if (simplifiedResult) {
const displayString = ts.displayPartsToString(quickInfo.displayParts);
const docString = ts.displayPartsToString(quickInfo.documentation);
let tags: ts.JSDocTagInfo[] = [];
if (quickInfo.tags) {
tags = quickInfo.tags;
}
return {
kind: quickInfo.kind,
kindModifiers: quickInfo.kindModifiers,
@ -865,7 +861,7 @@ namespace ts.server {
end: scriptInfo.positionToLineOffset(ts.textSpanEnd(quickInfo.textSpan)),
displayString: displayString,
documentation: docString,
tags: tags
tags: quickInfo.tags || []
};
}
else {

View File

@ -759,14 +759,14 @@ namespace ts.Completions {
const symbol = forEach(symbols, s => getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location) === entryName ? s : undefined);
if (symbol) {
const { displayParts, documentation, symbolKind, jsDocTags } = SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, SemanticMeaning.All);
const { displayParts, documentation, symbolKind, tags } = SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, SemanticMeaning.All);
return {
name: entryName,
kindModifiers: SymbolDisplay.getSymbolModifiers(symbol),
kind: symbolKind,
displayParts,
documentation,
tags: jsDocTags
tags
};
}
}

View File

@ -76,19 +76,14 @@ namespace ts.JsDoc {
if (!jsDocs) {
return;
}
const jsDocTags: JSDocTag[] = [];
jsDocs.forEach(doc => {
for (const doc of jsDocs) {
const tagsForDoc = (doc as JSDoc).tags;
if (tagsForDoc) {
jsDocTags.push(...tagsForDoc.filter(tag => tag.kind === SyntaxKind.JSDocTag));
}
});
if (!jsDocTags) {
return;
}
for (const tag of jsDocTags) {
if (tag) {
tags.push({ name: tag.tagName.text, text: tag.comment });
tags.push(...tagsForDoc.filter(tag => tag.kind === SyntaxKind.JSDocTag).map(jsDocTag => {
return {
name: jsDocTag.tagName.text,
text: jsDocTag.comment
} }));
}
}
});

View File

@ -1355,7 +1355,7 @@ namespace ts {
textSpan: createTextSpan(node.getStart(), node.getWidth()),
displayParts: displayPartsDocumentationsAndKind.displayParts,
documentation: displayPartsDocumentationsAndKind.documentation,
tags: displayPartsDocumentationsAndKind.jsDocTags
tags: displayPartsDocumentationsAndKind.tags
};
}

View File

@ -89,7 +89,7 @@ namespace ts.SymbolDisplay {
const displayParts: SymbolDisplayPart[] = [];
let documentation: SymbolDisplayPart[];
let jsDocTags: JSDocTagInfo[];
let tags: JSDocTagInfo[];
const symbolFlags = symbol.flags;
let symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location);
let hasAddedSymbolInfo: boolean;
@ -408,7 +408,7 @@ namespace ts.SymbolDisplay {
if (!documentation) {
documentation = symbol.getDocumentationComment();
jsDocTags = symbol.getJsDocTags();
tags = symbol.getJsDocTags();
if (documentation.length === 0 && symbol.flags & SymbolFlags.Property) {
// For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo`
// there documentation comments might be attached to the right hand side symbol of their declarations.
@ -425,7 +425,7 @@ namespace ts.SymbolDisplay {
}
documentation = rhsSymbol.getDocumentationComment();
jsDocTags = rhsSymbol.getJsDocTags();
tags = rhsSymbol.getJsDocTags();
if (documentation.length > 0) {
break;
}
@ -434,7 +434,7 @@ namespace ts.SymbolDisplay {
}
}
return { displayParts, documentation, symbolKind, jsDocTags };
return { displayParts, documentation, symbolKind, tags };
function addNewLineIfDisplayPartsExist() {
if (displayParts.length) {
@ -492,7 +492,7 @@ namespace ts.SymbolDisplay {
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
}
documentation = signature.getDocumentationComment();
jsDocTags = signature.getJsDocTags();
tags = signature.getJsDocTags();
}
function writeTypeParametersOfSymbol(symbol: Symbol, enclosingDeclaration: Node) {