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
1 change: 1 addition & 0 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,7 @@ namespace ts {
}

function bindJSDocTypeAlias(node: JSDocTypedefTag | JSDocCallbackTag) {
node.tagName.parent = node;
if (node.fullName) {
setParentPointers(node, node.fullName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6772,7 +6772,7 @@ namespace ts {

// TODO: determine what this does before making it public.
/* @internal */
export function isJSDocTag(node: Node): boolean {
export function isJSDocTag(node: Node): node is JSDocTag {
return node.kind >= SyntaxKind.FirstJSDocTagNode && node.kind <= SyntaxKind.LastJSDocTagNode;
}

Expand Down
4 changes: 2 additions & 2 deletions src/services/codefixes/fixUnusedIdentifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ namespace ts.codefix {
if (importDecl) {
changes.delete(sourceFile, importDecl);
}
else if (token.kind === SyntaxKind.AtToken && isJSDocTemplateTag(token.parent)) {
changes.delete(sourceFile, token.parent);
else if (isJSDocTemplateTag(token)) {
changes.delete(sourceFile, token);
}
else if (token.kind === SyntaxKind.LessThanToken) {
deleteTypeParameters(changes, sourceFile, token);
Expand Down
4 changes: 2 additions & 2 deletions src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ namespace ts {
function shouldGetType(sourceFile: SourceFile, node: Node, position: number): boolean {
switch (node.kind) {
case SyntaxKind.Identifier:
return !isLabelName(node);
return !isLabelName(node) && !isTagName(node);
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.QualifiedName:
// Don't return quickInfo if inside the comment in `a/**/.b`
Expand Down Expand Up @@ -2159,7 +2159,7 @@ namespace ts {
function initializeNameTable(sourceFile: SourceFile): void {
const nameTable = sourceFile.nameTable = createUnderscoreEscapedMap<number>();
sourceFile.forEachChild(function walk(node) {
if (isIdentifier(node) && node.escapedText || isStringOrNumericLiteralLike(node) && literalIsName(node)) {
if (isIdentifier(node) && !isTagName(node) && node.escapedText || isStringOrNumericLiteralLike(node) && literalIsName(node)) {
const text = getEscapedTextOfIdentifierOrLiteral(node);
nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1);
}
Expand Down
4 changes: 4 additions & 0 deletions src/services/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ namespace ts {
return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node);
}

export function isTagName(node: Node): boolean {
return isJSDocTag(node.parent) && node.parent.tagName === node;
}

export function isRightSideOfQualifiedName(node: Node) {
return node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node;
}
Expand Down