CR feedback

This commit is contained in:
zhengbli 2015-08-19 16:02:36 -07:00
parent 2a3867a742
commit b16536b60d
2 changed files with 16 additions and 15 deletions

View File

@ -132,7 +132,7 @@ namespace ts {
let emptyArray: any[] = [];
const jsDocTagNames: string[] = [
const jsDocTagNames = [
"augments",
"author",
"argument",
@ -2992,7 +2992,7 @@ namespace ts {
let tagWithExpression = <JSDocTypeTag | JSDocParameterTag>tag;
if (tagWithExpression.typeExpression) {
insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
};
}
break;
}
}

View File

@ -470,26 +470,27 @@ namespace ts {
}
/**
* Get the corresponding JSDocTag node if the position is in a jsDoc commet
* Get the corresponding JSDocTag node if the position is in a jsDoc comment
*/
export function getJsDocTagAtPosition(sourceFile: SourceFile, position: number): JSDocTag {
let node = ts.getTokenAtPosition(sourceFile, position);
let jsDocComment: JSDocComment;
if (node.jsDocComment) {
jsDocComment = node.jsDocComment;
}
else {
while (node) {
if (node.kind === SyntaxKind.VariableStatement ||
node.kind === SyntaxKind.FunctionDeclaration ||
node.kind === SyntaxKind.Parameter) {
jsDocComment = node.jsDocComment;
if (isToken(node)) {
switch (node.kind) {
case SyntaxKind.VarKeyword:
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
// if the current token is var, let or const, skip the VariableDeclarationList
node = node.parent.parent;
break;
}
default:
node = node.parent;
break;
}
if (!node.jsDocComment) {
node = node.parent;
}
}
let jsDocComment = node.jsDocComment;
if (jsDocComment) {
for (let tag of jsDocComment.tags) {
if (tag.pos <= position && position <= tag.end) {