diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f2874b6b66595..be2fe3bb13958 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -5891,7 +5891,7 @@ namespace ts { /** True if node is of a kind that may contain comment text. */ export function isJSDocCommentContainingNode(node: Node): boolean { - return node.kind === SyntaxKind.JSDocComment || isJSDocTag(node); + return node.kind === SyntaxKind.JSDocComment || isJSDocTag(node) || isJSDocTypeLiteral(node); } // TODO: determine what this does before making it public. diff --git a/src/services/services.ts b/src/services/services.ts index 00442f73b0422..ddb869624a858 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -114,12 +114,15 @@ namespace ts { return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); } - private addSyntheticNodes(nodes: Node[], pos: number, end: number): number { + private addSyntheticNodes(nodes: Push, pos: number, end: number): number { scanner.setTextPos(pos); while (pos < end) { const token = scanner.scan(); const textPos = scanner.getTextPos(); if (textPos <= end) { + if (token === SyntaxKind.Identifier) { + Debug.fail(`Did not expect ${(ts as any).SyntaxKind[this.kind]} to have an Identifier in its trivia`); + } nodes.push(createNode(token, pos, textPos, this)); } pos = textPos; diff --git a/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts b/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts index 6d1b32b1515a7..5234faf9d64a6 100644 --- a/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts +++ b/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts @@ -14,9 +14,3 @@ //// function f(o) { return o.nested.[|great|]; } verify.rangesReferenceEachOther(); - -///** -// * @param {object} [|o|] - very important! -// * @param {string} o.x - a thing, its ok -// */ -// function f([|o|]) { return [|o|].x; }