From 72f19ef02d8098333507927175add98c7fa0dadf Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 10 Sep 2020 14:19:13 -0700 Subject: [PATCH 01/44] Initial scribbles --- src/services/jsDoc.ts | 21 +++++++++++++++++++-- src/services/services.ts | 6 +++--- src/services/types.ts | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index f011bac85956c..536b6011a1392 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -112,17 +112,34 @@ namespace ts.JsDoc { } } - export function getJsDocTagsFromDeclarations(declarations?: Declaration[]): JSDocTagInfo[] { + export function getJsDocTagsFromDeclarations(checker: TypeChecker, declarations?: Declaration[]): JSDocTagInfo[] { // Only collect doc comments from duplicate declarations once. const tags: JSDocTagInfo[] = []; forEachUnique(declarations, declaration => { for (const tag of getJSDocTags(declaration)) { - tags.push({ name: tag.tagName.text, text: getCommentText(tag) }); + tags.push({ name: tag.tagName.text, text: getCommentText(tag), links: getLinks(tag, checker) }); } }); return tags; } + function getLinks(tag: JSDocTag, checker: TypeChecker): JSDocLink[] | undefined { + if (tag.kind !== SyntaxKind.JSDocSeeTag) return; // TODO: Change this to look for links + const see = tag as JSDocSeeTag; + if (!see.name) return + const symbol = checker.getSymbolAtLocation(see.name) + if (!symbol) return + return [{ + pos: symbol.valueDeclaration.pos, + end: symbol.valueDeclaration.end, + link: { // TODO: FileSpanWithContext is in services, but maybe a counterpart exists over here? + start: { line: symbol.valueDeclaration.pos, offset: 0 }, // huuff, not sure at all how to produce a line/offset pair + end: { line: symbol.valueDeclaration.end, offset: 0 }, + file: getSourceFileOfNode(symbol.valueDeclaration).fileName, + } + }] + } + function getCommentText(tag: JSDocTag): string | undefined { const { comment } = tag; switch (tag.kind) { diff --git a/src/services/services.ts b/src/services/services.ts index b8300aba0c34c..3d5c5894d33aa 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -359,9 +359,9 @@ namespace ts { } } - getJsDocTags(): JSDocTagInfo[] { + getJsDocTags(checker: TypeChecker): JSDocTagInfo[] { if (this.tags === undefined) { - this.tags = JsDoc.getJsDocTagsFromDeclarations(this.declarations); + this.tags = JsDoc.getJsDocTagsFromDeclarations(checker, this.declarations); } return this.tags; @@ -550,7 +550,7 @@ namespace ts { getJsDocTags(): JSDocTagInfo[] { if (this.jsDocTags === undefined) { - this.jsDocTags = this.declaration ? JsDoc.getJsDocTagsFromDeclarations([this.declaration]) : []; + this.jsDocTags = this.declaration ? JsDoc.getJsDocTagsFromDeclarations(this.checker, [this.declaration]) : []; } return this.jsDocTags; diff --git a/src/services/types.ts b/src/services/types.ts index 5acd9afbb80a8..68b3ab9f079aa 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1009,6 +1009,20 @@ namespace ts { export interface JSDocTagInfo { name: string; text?: string; + links?: JSDocLink[]; // fill this by calling getSymbolOfNameOrPropertyAccessExpression/getSymbolAtLocation for @see tags + // (probably will need a dedicated thing for finding @link tags) + } + + export interface JSDocLink { + pos: number; + end: number; + link: { // TODO: FileSpanWithContext is in services, but maybe a counterpart exists over here? + start: { line: number, offset: number }, + end: { line: number, offset: number }, + file: string, + contextStart?: { line: number, offset: number }, + contextEnd?: { line: number, offset: number } + }; } export interface QuickInfo { From c08258b986e545b27a91fab1c61bbf1b82306dc0 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 10 Sep 2020 17:20:36 -0700 Subject: [PATCH 02/44] Compiles but provides spans instead of location pairs Probably need to fork the services/server types and provide a conversion with Session.toFileSpan. Not sure where to put the conversion. --- src/server/protocol.ts | 4 +++- src/services/jsDoc.ts | 8 +++----- src/services/services.ts | 2 +- src/services/signatureHelp.ts | 2 +- src/services/symbolDisplay.ts | 4 ++-- src/services/types.ts | 16 +++++----------- 6 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index f9f3b1910cd40..72a9b5ebddfae 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1924,7 +1924,9 @@ namespace ts.server.protocol { /** * JSDoc tags associated with symbol. */ - tags: JSDocTagInfo[]; + tags: JSDocTagInfo[]; // TODO: Needs to use location pairs instead of spans. That probalby means no more re-use of JSDocTagInfo + // I need to find out how this is handled elsewhere in server. + // Also, where to put the handling when I do figure out what it should be. } /** diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 536b6011a1392..abe72c3234694 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -128,14 +128,12 @@ namespace ts.JsDoc { const see = tag as JSDocSeeTag; if (!see.name) return const symbol = checker.getSymbolAtLocation(see.name) - if (!symbol) return + if (!symbol || !symbol.valueDeclaration) return return [{ - pos: symbol.valueDeclaration.pos, - end: symbol.valueDeclaration.end, + ...createTextSpanFromNode(see.name), link: { // TODO: FileSpanWithContext is in services, but maybe a counterpart exists over here? - start: { line: symbol.valueDeclaration.pos, offset: 0 }, // huuff, not sure at all how to produce a line/offset pair - end: { line: symbol.valueDeclaration.end, offset: 0 }, file: getSourceFileOfNode(symbol.valueDeclaration).fileName, + span: createTextSpanFromNode(symbol.valueDeclaration) } }] } diff --git a/src/services/services.ts b/src/services/services.ts index 3d5c5894d33aa..7428cba72a0b1 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1589,7 +1589,7 @@ namespace ts { textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile), displayParts: typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(nodeForQuickInfo))), documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : undefined, - tags: type.symbol ? type.symbol.getJsDocTags() : undefined + tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : undefined }; } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index c8b333d0356f0..eb02533d5477e 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -564,7 +564,7 @@ namespace ts.SignatureHelp { const parameters = typeParameters.map(t => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer)); const documentation = symbol.getDocumentationComment(checker); - const tags = symbol.getJsDocTags(); + const tags = symbol.getJsDocTags(checker); const prefixDisplayParts = [...typeSymbolDisplay, punctuationPart(SyntaxKind.LessThanToken)]; return { isVariadic: false, prefixDisplayParts, suffixDisplayParts: [punctuationPart(SyntaxKind.GreaterThanToken)], separatorDisplayParts, parameters, documentation, tags }; } diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index d62be2649031a..6c9e5f9a31190 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -530,7 +530,7 @@ namespace ts.SymbolDisplay { } documentation = rhsSymbol.getDocumentationComment(typeChecker); - tags = rhsSymbol.getJsDocTags(); + tags = rhsSymbol.getJsDocTags(typeChecker); if (documentation.length > 0) { break; } @@ -539,7 +539,7 @@ namespace ts.SymbolDisplay { } if (tags.length === 0 && !hasMultipleSignatures) { - tags = symbol.getJsDocTags(); + tags = symbol.getJsDocTags(typeChecker); } if (documentation.length === 0 && documentationFromAlias) { diff --git a/src/services/types.ts b/src/services/types.ts index 68b3ab9f079aa..6ead6090dca02 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -43,7 +43,7 @@ namespace ts { getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; /* @internal */ getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] - getJsDocTags(): JSDocTagInfo[]; + getJsDocTags(checker: TypeChecker): JSDocTagInfo[]; } export interface Type { @@ -1009,19 +1009,13 @@ namespace ts { export interface JSDocTagInfo { name: string; text?: string; - links?: JSDocLink[]; // fill this by calling getSymbolOfNameOrPropertyAccessExpression/getSymbolAtLocation for @see tags - // (probably will need a dedicated thing for finding @link tags) + links?: JSDocLink[]; } - export interface JSDocLink { - pos: number; - end: number; - link: { // TODO: FileSpanWithContext is in services, but maybe a counterpart exists over here? - start: { line: number, offset: number }, - end: { line: number, offset: number }, + export interface JSDocLink extends TextSpan { + link: { + span: TextSpan file: string, - contextStart?: { line: number, offset: number }, - contextEnd?: { line: number, offset: number } }; } From 2f1d113f16351c0ed662f8f6addaec47aa586224 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 10 Sep 2020 17:26:54 -0700 Subject: [PATCH 03/44] Switch to DocumentSpan In theory this is already better supported, but not sure practise bears that out. --- src/services/jsDoc.ts | 4 ++-- src/services/types.ts | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index abe72c3234694..7886d47d56051 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -132,8 +132,8 @@ namespace ts.JsDoc { return [{ ...createTextSpanFromNode(see.name), link: { // TODO: FileSpanWithContext is in services, but maybe a counterpart exists over here? - file: getSourceFileOfNode(symbol.valueDeclaration).fileName, - span: createTextSpanFromNode(symbol.valueDeclaration) + fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, + textSpan: createTextSpanFromNode(symbol.valueDeclaration) } }] } diff --git a/src/services/types.ts b/src/services/types.ts index 6ead6090dca02..5569438598fca 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1013,10 +1013,7 @@ namespace ts { } export interface JSDocLink extends TextSpan { - link: { - span: TextSpan - file: string, - }; + link: DocumentSpan; } export interface QuickInfo { From 8ba5dc87b4972eb2dc7cdf9ff88bff668f5f0629 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 24 Nov 2020 11:26:45 -0800 Subject: [PATCH 04/44] Builds w/protocol types + conversions --- src/server/protocol.ts | 20 +++++++++++++++----- src/server/session.ts | 33 ++++++++++++++++++++++----------- src/services/jsDoc.ts | 7 ++++--- src/services/types.ts | 7 ++++--- 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index af0b0f31c04e5..976beb5164989 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -955,6 +955,17 @@ namespace ts.server.protocol { file: string; } + export interface JSDocTogInfo { + name: string; + text?: string; + links?: readonly JSDocLink[]; + } + + export interface JSDocLink extends FileSpan { + // TODO: Don't think WithContext is really needed + target: FileSpanWithContext; + } + export interface TextSpanWithContext extends TextSpan { contextStart?: Location; contextEnd?: Location; @@ -1937,9 +1948,7 @@ namespace ts.server.protocol { /** * JSDoc tags associated with symbol. */ - tags: JSDocTagInfo[]; // TODO: Needs to use location pairs instead of spans. That probalby means no more re-use of JSDocTagInfo - // I need to find out how this is handled elsewhere in server. - // Also, where to put the handling when I do figure out what it should be. + tags: readonly JSDocTogInfo[]; } /** @@ -2245,7 +2254,7 @@ namespace ts.server.protocol { /** * JSDoc tags for the symbol. */ - tags?: JSDocTagInfo[]; + tags?: readonly JSDocTogInfo[]; /** * The associated code actions for this entry @@ -2347,8 +2356,9 @@ namespace ts.server.protocol { /** * The signature's JSDoc tags + * TODO: Changing this doesn't cause the build to fail! Need tests and probably a scan of session.ts */ - tags: JSDocTagInfo[]; + tags: readonly JSDocTogInfo[]; } /** diff --git a/src/server/session.ts b/src/server/session.ts index a842694bb9a6b..6a1527176d19a 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1250,6 +1250,16 @@ namespace ts.server { result; } + private mapJSDocTagInfo(tags: readonly JSDocTagInfo[], project: Project): readonly protocol.JSDocTogInfo[] { + return tags.map(({ name, text, links }) => ({ + name, + text, + links: links?.map(link => ({ + ...this.toFileSpan(link.fileName, link.textSpan, project), + target: this.toFileSpanWithContext(link.target.fileName, link.target.textSpan, undefined, project), + }))})) + } + private mapDefinitionInfo(definitions: readonly DefinitionInfo[], project: Project): readonly protocol.FileSpanWithContext[] { return definitions.map(def => this.toFileSpanWithContext(def.fileName, def.textSpan, def.contextSpan, project)); } @@ -1666,7 +1676,7 @@ namespace ts.server { end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), displayString, documentation: docString, - tags: quickInfo.tags || [] + tags: quickInfo.tags ? this.mapJSDocTagInfo(quickInfo.tags, project) : [] }; } else { @@ -1800,7 +1810,7 @@ namespace ts.server { return res; } - private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, simplifiedResult: boolean): readonly protocol.CompletionEntryDetails[] | readonly CompletionEntryDetails[] { + private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, fullResult: boolean): readonly protocol.CompletionEntryDetails[] | readonly CompletionEntryDetails[] { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); @@ -1810,9 +1820,13 @@ namespace ts.server { const { name, source } = typeof entryName === "string" ? { name: entryName, source: undefined } : entryName; return project.getLanguageService().getCompletionEntryDetails(file, position, name, formattingOptions, source, this.getPreferences(file)); }); - return simplifiedResult - ? result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)) })) - : result; + return fullResult + ? result + : result.map(details => ({ + ...details, + codeActions: map(details.codeActions, action => this.mapCodeAction(action)), + tags: details.tags ? this.mapJSDocTagInfo(details.tags, project) : [] + })); } private getCompileOnSaveAffectedFileList(args: protocol.FileRequestArgs): readonly protocol.CompileOnSaveAffectedFileListSingleProject[] { @@ -1880,10 +1894,7 @@ namespace ts.server { const span = helpItems.applicableSpan; return { items: helpItems.items, - applicableSpan: { - start: scriptInfo.positionToLineOffset(span.start), - end: scriptInfo.positionToLineOffset(span.start + span.length) - }, + applicableSpan: span, selectedItemIndex: helpItems.selectedItemIndex, argumentIndex: helpItems.argumentIndex, argumentCount: helpItems.argumentCount, @@ -2664,10 +2675,10 @@ namespace ts.server { return this.requiredResponse(this.getCompletions(request.arguments, CommandNames.CompletionsFull)); }, [CommandNames.CompletionDetails]: (request: protocol.CompletionDetailsRequest) => { - return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*simplifiedResult*/ true)); + return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ false)); }, [CommandNames.CompletionDetailsFull]: (request: protocol.CompletionDetailsRequest) => { - return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*simplifiedResult*/ false)); + return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ true)); }, [CommandNames.CompileOnSaveAffectedFileList]: (request: protocol.CompileOnSaveAffectedFileListRequest) => { return this.requiredResponse(this.getCompileOnSaveAffectedFileList(request.arguments)); diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index c2622f0df8ec5..53bd69fa7eb12 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -124,14 +124,15 @@ namespace ts.JsDoc { } function getLinks(tag: JSDocTag, checker: TypeChecker): JSDocLink[] | undefined { - if (tag.kind !== SyntaxKind.JSDocSeeTag) return; // TODO: Change this to look for links + if (tag.kind !== SyntaxKind.JSDocSeeTag) return; // TODO: Change this to look for @link not @see const see = tag as JSDocSeeTag; if (!see.name) return const symbol = checker.getSymbolAtLocation(see.name) if (!symbol || !symbol.valueDeclaration) return return [{ - ...createTextSpanFromNode(see.name), - link: { // TODO: FileSpanWithContext is in services, but maybe a counterpart exists over here? + fileName: getSourceFileOfNode(see.name).fileName, + textSpan: createTextSpanFromNode(see.name), + target: { fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, textSpan: createTextSpanFromNode(symbol.valueDeclaration) } diff --git a/src/services/types.ts b/src/services/types.ts index 298be72d9179a..6560a53f50a18 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1036,8 +1036,9 @@ namespace ts { links?: JSDocLink[]; } - export interface JSDocLink extends TextSpan { - link: DocumentSpan; + // TODO: Maybe TextRange/FileRange instead? Or extends DocumentSpan isntead of TextSpan? + export interface JSDocLink extends DocumentSpan { + target: DocumentSpan; } export interface QuickInfo { @@ -1046,7 +1047,7 @@ namespace ts { textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: JSDocTagInfo[]; + tags?: readonly JSDocTagInfo[]; } export type RenameInfo = RenameInfoSuccess | RenameInfoFailure; From ca1b273012fb2972d92cd81557f6bd867f23681e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 24 Nov 2020 11:35:17 -0800 Subject: [PATCH 05/44] cleanup:better names and scrub TODOs --- src/server/protocol.ts | 11 +++++------ src/server/session.ts | 11 +++++++---- src/services/types.ts | 1 - 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 976beb5164989..ccc0abbb9558c 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -955,15 +955,14 @@ namespace ts.server.protocol { file: string; } - export interface JSDocTogInfo { + export interface JSDocTagInfo { name: string; text?: string; links?: readonly JSDocLink[]; } export interface JSDocLink extends FileSpan { - // TODO: Don't think WithContext is really needed - target: FileSpanWithContext; + target: FileSpan; } export interface TextSpanWithContext extends TextSpan { @@ -1948,7 +1947,7 @@ namespace ts.server.protocol { /** * JSDoc tags associated with symbol. */ - tags: readonly JSDocTogInfo[]; + tags: readonly JSDocTagInfo[]; } /** @@ -2254,7 +2253,7 @@ namespace ts.server.protocol { /** * JSDoc tags for the symbol. */ - tags?: readonly JSDocTogInfo[]; + tags?: readonly JSDocTagInfo[]; /** * The associated code actions for this entry @@ -2358,7 +2357,7 @@ namespace ts.server.protocol { * The signature's JSDoc tags * TODO: Changing this doesn't cause the build to fail! Need tests and probably a scan of session.ts */ - tags: readonly JSDocTogInfo[]; + tags: readonly JSDocTagInfo[]; } /** diff --git a/src/server/session.ts b/src/server/session.ts index 6a1527176d19a..5c72ea72b1138 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1250,13 +1250,16 @@ namespace ts.server { result; } - private mapJSDocTagInfo(tags: readonly JSDocTagInfo[], project: Project): readonly protocol.JSDocTogInfo[] { + private mapJSDocTagInfo(tags: readonly JSDocTagInfo[] | undefined, project: Project): readonly protocol.JSDocTagInfo[] { + if (tags === undefined) { + return []; + } return tags.map(({ name, text, links }) => ({ name, text, links: links?.map(link => ({ ...this.toFileSpan(link.fileName, link.textSpan, project), - target: this.toFileSpanWithContext(link.target.fileName, link.target.textSpan, undefined, project), + target: this.toFileSpan(link.target.fileName, link.target.textSpan, project), }))})) } @@ -1676,7 +1679,7 @@ namespace ts.server { end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), displayString, documentation: docString, - tags: quickInfo.tags ? this.mapJSDocTagInfo(quickInfo.tags, project) : [] + tags: this.mapJSDocTagInfo(quickInfo.tags, project) }; } else { @@ -1825,7 +1828,7 @@ namespace ts.server { : result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)), - tags: details.tags ? this.mapJSDocTagInfo(details.tags, project) : [] + tags: this.mapJSDocTagInfo(details.tags, project) })); } diff --git a/src/services/types.ts b/src/services/types.ts index 6560a53f50a18..21af0989ebda4 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1036,7 +1036,6 @@ namespace ts { links?: JSDocLink[]; } - // TODO: Maybe TextRange/FileRange instead? Or extends DocumentSpan isntead of TextSpan? export interface JSDocLink extends DocumentSpan { target: DocumentSpan; } From 867ab3454e71101353d2fc63df2e1d678b407300 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 30 Nov 2020 11:41:45 -0800 Subject: [PATCH 06/44] fix test harness too --- src/harness/client.ts | 22 +++++++++++++++++++--- src/services/types.ts | 7 ++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/harness/client.ts b/src/harness/client.ts index 230517b599db9..422afe8971232 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -176,7 +176,7 @@ namespace ts.server { textSpan: this.decodeSpan(body, fileName), displayParts: [{ kind: "text", text: body.displayString }], documentation: [{ kind: "text", text: body.documentation }], - tags: body.tags + tags: this.decodeLink(body.tags) }; } @@ -223,7 +223,8 @@ namespace ts.server { const response = this.processResponse(request); Debug.assert(response.body!.length === 1, "Unexpected length of completion details response body."); const convertedCodeActions = map(response.body![0].codeActions, ({ description, changes }) => ({ description, changes: this.convertChanges(changes, fileName) })); - return { ...response.body![0], codeActions: convertedCodeActions }; + const tags = response.body![0].tags ? this.decodeLink(response.body![0].tags) : undefined; + return { ...response.body![0], tags, codeActions: convertedCodeActions }; } getCompletionEntrySymbol(_fileName: string, _position: number, _entryName: string): Symbol { @@ -520,6 +521,20 @@ namespace ts.server { this.lineOffsetToPosition(fileName, span.end, lineMap)); } + private decodeLink(tags: readonly protocol.JSDocTagInfo[]): readonly JSDocTagInfo[] { + return tags.map(tag => ({ + ...tag, + links: tag.links?.map(link => ({ + textSpan: this.decodeSpan(link), + fileName: link.file, + target: { + textSpan: this.decodeSpan(link.target), + fileName: link.target.file, + } + })) + })) + } + getNameOrDottedNameSpan(_fileName: string, _startPos: number, _endPos: number): TextSpan { return notImplemented(); } @@ -538,9 +553,10 @@ namespace ts.server { return undefined; } - const { items, applicableSpan: encodedApplicableSpan, selectedItemIndex, argumentIndex, argumentCount } = response.body; + const { items: encodedItems, applicableSpan: encodedApplicableSpan, selectedItemIndex, argumentIndex, argumentCount } = response.body; const applicableSpan = this.decodeSpan(encodedApplicableSpan, fileName); + const items = encodedItems.map(item => ({ ...item, tags: this.decodeLink(item.tags) })) return { items, applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; } diff --git a/src/services/types.ts b/src/services/types.ts index 21af0989ebda4..f8d535d8f9189 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1033,7 +1033,7 @@ namespace ts { export interface JSDocTagInfo { name: string; text?: string; - links?: JSDocLink[]; + links?: readonly JSDocLink[]; } export interface JSDocLink extends DocumentSpan { @@ -1098,7 +1098,7 @@ namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; - tags: JSDocTagInfo[]; + tags: readonly JSDocTagInfo[]; } /** @@ -1156,7 +1156,8 @@ namespace ts { kindModifiers: string; // see ScriptElementKindModifier, comma separated displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: JSDocTagInfo[]; + // TODO: Find out if readonly arrays are really De Stijl hier + tags?: readonly JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; } From 5d518d6ce42afb4a2c4ed77c3841702b4f89dc9c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 30 Nov 2020 13:44:04 -0800 Subject: [PATCH 07/44] Misc 1. Simplify protocol after talking to @mjbvz. 2. Add more tests. 3. Initial notes about where to add parsing. --- src/compiler/parser.ts | 2 ++ src/compiler/types.ts | 8 ++++++++ src/harness/client.ts | 3 +-- src/server/protocol.ts | 2 +- src/server/session.ts | 2 +- src/services/jsDoc.ts | 4 ++-- src/testRunner/unittests/jsDocParsing.ts | 5 ++++- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ac810e305af09..1d648b72952cc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7307,6 +7307,7 @@ namespace ts { state = JSDocState.BeginningOfLine; indent = 0; } + // TODO: Need to parse link tags in the initial comment text too loop: while (true) { switch (token()) { case SyntaxKind.AtToken: @@ -7520,6 +7521,7 @@ namespace ts { return parseTagComments(margin, indentText.slice(margin)); } + // TODO: Also needs to parse link tags function parseTagComments(indent: number, initialMargin?: string): string | undefined { const comments: string[] = []; let state = JSDocState.BeginningOfLine; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8fc3a1457cd1c..ce9977f194ce0 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -375,6 +375,7 @@ namespace ts { JSDocComment, JSDocTypeLiteral, JSDocSignature, + JSDocLink, JSDocTag, JSDocAugmentsTag, JSDocImplementsTag, @@ -3144,6 +3145,13 @@ namespace ts { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; readonly comment?: string; + readonly links?: JSDocLinkNode[]; + } + + // TODO: Decide on a taxonomy (preferably ditch the -Node suffix here) + export interface JSDocLinkNode extends Node { + readonly kind: SyntaxKind.JSDocLink; + readonly name?: JSDocNameReference; } export interface JSDocUnknownTag extends JSDocTag { diff --git a/src/harness/client.ts b/src/harness/client.ts index 422afe8971232..200769cf0eeb4 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -525,8 +525,7 @@ namespace ts.server { return tags.map(tag => ({ ...tag, links: tag.links?.map(link => ({ - textSpan: this.decodeSpan(link), - fileName: link.file, + ...link, target: { textSpan: this.decodeSpan(link.target), fileName: link.target.file, diff --git a/src/server/protocol.ts b/src/server/protocol.ts index ccc0abbb9558c..254b970d979fd 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -961,7 +961,7 @@ namespace ts.server.protocol { links?: readonly JSDocLink[]; } - export interface JSDocLink extends FileSpan { + export interface JSDocLink extends DocumentSpan { target: FileSpan; } diff --git a/src/server/session.ts b/src/server/session.ts index 5c72ea72b1138..521d511d64783 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1258,7 +1258,7 @@ namespace ts.server { name, text, links: links?.map(link => ({ - ...this.toFileSpan(link.fileName, link.textSpan, project), + ...link, target: this.toFileSpan(link.target.fileName, link.target.textSpan, project), }))})) } diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 53bd69fa7eb12..71d858264ad3d 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -130,8 +130,8 @@ namespace ts.JsDoc { const symbol = checker.getSymbolAtLocation(see.name) if (!symbol || !symbol.valueDeclaration) return return [{ - fileName: getSourceFileOfNode(see.name).fileName, - textSpan: createTextSpanFromNode(see.name), + fileName: getSourceFileOfNode(see).fileName, + textSpan: createTextSpanFromNode(see), target: { fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, textSpan: createTextSpanFromNode(symbol.valueDeclaration) diff --git a/src/testRunner/unittests/jsDocParsing.ts b/src/testRunner/unittests/jsDocParsing.ts index 878408650678d..af21d76dcd119 100644 --- a/src/testRunner/unittests/jsDocParsing.ts +++ b/src/testRunner/unittests/jsDocParsing.ts @@ -312,8 +312,11 @@ namespace ts { */`); parsesCorrectly("@link tags", `/** - * {@link first link} + * {@link first } * Inside {@link link text} thing + * @param foo See also {@link A.Reference} + * @param bar Or see {@link http://www.zombocom.com } + * {@link Standalone.Complex } */`); parsesCorrectly("authorTag", `/** From c07fe40276b06a495582bd351330cef6a05044f7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 2 Dec 2020 13:28:17 -0800 Subject: [PATCH 08/44] Parse and store links in the compiler The text of the link is still stored in the comment text, but that's now kept in an object instead of just a string. Each link has the parse for the entity reference, if there is one. Needs lots more tests -- this just makes all the existing jsdoc tests pass. --- src/compiler/checker.ts | 4 +- src/compiler/emitter.ts | 7 +- src/compiler/factory/nodeFactory.ts | 74 +++++---- src/compiler/parser.ts | 43 +++-- src/compiler/types.ts | 99 ++++++------ src/deprecatedCompat/deprecations.ts | 4 +- src/services/codefixes/inferFromUsage.ts | 10 +- src/services/jsDoc.ts | 6 +- src/testRunner/unittests/publicApi.ts | 2 +- ...ocComments.parsesCorrectly.@link tags.json | 149 +++++++++++++++++- ...ts.parsesCorrectly.Nested @param tags.json | 10 +- ...parsesCorrectly.argSynonymForParamTag.json | 5 +- ...sCorrectly.argumentSynonymForParamTag.json | 5 +- ...parsesCorrectly.asteriskAfterPreamble.json | 5 +- ...DocComments.parsesCorrectly.authorTag.json | 10 +- ...sCorrectly.consecutive newline tokens.json | 5 +- ...less-than and greater-than characters.json | 5 +- ...DocComments.parsesCorrectly.paramTag1.json | 5 +- ...arsesCorrectly.paramTagBracketedName1.json | 5 +- ...arsesCorrectly.paramTagBracketedName2.json | 5 +- ...parsesCorrectly.paramTagNameThenType2.json | 5 +- ...ocComments.parsesCorrectly.returnTag2.json | 5 +- ...Comments.parsesCorrectly.templateTag6.json | 5 +- ...mments.parsesCorrectly.threeAsterisks.json | 5 +- 24 files changed, 359 insertions(+), 119 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 47fd8d85cc50e..1505cae0f452c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5046,7 +5046,7 @@ namespace ts { function preserveCommentsOn(node: T) { if (some(propertySymbol.declarations, d => d.kind === SyntaxKind.JSDocPropertyTag)) { const d = find(propertySymbol.declarations, d => d.kind === SyntaxKind.JSDocPropertyTag)! as JSDocPropertyTag; - const commentText = d.comment; + const commentText = d.comment?.text; if (commentText) { setSyntheticLeadingComments(node, [{ kind: SyntaxKind.MultiLineCommentTrivia, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); } @@ -6529,7 +6529,7 @@ namespace ts { const typeParams = getSymbolLinks(symbol).typeParameters; const typeParamDecls = map(typeParams, p => typeParameterToDeclaration(p, context)); const jsdocAliasDecl = find(symbol.declarations, isJSDocTypeAlias); - const commentText = jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : undefined; + const commentText = jsdocAliasDecl ? jsdocAliasDecl.comment?.text || jsdocAliasDecl.parent.comment?.text : undefined; const oldFlags = context.flags; context.flags |= NodeBuilderFlags.InTypeAlias; addResult(setSyntheticLeadingComments( diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 83a0a7ed9d845..984caaca37458 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1560,6 +1560,7 @@ namespace ts { return emitJSDocTypeLiteral(node as JSDocTypeLiteral); case SyntaxKind.JSDocClassTag: case SyntaxKind.JSDocTag: + case SyntaxKind.JSDocAuthorTag: return emitJSDocSimpleTag(node as JSDocTag); case SyntaxKind.JSDocSeeTag: return emitJSDocSeeTag(node as JSDocSeeTag); @@ -3508,7 +3509,7 @@ namespace ts { function emitJSDoc(node: JSDoc) { write("/**"); if (node.comment) { - const lines = node.comment.split(/\r\n?|\n/g); + const lines = node.comment.text.split(/\r\n?|\n/g); for (const line of lines) { writeLine(); writeSpace(); @@ -3647,10 +3648,10 @@ namespace ts { emit(tagName); } - function emitJSDocComment(comment: string | undefined) { + function emitJSDocComment(comment: JSDocComment | undefined) { if (comment) { writeSpace(); - write(comment); + write(comment.text); } } diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index aadd082a46628..bcd939130c80e 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -34,10 +34,10 @@ namespace ts { const getJSDocPrimaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => () => createJSDocPrimaryTypeWorker(kind)); const getJSDocUnaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => (type: T["type"]) => createJSDocUnaryTypeWorker(kind, type)); const getJSDocUnaryTypeUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, type: T["type"]) => updateJSDocUnaryTypeWorker(kind, node, type)); - const getJSDocSimpleTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, comment?: string) => createJSDocSimpleTagWorker(kind, tagName, comment)); - const getJSDocSimpleTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, comment?: string) => updateJSDocSimpleTagWorker(kind, node, tagName, comment)); - const getJSDocTypeLikeTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string) => createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment)); - const getJSDocTypeLikeTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string) => updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment)); + const getJSDocSimpleTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, comment?: JSDocComment) => createJSDocSimpleTagWorker(kind, tagName, comment)); + const getJSDocSimpleTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, comment?: JSDocComment) => updateJSDocSimpleTagWorker(kind, node, tagName, comment)); + const getJSDocTypeLikeTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment) => createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment)); + const getJSDocTypeLikeTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment) => updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment)); const factory: NodeFactory = { get parenthesizer() { return parenthesizerRules(); }, @@ -345,6 +345,8 @@ namespace ts { updateJSDocSeeTag, createJSDocNameReference, updateJSDocNameReference, + createJSDocLinkNode, + updateJSDocLinkNode, // lazily load factory members for JSDoc tags with similar structure get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(SyntaxKind.JSDocTypeTag); }, get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(SyntaxKind.JSDocTypeTag); }, @@ -4196,7 +4198,7 @@ namespace ts { } // @api - function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: string | undefined) { + function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: JSDocComment | undefined) { const node = createBaseNode(kind); node.tagName = tagName; node.comment = comment; @@ -4204,7 +4206,7 @@ namespace ts { } // @api - function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string): JSDocTemplateTag { + function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment): JSDocTemplateTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTemplateTag, tagName ?? createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); @@ -4212,7 +4214,7 @@ namespace ts { } // @api - function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | undefined): JSDocTemplateTag { + function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocComment | undefined): JSDocTemplateTag { return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters @@ -4222,7 +4224,7 @@ namespace ts { } // @api - function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocTypedefTag { + function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocTypedefTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTypedefTag, tagName ?? createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4231,7 +4233,7 @@ namespace ts { } // @api - function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocTypedefTag { + function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocTypedefTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4241,7 +4243,7 @@ namespace ts { } // @api - function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocParameterTag { + function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocParameterTag { const node = createBaseJSDocTag(SyntaxKind.JSDocParameterTag, tagName ?? createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4251,7 +4253,7 @@ namespace ts { } // @api - function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocParameterTag { + function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocParameterTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4263,7 +4265,7 @@ namespace ts { } // @api - function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocPropertyTag { + function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocPropertyTag { const node = createBaseJSDocTag(SyntaxKind.JSDocPropertyTag, tagName ?? createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4273,7 +4275,7 @@ namespace ts { } // @api - function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocPropertyTag { + function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocPropertyTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4285,7 +4287,7 @@ namespace ts { } // @api - function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocCallbackTag { + function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocCallbackTag { const node = createBaseJSDocTag(SyntaxKind.JSDocCallbackTag, tagName ?? createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4294,7 +4296,7 @@ namespace ts { } // @api - function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocCallbackTag { + function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocCallbackTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4304,14 +4306,14 @@ namespace ts { } // @api - function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string): JSDocAugmentsTag { + function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocComment): JSDocAugmentsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocAugmentsTag, tagName ?? createIdentifier("augments"), comment); node.class = className; return node; } // @api - function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: string | undefined): JSDocAugmentsTag { + function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: JSDocComment | undefined): JSDocAugmentsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4320,21 +4322,21 @@ namespace ts { } // @api - function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string): JSDocImplementsTag { + function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocComment): JSDocImplementsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocImplementsTag, tagName ?? createIdentifier("implements"), comment); node.class = className; return node; } // @api - function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string): JSDocSeeTag { + function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag { const node = createBaseJSDocTag(SyntaxKind.JSDocSeeTag, tagName ?? createIdentifier("see"), comment); node.name = name; return node; } // @api - function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string): JSDocSeeTag { + function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag { return node.tagName !== tagName || node.name !== name || node.comment !== comment @@ -4357,7 +4359,21 @@ namespace ts { } // @api - function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: string | undefined): JSDocImplementsTag { + function createJSDocLinkNode(name: EntityName): JSDocLinkNode { + const node = createBaseNode(SyntaxKind.JSDocLink); + node.name = name; + return node; + } + + // @api + function updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode { + return node.name !== name + ? update(createJSDocLinkNode(name), node) + : node; + } + + // @api + function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: JSDocComment | undefined): JSDocImplementsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4373,7 +4389,7 @@ namespace ts { // createJSDocProtectedTag // createJSDocReadonlyTag // createJSDocDeprecatedTag - function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: string) { + function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: JSDocComment) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); return node; } @@ -4386,7 +4402,7 @@ namespace ts { // updateJSDocProtectedTag // updateJSDocReadonlyTag // updateJSDocDeprecatedTag - function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: string | undefined) { + function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: JSDocComment | undefined) { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) : @@ -4398,7 +4414,7 @@ namespace ts { // createJSDocReturnTag // createJSDocThisTag // createJSDocEnumTag - function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string) { + function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); node.typeExpression = typeExpression; return node; @@ -4409,7 +4425,7 @@ namespace ts { // updateJSDocReturnTag // updateJSDocThisTag // updateJSDocEnumTag - function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: string | undefined) { + function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined) { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment @@ -4418,13 +4434,13 @@ namespace ts { } // @api - function createJSDocUnknownTag(tagName: Identifier, comment?: string): JSDocUnknownTag { + function createJSDocUnknownTag(tagName: Identifier, comment?: JSDocComment): JSDocUnknownTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTag, tagName, comment); return node; } // @api - function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | undefined): JSDocUnknownTag { + function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocUnknownTag(tagName, comment), node) @@ -4432,7 +4448,7 @@ namespace ts { } // @api - function createJSDocComment(comment?: string | undefined, tags?: readonly JSDocTag[] | undefined) { + function createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined) { const node = createBaseNode(SyntaxKind.JSDocComment); node.comment = comment; node.tags = asNodeArray(tags); @@ -4440,7 +4456,7 @@ namespace ts { } // @api - function updateJSDocComment(node: JSDoc, comment: string | undefined, tags: readonly JSDocTag[] | undefined) { + function updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined) { return node.comment !== comment || node.tags !== tags ? update(createJSDocComment(comment, tags), node) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 1d648b72952cc..2b65de964ad88 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7383,7 +7383,8 @@ namespace ts { } function createJSDocComment(): JSDoc { - const comment = comments.length ? comments.join("") : undefined; + // TODO: Parse links too! + const comment = comments.length ? { links: [], text: comments.join("") } : undefined; const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); return finishNode(factory.createJSDocComment(comment, tagsArray), start, end); } @@ -7522,8 +7523,9 @@ namespace ts { } // TODO: Also needs to parse link tags - function parseTagComments(indent: number, initialMargin?: string): string | undefined { + function parseTagComments(indent: number, initialMargin?: string): JSDocComment | undefined { const comments: string[] = []; + const links: JSDocLinkNode[] = []; let state = JSDocState.BeginningOfLine; let margin: number | undefined; function pushComment(text: string) { @@ -7574,13 +7576,17 @@ namespace ts { break; case SyntaxKind.OpenBraceToken: state = JSDocState.SavingComments; + // TODO: test margins + // TODO: Put a manual `tok = nextTokenJSDoc()` here and only call `lookAhead` if its AtToken. + // THat means I'll have to save getTextPos *before* the nextTokenJSDoc and unconditionally `continue` afterward if (lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) { + const link = parseLink(scanner.getTextPos() - 1) + links.push(link) + pushComment(scanner.getText().slice(link.pos, link.end)) + } + else { pushComment(scanner.getTokenText()); - nextTokenJSDoc(); - pushComment(scanner.getTokenText()); - nextTokenJSDoc(); } - pushComment(scanner.getTokenText()); break; case SyntaxKind.BacktickToken: if (state === JSDocState.SavingBackticks) { @@ -7612,7 +7618,23 @@ namespace ts { removeLeadingNewlines(comments); removeTrailingWhitespace(comments); - return comments.length === 0 ? undefined : comments.join(""); + return comments.length === 0 ? undefined : { links, text: comments.join("") }; + } + + function parseLink(start: number) { + nextTokenJSDoc(); // @ + nextTokenJSDoc(); // link + nextTokenJSDoc(); // ' ' + nextTokenJSDoc(); // first token + const name = tokenIsIdentifierOrKeyword(token()) ? parseEntityName(/*allowReservedWords*/ true) : createMissingNode(SyntaxKind.Identifier, false); // don't try to parseEntityName, it'll assert + // TODO: I'm pretty sure you getting a MissingIdentifier for a bad parse, or soething like that + // in any case, most of the time you'll have `http` as the first identifier and you'll be fine + // now skip past everything including a close brace. + // .. also stop at newlines (TODO: Measure this (it's probably fine, and the penalty for being wrong is just a too-small span), and then write tests) + while (token() !== SyntaxKind.CloseBraceToken && token() !== SyntaxKind.NewLineTrivia) { + nextTokenJSDoc(); + } + return finishNode(factory.createJSDocLinkNode(name), start, scanner.getTextPos()) } function parseUnknownTag(start: number, tagName: Identifier, indent: number, indentText: string) { @@ -7753,13 +7775,14 @@ namespace ts { let comments = authorInfoWithEmail; if (lookAhead(() => nextToken() !== SyntaxKind.NewLineTrivia)) { + // TODO: This is wrong, there could be links in there const comment = parseTagComments(indent); if (comment) { - comments += comment; + comments += comment.text; } } - return finishNode(factory.createJSDocAuthorTag(tagName, comments), start); + return finishNode(factory.createJSDocAuthorTag(tagName, { links: [], text: comments }), start); } function tryParseAuthorNameAndEmail(): string | undefined { @@ -7839,7 +7862,7 @@ namespace ts { return node; } - function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: string) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { + function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: JSDocComment) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { const end = getNodePos(); return finishNode(createTag(tagName, parseTrailingTagComments(start, end, margin, indentText)), start, end); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ce9977f194ce0..52dcc9a2e3c99 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3138,20 +3138,25 @@ namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: string; + readonly comment?: JSDocComment; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: string; - readonly links?: JSDocLinkNode[]; + readonly comment?: JSDocComment; } // TODO: Decide on a taxonomy (preferably ditch the -Node suffix here) export interface JSDocLinkNode extends Node { readonly kind: SyntaxKind.JSDocLink; - readonly name?: JSDocNameReference; + readonly name?: EntityName; + } + + export interface JSDocComment { + text: string; + // TODO: Might need to be optional I don't know + links?: JSDocLinkNode[]; } export interface JSDocUnknownTag extends JSDocTag { @@ -7061,52 +7066,54 @@ namespace ts { updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName): JSDocNameReference; updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference; + createJSDocLinkNode(name: EntityName): JSDocLinkNode; + updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: string): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: string): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: string): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: string): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string): JSDocDeprecatedTag; - createJSDocComment(comment?: string | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: string | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocComment | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocComment): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocComment | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocComment): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocComment | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: JSDocComment): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; + createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; // // JSX diff --git a/src/deprecatedCompat/deprecations.ts b/src/deprecatedCompat/deprecations.ts index ed1034b7e6a1b..0946dff6f25ad 100644 --- a/src/deprecatedCompat/deprecations.ts +++ b/src/deprecatedCompat/deprecations.ts @@ -1216,7 +1216,7 @@ namespace ts { /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ export const createJSDocParamTag = Debug.deprecate(function createJSDocParamTag(name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, comment?: string): JSDocParameterTag { - return factory.createJSDocParameterTag(/*tagName*/ undefined, name, isBracketed, typeExpression, /*isNameFirst*/ false, comment); + return factory.createJSDocParameterTag(/*tagName*/ undefined, name, isBracketed, typeExpression, /*isNameFirst*/ false, comment ? { text: comment } : undefined); }, factoryDeprecation); /** @deprecated Use `factory.createComma` or the factory supplied by your transformation context instead. */ @@ -1341,4 +1341,4 @@ namespace ts { export interface Map extends ESMap { } // #endregion -} \ No newline at end of file +} diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index efad417248a64..037f72259bcc9 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -128,7 +128,7 @@ namespace ts.codefix { const typeNode = getTypeNodeIfAccessible(type, parent, program, host); if (typeNode) { // Note that the codefix will never fire with an existing `@type` tag, so there is no need to merge tags - const typeTag = factory.createJSDocTypeTag(/*tagName*/ undefined, factory.createJSDocTypeExpression(typeNode), /*comment*/ ""); + const typeTag = factory.createJSDocTypeTag(/*tagName*/ undefined, factory.createJSDocTypeExpression(typeNode), /*comment*/ { text: "" }); addJSDocTags(changes, sourceFile, cast(parent.parent.parent, isExpressionStatement), [typeTag]); } importAdder.writeFixes(changes); @@ -307,7 +307,7 @@ namespace ts.codefix { return; } const typeExpression = factory.createJSDocTypeExpression(typeNode); - const typeTag = isGetAccessorDeclaration(declaration) ? factory.createJSDocReturnTag(/*tagName*/ undefined, typeExpression, "") : factory.createJSDocTypeTag(/*tagName*/ undefined, typeExpression, ""); + const typeTag = isGetAccessorDeclaration(declaration) ? factory.createJSDocReturnTag(/*tagName*/ undefined, typeExpression, { text: "" }) : factory.createJSDocTypeTag(/*tagName*/ undefined, typeExpression, { text: "" }); addJSDocTags(changes, sourceFile, parent, [typeTag]); } else if (!tryReplaceImportTypeNodeWithAutoImport(typeNode, declaration, sourceFile, changes, importAdder, getEmitScriptTarget(program.getCompilerOptions()))) { @@ -345,20 +345,20 @@ namespace ts.codefix { const typeNode = inference.type && getTypeNodeIfAccessible(inference.type, param, program, host); const name = factory.cloneNode(param.name); setEmitFlags(name, EmitFlags.NoComments | EmitFlags.NoNestedComments); - return typeNode && factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!inference.isOptional, factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, ""); + return typeNode && factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!inference.isOptional, factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, { text: "" }); }); addJSDocTags(changes, sourceFile, signature, paramTags); } export function addJSDocTags(changes: textChanges.ChangeTracker, sourceFile: SourceFile, parent: HasJSDoc, newTags: readonly JSDocTag[]): void { - const comments = mapDefined(parent.jsDoc, j => j.comment); + const comments = mapDefined(parent.jsDoc, j => j.comment?.text); const oldTags = flatMapToMutable(parent.jsDoc, j => j.tags); const unmergedNewTags = newTags.filter(newTag => !oldTags || !oldTags.some((tag, i) => { const merged = tryMergeJsdocTags(tag, newTag); if (merged) oldTags[i] = merged; return !!merged; })); - const tag = factory.createJSDocComment(comments.join("\n"), factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); + const tag = factory.createJSDocComment({ text: comments.join("\n") }, factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); const jsDocNode = parent.kind === SyntaxKind.ArrowFunction ? getJsDocNodeForArrowFunction(parent) : parent; jsDocNode.jsDoc = parent.jsDoc; jsDocNode.jsDocCache = parent.jsDocCache; diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 71d858264ad3d..3729e4df80921 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -93,7 +93,7 @@ namespace ts.JsDoc { forEachUnique(declarations, declaration => { for (const { comment } of getCommentHavingNodes(declaration)) { if (comment === undefined) continue; - pushIfUnique(documentationComment, comment); + pushIfUnique(documentationComment, comment.text); } }); return intersperse(map(documentationComment, textPart), lineBreakPart()); @@ -156,9 +156,9 @@ namespace ts.JsDoc { case SyntaxKind.JSDocParameterTag: case SyntaxKind.JSDocSeeTag: const { name } = tag as JSDocTypedefTag | JSDocPropertyTag | JSDocParameterTag | JSDocSeeTag; - return name ? withNode(name) : comment; + return name ? withNode(name) : comment?.text; default: - return comment; + return comment?.text; } function withNode(node: Node) { diff --git a/src/testRunner/unittests/publicApi.ts b/src/testRunner/unittests/publicApi.ts index 79d4b9a208243..4356a4f312c6d 100644 --- a/src/testRunner/unittests/publicApi.ts +++ b/src/testRunner/unittests/publicApi.ts @@ -67,7 +67,7 @@ function test() {}`; const funcDec = testSourceFile.statements.find(ts.isFunctionDeclaration)!; const tags = ts.getJSDocTags(funcDec); assert.isDefined(tags[0].comment); - assert.equal(tags[0].comment, "Some\n text\r\n with newlines."); + assert.equal(tags[0].comment!.text, "Some\n text\r\n with newlines."); }); }); diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index 1e0ef5dff87a0..3bac5d7293d01 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -1,9 +1,154 @@ { "kind": "JSDocComment", "pos": 0, - "end": 63, + "end": 187, "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, - "comment": "{@link first link}\nInside {@link link text} thing" + "comment": { + "links": [], + "text": "{@link first }\nInside {@link link text} thing" + }, + "tags": { + "0": { + "kind": "JSDocParameterTag", + "pos": 59, + "end": 102, + "modifierFlagsCache": 0, + "transformFlags": 0, + "tagName": { + "kind": "Identifier", + "pos": 60, + "end": 65, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "param" + }, + "comment": { + "links": [ + { + "kind": "JSDocLink", + "pos": 79, + "end": 98, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "FirstNode", + "pos": 86, + "end": 97, + "modifierFlagsCache": 0, + "transformFlags": 0, + "left": { + "kind": "Identifier", + "pos": 86, + "end": 87, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "A" + }, + "right": { + "kind": "Identifier", + "pos": 88, + "end": 97, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "Reference" + } + } + } + ], + "text": "See also {@link A.Reference}" + }, + "name": { + "kind": "Identifier", + "pos": 66, + "end": 69, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "foo" + }, + "isNameFirst": true, + "isBracketed": false + }, + "1": { + "kind": "JSDocParameterTag", + "pos": 102, + "end": 185, + "modifierFlagsCache": 0, + "transformFlags": 0, + "tagName": { + "kind": "Identifier", + "pos": 103, + "end": 108, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "param" + }, + "comment": { + "links": [ + { + "kind": "JSDocLink", + "pos": 120, + "end": 152, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 127, + "end": 131, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "http" + } + }, + { + "kind": "JSDocLink", + "pos": 156, + "end": 183, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "FirstNode", + "pos": 163, + "end": 181, + "modifierFlagsCache": 0, + "transformFlags": 0, + "left": { + "kind": "Identifier", + "pos": 163, + "end": 173, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "Standalone" + }, + "right": { + "kind": "Identifier", + "pos": 174, + "end": 181, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "Complex" + } + } + } + ], + "text": "Or see {@link http://www.zombocom.com }\n{@link Standalone.Complex }" + }, + "name": { + "kind": "Identifier", + "pos": 109, + "end": 112, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "bar" + }, + "isNameFirst": true, + "isBracketed": false + }, + "length": 2, + "pos": 59, + "end": 185, + "hasTrailingComma": false, + "transformFlags": 0 + } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json index 2c42878ec2605..c43cb4d88956b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "param" }, - "comment": "Doc doc", + "comment": { + "links": [], + "text": "Doc doc" + }, "typeExpression": { "kind": "JSDocTypeExpression", "pos": 34, @@ -48,7 +51,10 @@ "transformFlags": 0, "escapedText": "param" }, - "comment": "Doc for f", + "comment": { + "links": [], + "text": "Doc for f" + }, "typeExpression": { "kind": "JSDocTypeExpression", "pos": 41, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index beadc1f572e2b..e760dd529c3f9 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "arg" }, - "comment": "Description", + "comment": { + "links": [], + "text": "Description" + }, "typeExpression": { "kind": "JSDocTypeExpression", "pos": 13, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index 5ecb6ad069499..e31131e7b39af 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "argument" }, - "comment": "Description", + "comment": { + "links": [], + "text": "Description" + }, "typeExpression": { "kind": "JSDocTypeExpression", "pos": 18, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json index 2d4beb55b12cd..3764860013f96 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json @@ -5,5 +5,8 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, - "comment": "* @type {number}" + "comment": { + "links": [], + "text": "* @type {number}" + } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index b9e91293d73ed..74efc16131063 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "author" }, - "comment": "John Doe " + "comment": { + "links": [], + "text": "John Doe " + } }, "1": { "kind": "JSDocAuthorTag", @@ -36,7 +39,10 @@ "transformFlags": 0, "escapedText": "author" }, - "comment": "John Doe unexpected comment" + "comment": { + "links": [], + "text": "John Doe unexpected comment" + } }, "length": 2, "pos": 7, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json index 26875d7eba7c7..073f41863bdbc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "example" }, - "comment": "Some\n\ntext\r\nwith newlines." + "comment": { + "links": [], + "text": "Some\n\ntext\r\nwith newlines." + } }, "length": 1, "pos": 7, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index 25c634c52caa8..06fe6897ed1b6 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "param" }, - "comment": "hi\n< > still part of the previous comment", + "comment": { + "links": [], + "text": "hi\n< > still part of the previous comment" + }, "name": { "kind": "Identifier", "pos": 14, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index f45eb771178a3..952060a2a7408 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "param" }, - "comment": "Description text follows", + "comment": { + "links": [], + "text": "Description text follows" + }, "typeExpression": { "kind": "JSDocTypeExpression", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index 0db3f02520e82..6cc10bebbbf6c 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "param" }, - "comment": "Description text follows", + "comment": { + "links": [], + "text": "Description text follows" + }, "typeExpression": { "kind": "JSDocTypeExpression", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index 71cb84f5ed793..bc8a4f356226c 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "param" }, - "comment": "Description text follows", + "comment": { + "links": [], + "text": "Description text follows" + }, "typeExpression": { "kind": "JSDocTypeExpression", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index a1bed4eb49b73..2dcd8265e1140 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "param" }, - "comment": "Description", + "comment": { + "links": [], + "text": "Description" + }, "typeExpression": { "kind": "JSDocTypeExpression", "pos": 21, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json index e243e4fb5e2f6..3e31a6d3be52c 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json @@ -21,7 +21,10 @@ "originalKeywordKind": "ReturnKeyword", "escapedText": "return" }, - "comment": "Description text follows", + "comment": { + "links": [], + "text": "Description text follows" + }, "typeExpression": { "kind": "JSDocTypeExpression", "pos": 16, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json index 874e64567fba5..74af8279a2dcb 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json @@ -20,7 +20,10 @@ "transformFlags": 0, "escapedText": "template" }, - "comment": "Description of type parameters.", + "comment": { + "links": [], + "text": "Description of type parameters." + }, "typeParameters": { "0": { "kind": "TypeParameter", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json index 6e8ff913426b1..7fa4e11e14113 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json @@ -5,5 +5,8 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, - "comment": "*" + "comment": { + "links": [], + "text": "*" + } } \ No newline at end of file From 90feb3ec96edd7b8724d6168f1952b0d56d522c4 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 3 Dec 2020 10:41:29 -0800 Subject: [PATCH 09/44] more tests and some fixes --- src/compiler/parser.ts | 26 +- src/services/jsDoc.ts | 29 ++- src/services/services.ts | 1 + src/services/symbolDisplay.ts | 2 +- src/testRunner/unittests/jsDocParsing.ts | 12 + ...ocComments.parsesCorrectly.@link tags.json | 39 ++- ...DocComments.parsesCorrectly.authorTag.json | 1 - .../reference/api/tsserverlibrary.d.ts | 227 ++++++++++-------- tests/baselines/reference/api/typescript.d.ts | 211 ++++++++-------- .../quickInfoForJSDocCodefence.baseline | 6 +- .../quickInfoForJSDocUnknownTag.baseline | 15 +- tests/cases/compiler/APISample_jsdoc.ts | 2 +- 12 files changed, 340 insertions(+), 231 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2b65de964ad88..63e8aa0abe4cb 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7283,6 +7283,7 @@ namespace ts { let tagsPos: number; let tagsEnd: number; const comments: string[] = []; + const links: JSDocLinkNode[] = []; // + 3 for leading /**, - 5 in total for /** */ return scanner.scanRange(start + 3, length - 5, () => { @@ -7355,6 +7356,17 @@ namespace ts { break; case SyntaxKind.EndOfFileToken: break loop; + case SyntaxKind.OpenBraceToken: + // TODO: Refactor in the same way as the other parser, and probably dedupe into a single function + if (lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) { + state = JSDocState.SavingComments; + // TODO: Maybe shouldn't use 1 as the length of { ? + const link = parseLink(scanner.getTextPos() - 1); + links.push(link) + pushComment(scanner.getText().slice(link.pos, link.end)); + break; + } + // fallthrough if it's not a {@link sequence default: // Anything else is doc comment text. We just save it. Because it // wasn't a tag, we can no longer parse a tag on this line until we hit the next @@ -7384,7 +7396,7 @@ namespace ts { function createJSDocComment(): JSDoc { // TODO: Parse links too! - const comment = comments.length ? { links: [], text: comments.join("") } : undefined; + const comment = comments.length ? { links, text: comments.join("") } : undefined; const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); return finishNode(factory.createJSDocComment(comment, tagsArray), start, end); } @@ -7522,7 +7534,6 @@ namespace ts { return parseTagComments(margin, indentText.slice(margin)); } - // TODO: Also needs to parse link tags function parseTagComments(indent: number, initialMargin?: string): JSDocComment | undefined { const comments: string[] = []; const links: JSDocLinkNode[] = []; @@ -7624,8 +7635,10 @@ namespace ts { function parseLink(start: number) { nextTokenJSDoc(); // @ nextTokenJSDoc(); // link - nextTokenJSDoc(); // ' ' - nextTokenJSDoc(); // first token + nextTokenJSDoc(); // ' ' TODO: make sure that each of these tokens after @link are actually the expected ones + nextTokenJSDoc(); // first token TODO: Skip multiple whitespace/newlines + // TODO: When failing, decide whether to parse a trailing }. Probably doesn't matter since the only thing we're interested inside comment text is `@` (and *, newline, etc) + // oh, except for `{@link}` should parse correctly const name = tokenIsIdentifierOrKeyword(token()) ? parseEntityName(/*allowReservedWords*/ true) : createMissingNode(SyntaxKind.Identifier, false); // don't try to parseEntityName, it'll assert // TODO: I'm pretty sure you getting a MissingIdentifier for a bad parse, or soething like that // in any case, most of the time you'll have `http` as the first identifier and you'll be fine @@ -7774,15 +7787,16 @@ namespace ts { } let comments = authorInfoWithEmail; + let links; if (lookAhead(() => nextToken() !== SyntaxKind.NewLineTrivia)) { - // TODO: This is wrong, there could be links in there const comment = parseTagComments(indent); if (comment) { comments += comment.text; + links = comment.links; } } - return finishNode(factory.createJSDocAuthorTag(tagName, { links: [], text: comments }), start); + return finishNode(factory.createJSDocAuthorTag(tagName, { links, text: comments }), start); } function tryParseAuthorNameAndEmail(): string | undefined { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 3729e4df80921..c834031c7c767 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -124,19 +124,24 @@ namespace ts.JsDoc { } function getLinks(tag: JSDocTag, checker: TypeChecker): JSDocLink[] | undefined { - if (tag.kind !== SyntaxKind.JSDocSeeTag) return; // TODO: Change this to look for @link not @see + const links = tag.comment?.links + if (links) { + return mapDefined(links, link => { + if (!link.name) return + // TODO: Test this, I think getSymbolAtLocation eventually calls checkQualifiedName and then returns resolvedSymbol, but it's hard to be sure + const symbol = checker.getSymbolAtLocation(link.name) + if (!symbol || !symbol.valueDeclaration) return + return { + fileName: getSourceFileOfNode(see).fileName, + textSpan: createTextSpanFromNode(see), + target: { + fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, + textSpan: createTextSpanFromNode(symbol.valueDeclaration) + } + } + }) + } const see = tag as JSDocSeeTag; - if (!see.name) return - const symbol = checker.getSymbolAtLocation(see.name) - if (!symbol || !symbol.valueDeclaration) return - return [{ - fileName: getSourceFileOfNode(see).fileName, - textSpan: createTextSpanFromNode(see), - target: { - fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, - textSpan: createTextSpanFromNode(symbol.valueDeclaration) - } - }] } function getCommentText(tag: JSDocTag): string | undefined { diff --git a/src/services/services.ts b/src/services/services.ts index 7d0c16a184480..cb2848859f7fb 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -359,6 +359,7 @@ namespace ts { } } + // TODO: Maybe link symbol resolution should be lazy so this function doesn't need to provide a checker getJsDocTags(checker: TypeChecker): JSDocTagInfo[] { if (this.tags === undefined) { this.tags = JsDoc.getJsDocTagsFromDeclarations(checker, this.declarations); diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index 83daf83e5c71a..85f6c5c7cc63e 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -422,7 +422,7 @@ namespace ts.SymbolDisplay { } else { documentationFromAlias = resolvedSymbol.getContextualDocumentationComment(resolvedNode, typeChecker); - tagsFromAlias = resolvedSymbol.getJsDocTags(); + tagsFromAlias = resolvedSymbol.getJsDocTags(typeChecker); } } } diff --git a/src/testRunner/unittests/jsDocParsing.ts b/src/testRunner/unittests/jsDocParsing.ts index af21d76dcd119..1af7fff1c3b62 100644 --- a/src/testRunner/unittests/jsDocParsing.ts +++ b/src/testRunner/unittests/jsDocParsing.ts @@ -317,6 +317,18 @@ namespace ts { * @param foo See also {@link A.Reference} * @param bar Or see {@link http://www.zombocom.com } * {@link Standalone.Complex } + * This empty one: {@link} is OK. + * This double-space one: {@link doubled } is OK too. + * This should work, despite being badly formatted: {@link +oh.no +} + * Forgot to close this one {@link https://typescriptlang.org + * But it's still OK. + * And it shouldn't mess up subsequent margins (I hope). + * This shouldn't work: {@link + * nope + * }, because of the intermediate asterisks. + * @author Alfa Romero See my home page: {@link https://example.com} */`); parsesCorrectly("authorTag", `/** diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index 3bac5d7293d01..4025f1012b421 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -1,12 +1,43 @@ { "kind": "JSDocComment", "pos": 0, - "end": 187, + "end": 646, "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "links": [], + "links": [ + { + "kind": "JSDocLink", + "pos": 7, + "end": 21, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 14, + "end": 19, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "first" + } + }, + { + "kind": "JSDocLink", + "pos": 32, + "end": 49, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 39, + "end": 43, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "link" + } + } + ], "text": "{@link first }\nInside {@link link text} thing" }, "tags": { @@ -73,7 +104,7 @@ "1": { "kind": "JSDocParameterTag", "pos": 102, - "end": 185, + "end": 569, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -147,7 +178,7 @@ }, "length": 2, "pos": 59, - "end": 185, + "end": 644, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index 74efc16131063..75fb3c7ea8856 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -21,7 +21,6 @@ "escapedText": "author" }, "comment": { - "links": [], "text": "John Doe " } }, diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index c269e0f0b0be2..abcd862f12813 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -418,34 +418,35 @@ declare namespace ts { JSDocComment = 311, JSDocTypeLiteral = 312, JSDocSignature = 313, - JSDocTag = 314, - JSDocAugmentsTag = 315, - JSDocImplementsTag = 316, - JSDocAuthorTag = 317, - JSDocDeprecatedTag = 318, - JSDocClassTag = 319, - JSDocPublicTag = 320, - JSDocPrivateTag = 321, - JSDocProtectedTag = 322, - JSDocReadonlyTag = 323, - JSDocCallbackTag = 324, - JSDocEnumTag = 325, - JSDocParameterTag = 326, - JSDocReturnTag = 327, - JSDocThisTag = 328, - JSDocTypeTag = 329, - JSDocTemplateTag = 330, - JSDocTypedefTag = 331, - JSDocSeeTag = 332, - JSDocPropertyTag = 333, - SyntaxList = 334, - NotEmittedStatement = 335, - PartiallyEmittedExpression = 336, - CommaListExpression = 337, - MergeDeclarationMarker = 338, - EndOfDeclarationMarker = 339, - SyntheticReferenceExpression = 340, - Count = 341, + JSDocLink = 314, + JSDocTag = 315, + JSDocAugmentsTag = 316, + JSDocImplementsTag = 317, + JSDocAuthorTag = 318, + JSDocDeprecatedTag = 319, + JSDocClassTag = 320, + JSDocPublicTag = 321, + JSDocPrivateTag = 322, + JSDocProtectedTag = 323, + JSDocReadonlyTag = 324, + JSDocCallbackTag = 325, + JSDocEnumTag = 326, + JSDocParameterTag = 327, + JSDocReturnTag = 328, + JSDocThisTag = 329, + JSDocTypeTag = 330, + JSDocTemplateTag = 331, + JSDocTypedefTag = 332, + JSDocSeeTag = 333, + JSDocPropertyTag = 334, + SyntaxList = 335, + NotEmittedStatement = 336, + PartiallyEmittedExpression = 337, + CommaListExpression = 338, + MergeDeclarationMarker = 339, + EndOfDeclarationMarker = 340, + SyntheticReferenceExpression = 341, + Count = 342, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -474,9 +475,9 @@ declare namespace ts { LastStatement = 248, FirstNode = 157, FirstJSDocNode = 301, - LastJSDocNode = 333, - FirstJSDocTagNode = 314, - LastJSDocTagNode = 333, + LastJSDocNode = 334, + FirstJSDocTagNode = 315, + LastJSDocTagNode = 334, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -1741,12 +1742,20 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: string; + readonly comment?: JSDocComment; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: string; + readonly comment?: JSDocComment; + } + export interface JSDocLinkNode extends Node { + readonly kind: SyntaxKind.JSDocLink; + readonly name?: EntityName; + } + export interface JSDocComment { + text: string; + links?: JSDocLinkNode[]; } export interface JSDocUnknownTag extends JSDocTag { readonly kind: SyntaxKind.JSDocTag; @@ -3452,52 +3461,54 @@ declare namespace ts { updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName): JSDocNameReference; updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference; + createJSDocLinkNode(name: EntityName): JSDocLinkNode; + updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: string): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: string): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: string): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: string): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string): JSDocDeprecatedTag; - createJSDocComment(comment?: string | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: string | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocComment | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocComment): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocComment | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocComment): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocComment | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: JSDocComment): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; + createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -5286,7 +5297,7 @@ declare namespace ts { getName(): string; getDeclarations(): Declaration[] | undefined; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; - getJsDocTags(): JSDocTagInfo[]; + getJsDocTags(checker: TypeChecker): JSDocTagInfo[]; } interface Type { getFlags(): TypeFlags; @@ -5980,6 +5991,10 @@ declare namespace ts { interface JSDocTagInfo { name: string; text?: string; + links?: readonly JSDocLink[]; + } + interface JSDocLink extends DocumentSpan { + target: DocumentSpan; } interface QuickInfo { kind: ScriptElementKind; @@ -5987,7 +6002,7 @@ declare namespace ts { textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: JSDocTagInfo[]; + tags?: readonly JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; interface RenameInfoSuccess { @@ -6034,7 +6049,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; - tags: JSDocTagInfo[]; + tags: readonly JSDocTagInfo[]; } /** * Represents a set of signature help items, and the preferred item that should be selected. @@ -6086,7 +6101,7 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: JSDocTagInfo[]; + tags?: readonly JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; } @@ -7185,6 +7200,14 @@ declare namespace ts.server.protocol { */ file: string; } + interface JSDocTagInfo { + name: string; + text?: string; + links?: readonly JSDocLink[]; + } + interface JSDocLink extends DocumentSpan { + target: FileSpan; + } interface TextSpanWithContext extends TextSpan { contextStart?: Location; contextEnd?: Location; @@ -7912,7 +7935,7 @@ declare namespace ts.server.protocol { /** * JSDoc tags associated with symbol. */ - tags: JSDocTagInfo[]; + tags: readonly JSDocTagInfo[]; } /** * Quickinfo response message. @@ -8184,7 +8207,7 @@ declare namespace ts.server.protocol { /** * JSDoc tags for the symbol. */ - tags?: JSDocTagInfo[]; + tags?: readonly JSDocTagInfo[]; /** * The associated code actions for this entry */ @@ -8267,8 +8290,9 @@ declare namespace ts.server.protocol { documentation: SymbolDisplayPart[]; /** * The signature's JSDoc tags + * TODO: Changing this doesn't cause the build to fail! Need tests and probably a scan of session.ts */ - tags: JSDocTagInfo[]; + tags: readonly JSDocTagInfo[]; } /** * Signature help items found in the response of a signature help request. @@ -9960,6 +9984,7 @@ declare namespace ts.server { private mapDefinitionInfoLocations; private getDefinitionAndBoundSpan; private getEmitOutput; + private mapJSDocTagInfo; private mapDefinitionInfo; private static mapToOriginalLocation; private toFileSpan; @@ -10543,51 +10568,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: JSDocComment | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: string | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocComment | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | undefined) => JSDocAugmentsTag; + }, comment?: JSDocComment | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocComment | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocComment | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocComment | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | undefined) => JSDocImplementsTag; + }, comment?: JSDocComment | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: string | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: JSDocComment | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index f985d34fdd3c8..202d63af3de81 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -418,34 +418,35 @@ declare namespace ts { JSDocComment = 311, JSDocTypeLiteral = 312, JSDocSignature = 313, - JSDocTag = 314, - JSDocAugmentsTag = 315, - JSDocImplementsTag = 316, - JSDocAuthorTag = 317, - JSDocDeprecatedTag = 318, - JSDocClassTag = 319, - JSDocPublicTag = 320, - JSDocPrivateTag = 321, - JSDocProtectedTag = 322, - JSDocReadonlyTag = 323, - JSDocCallbackTag = 324, - JSDocEnumTag = 325, - JSDocParameterTag = 326, - JSDocReturnTag = 327, - JSDocThisTag = 328, - JSDocTypeTag = 329, - JSDocTemplateTag = 330, - JSDocTypedefTag = 331, - JSDocSeeTag = 332, - JSDocPropertyTag = 333, - SyntaxList = 334, - NotEmittedStatement = 335, - PartiallyEmittedExpression = 336, - CommaListExpression = 337, - MergeDeclarationMarker = 338, - EndOfDeclarationMarker = 339, - SyntheticReferenceExpression = 340, - Count = 341, + JSDocLink = 314, + JSDocTag = 315, + JSDocAugmentsTag = 316, + JSDocImplementsTag = 317, + JSDocAuthorTag = 318, + JSDocDeprecatedTag = 319, + JSDocClassTag = 320, + JSDocPublicTag = 321, + JSDocPrivateTag = 322, + JSDocProtectedTag = 323, + JSDocReadonlyTag = 324, + JSDocCallbackTag = 325, + JSDocEnumTag = 326, + JSDocParameterTag = 327, + JSDocReturnTag = 328, + JSDocThisTag = 329, + JSDocTypeTag = 330, + JSDocTemplateTag = 331, + JSDocTypedefTag = 332, + JSDocSeeTag = 333, + JSDocPropertyTag = 334, + SyntaxList = 335, + NotEmittedStatement = 336, + PartiallyEmittedExpression = 337, + CommaListExpression = 338, + MergeDeclarationMarker = 339, + EndOfDeclarationMarker = 340, + SyntheticReferenceExpression = 341, + Count = 342, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -474,9 +475,9 @@ declare namespace ts { LastStatement = 248, FirstNode = 157, FirstJSDocNode = 301, - LastJSDocNode = 333, - FirstJSDocTagNode = 314, - LastJSDocTagNode = 333, + LastJSDocNode = 334, + FirstJSDocTagNode = 315, + LastJSDocTagNode = 334, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -1741,12 +1742,20 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: string; + readonly comment?: JSDocComment; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: string; + readonly comment?: JSDocComment; + } + export interface JSDocLinkNode extends Node { + readonly kind: SyntaxKind.JSDocLink; + readonly name?: EntityName; + } + export interface JSDocComment { + text: string; + links?: JSDocLinkNode[]; } export interface JSDocUnknownTag extends JSDocTag { readonly kind: SyntaxKind.JSDocTag; @@ -3452,52 +3461,54 @@ declare namespace ts { updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName): JSDocNameReference; updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference; + createJSDocLinkNode(name: EntityName): JSDocLinkNode; + updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: string): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: string): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: string): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: string): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string): JSDocDeprecatedTag; - createJSDocComment(comment?: string | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: string | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocComment | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocComment): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocComment | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocComment): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocComment | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: JSDocComment): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; + createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -5286,7 +5297,7 @@ declare namespace ts { getName(): string; getDeclarations(): Declaration[] | undefined; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; - getJsDocTags(): JSDocTagInfo[]; + getJsDocTags(checker: TypeChecker): JSDocTagInfo[]; } interface Type { getFlags(): TypeFlags; @@ -5980,6 +5991,10 @@ declare namespace ts { interface JSDocTagInfo { name: string; text?: string; + links?: readonly JSDocLink[]; + } + interface JSDocLink extends DocumentSpan { + target: DocumentSpan; } interface QuickInfo { kind: ScriptElementKind; @@ -5987,7 +6002,7 @@ declare namespace ts { textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: JSDocTagInfo[]; + tags?: readonly JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; interface RenameInfoSuccess { @@ -6034,7 +6049,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; - tags: JSDocTagInfo[]; + tags: readonly JSDocTagInfo[]; } /** * Represents a set of signature help items, and the preferred item that should be selected. @@ -6086,7 +6101,7 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: JSDocTagInfo[]; + tags?: readonly JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; } @@ -6903,51 +6918,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: JSDocComment | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: string | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocComment | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | undefined) => JSDocAugmentsTag; + }, comment?: JSDocComment | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocComment | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocComment | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocComment | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | undefined) => JSDocImplementsTag; + }, comment?: JSDocComment | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: string | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: JSDocComment | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/quickInfoForJSDocCodefence.baseline b/tests/baselines/reference/quickInfoForJSDocCodefence.baseline index a88755fefc947..05cb7ddd4aa34 100644 --- a/tests/baselines/reference/quickInfoForJSDocCodefence.baseline +++ b/tests/baselines/reference/quickInfoForJSDocCodefence.baseline @@ -49,7 +49,8 @@ "tags": [ { "name": "example", - "text": "```\n1 + 2\n```" + "text": "```\n1 + 2\n```", + "links": [] } ] } @@ -104,7 +105,8 @@ "tags": [ { "name": "example", - "text": "``\n1 + 2\n`" + "text": "``\n1 + 2\n`", + "links": [] } ] } diff --git a/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline b/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline index 25b2f8fe9c0fa..c0f9fff5abe8e 100644 --- a/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline +++ b/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline @@ -49,7 +49,8 @@ "tags": [ { "name": "example", - "text": "if (true) {\n foo()\n}" + "text": "if (true) {\n foo()\n}", + "links": [] } ] } @@ -104,7 +105,8 @@ "tags": [ { "name": "example", - "text": "{\n foo()\n}" + "text": "{\n foo()\n}", + "links": [] } ] } @@ -159,7 +161,8 @@ "tags": [ { "name": "example", - "text": " x y\n 12345\n b" + "text": " x y\n 12345\n b", + "links": [] } ] } @@ -217,7 +220,8 @@ }, { "name": "example", - "text": " x y\n 12345\n b" + "text": " x y\n 12345\n b", + "links": [] } ] } @@ -275,7 +279,8 @@ }, { "name": "example", - "text": "x y\n12345\n b" + "text": "x y\n12345\n b", + "links": [] } ] } diff --git a/tests/cases/compiler/APISample_jsdoc.ts b/tests/cases/compiler/APISample_jsdoc.ts index 1ca3c88e5507a..8a7ad0d0a91ac 100644 --- a/tests/cases/compiler/APISample_jsdoc.ts +++ b/tests/cases/compiler/APISample_jsdoc.ts @@ -39,7 +39,7 @@ function parseCommentsIntoDefinition(this: any, } // jsdocs are separate from comments - const jsdocs = symbol.getJsDocTags(); + const jsdocs = symbol.getJsDocTags(this.checker); jsdocs.forEach(doc => { // if we have @TJS-... annotations, we have to parse them const { name, text } = doc; From fc813c2b728d6bb1cb3372220c16147f62a37128 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 7 Dec 2020 11:38:02 -0800 Subject: [PATCH 10/44] Fix other failing tests --- src/compiler/emitter.ts | 4 +- src/compiler/parser.ts | 26 ++-- src/harness/client.ts | 12 +- src/harness/fourslashImpl.ts | 2 +- src/server/session.ts | 2 +- src/services/jsDoc.ts | 14 +- src/testRunner/unittests/jsDocParsing.ts | 2 +- .../unittests/tsserver/completions.ts | 3 +- tests/baselines/reference/APISample_jsdoc.js | 8 +- ...ocComments.parsesCorrectly.@link tags.json | 135 +++++++++++++++++- tests/baselines/reference/jsDocTags.baseline | 27 ++-- .../quickInfoDisplayPartsParameters.baseline | 3 +- .../reference/quickInfoJsDocTags.baseline | 21 ++- tests/cases/compiler/APISample_jsdoc.ts | 2 +- .../fourslash/codeFixInferFromUsageJS.ts | 2 +- .../codeFixInferFromUsageMemberJS.ts | 4 +- .../codeFixInferFromUsageVariable2JS.ts | 4 +- .../codeFixInferFromUsageVariableJS.ts | 2 +- .../fourslash/codeFixInferFromUsage_allJS.ts | 4 +- tests/cases/fourslash/commentsClassMembers.ts | 4 +- .../cases/fourslash/commentsCommentParsing.ts | 36 ++--- .../fourslash/commentsFunctionExpression.ts | 20 +-- .../completionEntryForUnionMethod.ts | 4 +- tests/cases/fourslash/jsDocTags.ts | 2 +- ...lsaMethodsOnAssignedFunctionExpressions.ts | 2 +- .../completionEntryDetailAcrossFiles01.ts | 2 +- .../completionEntryDetailAcrossFiles02.ts | 4 +- tests/cases/fourslash/server/completions02.ts | 4 +- 28 files changed, 252 insertions(+), 103 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 03b8e160fc240..1d42d97474ad1 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3512,7 +3512,7 @@ namespace ts { // function emitJSDoc(node: JSDoc) { write("/**"); - if (node.comment) { + if (node.comment?.text) { const lines = node.comment.text.split(/\r\n?|\n/g); for (const line of lines) { writeLine(); @@ -3653,7 +3653,7 @@ namespace ts { } function emitJSDocComment(comment: JSDocComment | undefined) { - if (comment) { + if (comment?.text) { writeSpace(); write(comment.text); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7bd6065da9793..f64beb7a184eb 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7359,7 +7359,7 @@ namespace ts { state = JSDocState.SavingComments; // TODO: Maybe shouldn't use 1 as the length of { ? const link = parseLink(scanner.getTextPos() - 1); - links.push(link) + links.push(link); pushComment(scanner.getText().slice(link.pos, link.end)); break; } @@ -7588,9 +7588,9 @@ namespace ts { // TODO: Put a manual `tok = nextTokenJSDoc()` here and only call `lookAhead` if its AtToken. // THat means I'll have to save getTextPos *before* the nextTokenJSDoc and unconditionally `continue` afterward if (lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) { - const link = parseLink(scanner.getTextPos() - 1) - links.push(link) - pushComment(scanner.getText().slice(link.pos, link.end)) + const link = parseLink(scanner.getTextPos() - 1); + links.push(link); + pushComment(scanner.getText().slice(link.pos, link.end)); } else { pushComment(scanner.getTokenText()); @@ -7632,19 +7632,17 @@ namespace ts { function parseLink(start: number) { nextTokenJSDoc(); // @ nextTokenJSDoc(); // link - nextTokenJSDoc(); // ' ' TODO: make sure that each of these tokens after @link are actually the expected ones - nextTokenJSDoc(); // first token TODO: Skip multiple whitespace/newlines - // TODO: When failing, decide whether to parse a trailing }. Probably doesn't matter since the only thing we're interested inside comment text is `@` (and *, newline, etc) - // oh, except for `{@link}` should parse correctly - const name = tokenIsIdentifierOrKeyword(token()) ? parseEntityName(/*allowReservedWords*/ true) : createMissingNode(SyntaxKind.Identifier, false); // don't try to parseEntityName, it'll assert - // TODO: I'm pretty sure you getting a MissingIdentifier for a bad parse, or soething like that - // in any case, most of the time you'll have `http` as the first identifier and you'll be fine - // now skip past everything including a close brace. - // .. also stop at newlines (TODO: Measure this (it's probably fine, and the penalty for being wrong is just a too-small span), and then write tests) + + nextTokenJSDoc(); // start at token after link, then skip any whitespace + skipWhitespace(); + // parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error + const name = tokenIsIdentifierOrKeyword(token()) + ? parseEntityName(/*allowReservedWords*/ true) + : createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ false); while (token() !== SyntaxKind.CloseBraceToken && token() !== SyntaxKind.NewLineTrivia) { nextTokenJSDoc(); } - return finishNode(factory.createJSDocLinkNode(name), start, scanner.getTextPos()) + return finishNode(factory.createJSDocLinkNode(name), start, scanner.getTextPos()); } function parseUnknownTag(start: number, tagName: Identifier, indent: number, indentText: string) { diff --git a/src/harness/client.ts b/src/harness/client.ts index 200769cf0eeb4..4624eb316ecf7 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -518,7 +518,7 @@ namespace ts.server { lineMap = lineMap || this.getLineMap(fileName); return createTextSpanFromBounds( this.lineOffsetToPosition(fileName, span.start, lineMap), - this.lineOffsetToPosition(fileName, span.end, lineMap)); + this.lineOffsetToPosition(fileName, Debug.checkDefined(span.end, JSON.stringify(span)), lineMap)); } private decodeLink(tags: readonly protocol.JSDocTagInfo[]): readonly JSDocTagInfo[] { @@ -527,11 +527,12 @@ namespace ts.server { links: tag.links?.map(link => ({ ...link, target: { - textSpan: this.decodeSpan(link.target), + // TODO: May still need to decode MOST of the link.targets + textSpan: link.target as unknown as TextSpan, fileName: link.target.file, } })) - })) + })); } getNameOrDottedNameSpan(_fileName: string, _startPos: number, _endPos: number): TextSpan { @@ -554,8 +555,9 @@ namespace ts.server { const { items: encodedItems, applicableSpan: encodedApplicableSpan, selectedItemIndex, argumentIndex, argumentCount } = response.body; - const applicableSpan = this.decodeSpan(encodedApplicableSpan, fileName); - const items = encodedItems.map(item => ({ ...item, tags: this.decodeLink(item.tags) })) + // TODO: I thought that applicable span was a protocol span now?! I guess not. + const applicableSpan = encodedApplicableSpan as unknown as TextSpan; //this.decodeSpan(encodedApplicableSpan, fileName); + const items = encodedItems.map(item => ({ ...item, tags: this.decodeLink(item.tags) })); return { items, applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; } diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 6af8cea9d039b..0823bed839176 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -932,7 +932,7 @@ namespace FourSlash { // assert.equal(actualDetails.kind, actual.kind); assert.equal(actualDetails.kindModifiers, actual.kindModifiers, "Expected 'kindModifiers' properties to match"); assert.equal(actualDetails.source && ts.displayPartsToString(actualDetails.source), expected.sourceDisplay, "Expected 'sourceDisplay' property to match 'source' display parts string"); - assert.deepEqual(actualDetails.tags, expected.tags); + assert.deepEqual(actualDetails.tags, expected.tags, "Try harder, chai:" + JSON.stringify(actualDetails) + "\n" + JSON.stringify(expected) + " at " + this.lastKnownMarker); } else { assert(expected.documentation === undefined && expected.tags === undefined && expected.sourceDisplay === undefined, "If specifying completion details, should specify 'text'"); diff --git a/src/server/session.ts b/src/server/session.ts index 521d511d64783..260ea36e7cd33 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1260,7 +1260,7 @@ namespace ts.server { links: links?.map(link => ({ ...link, target: this.toFileSpan(link.target.fileName, link.target.textSpan, project), - }))})) + }))})); } private mapDefinitionInfo(definitions: readonly DefinitionInfo[], project: Project): readonly protocol.FileSpanWithContext[] { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index c834031c7c767..b759e0b184c3d 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -124,13 +124,13 @@ namespace ts.JsDoc { } function getLinks(tag: JSDocTag, checker: TypeChecker): JSDocLink[] | undefined { - const links = tag.comment?.links + const links = tag.comment?.links; if (links) { return mapDefined(links, link => { - if (!link.name) return + if (!link.name) return; // TODO: Test this, I think getSymbolAtLocation eventually calls checkQualifiedName and then returns resolvedSymbol, but it's hard to be sure - const symbol = checker.getSymbolAtLocation(link.name) - if (!symbol || !symbol.valueDeclaration) return + const symbol = checker.getSymbolAtLocation(link.name); + if (!symbol || !symbol.valueDeclaration) return; return { fileName: getSourceFileOfNode(see).fileName, textSpan: createTextSpanFromNode(see), @@ -138,8 +138,8 @@ namespace ts.JsDoc { fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, textSpan: createTextSpanFromNode(symbol.valueDeclaration) } - } - }) + }; + }); } const see = tag as JSDocSeeTag; } @@ -175,7 +175,7 @@ namespace ts.JsDoc { } function addComment(s: string) { - return comment === undefined ? s : `${s} ${comment}`; + return comment === undefined ? s : `${s} ${comment.text}`; } } diff --git a/src/testRunner/unittests/jsDocParsing.ts b/src/testRunner/unittests/jsDocParsing.ts index 1af7fff1c3b62..7f076c99cb0b9 100644 --- a/src/testRunner/unittests/jsDocParsing.ts +++ b/src/testRunner/unittests/jsDocParsing.ts @@ -324,7 +324,7 @@ oh.no } * Forgot to close this one {@link https://typescriptlang.org * But it's still OK. - * And it shouldn't mess up subsequent margins (I hope). + * Although it skips the newline so parses the asterisks in the wrong state. * This shouldn't work: {@link * nope * }, because of the intermediate asterisks. diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index 2117d8924aa0c..0770ef1e78301 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -68,7 +68,6 @@ namespace ts.projectSystem { kindModifiers: ScriptElementKindModifier.exportedModifier, name: "foo", source: [{ text: "./a", kind: "text" }], - tags: undefined, }; assert.deepEqual(detailsResponse, [ { @@ -90,6 +89,7 @@ namespace ts.projectSystem { commands: undefined, }, ], + tags: [], ...detailsCommon, }, ]); @@ -116,6 +116,7 @@ namespace ts.projectSystem { commands: undefined, } ], + tags: undefined, ...detailsCommon, } ]); diff --git a/tests/baselines/reference/APISample_jsdoc.js b/tests/baselines/reference/APISample_jsdoc.js index 9c1dd5f824fdb..50288c1237ea5 100644 --- a/tests/baselines/reference/APISample_jsdoc.js +++ b/tests/baselines/reference/APISample_jsdoc.js @@ -35,7 +35,7 @@ function parseCommentsIntoDefinition(this: any, } // jsdocs are separate from comments - const jsdocs = symbol.getJsDocTags(); + const jsdocs = symbol.getJsDocTags(this.checker); jsdocs.forEach(doc => { // if we have @TJS-... annotations, we have to parse them const { name, text } = doc; @@ -59,7 +59,7 @@ function getAnnotations(this: any, node: ts.Node): Annotations | undefined { return undefined; } - const jsDocTags: ts.JSDocTagInfo[] = symbol.getJsDocTags(); + const jsDocTags: ts.JSDocTagInfo[] = symbol.getJsDocTags(this.checker); if (!jsDocTags || !jsDocTags.length) { return undefined; } @@ -143,7 +143,7 @@ function parseCommentsIntoDefinition(symbol, definition, otherAnnotations) { definition.description = comments.map(function (comment) { return comment.kind === "lineBreak" ? comment.text : comment.text.trim().replace(/\r\n/g, "\n"); }).join(""); } // jsdocs are separate from comments - var jsdocs = symbol.getJsDocTags(); + var jsdocs = symbol.getJsDocTags(this.checker); jsdocs.forEach(function (doc) { // if we have @TJS-... annotations, we have to parse them var name = doc.name, text = doc.text; @@ -162,7 +162,7 @@ function getAnnotations(node) { if (!symbol) { return undefined; } - var jsDocTags = symbol.getJsDocTags(); + var jsDocTags = symbol.getJsDocTags(this.checker); if (!jsDocTags || !jsDocTags.length) { return undefined; } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index 4025f1012b421..33b6a96b9dbda 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -1,7 +1,7 @@ { "kind": "JSDocComment", "pos": 0, - "end": 646, + "end": 674, "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, @@ -104,7 +104,7 @@ "1": { "kind": "JSDocParameterTag", "pos": 102, - "end": 569, + "end": 589, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -161,9 +161,99 @@ "escapedText": "Complex" } } + }, + { + "kind": "JSDocLink", + "pos": 203, + "end": 210, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 209, + "end": 209, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "" + } + }, + { + "kind": "JSDocLink", + "pos": 244, + "end": 262, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 252, + "end": 259, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "doubled" + } + }, + { + "kind": "JSDocLink", + "pos": 326, + "end": 340, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "FirstNode", + "pos": 333, + "end": 338, + "modifierFlagsCache": 0, + "transformFlags": 0, + "left": { + "kind": "Identifier", + "pos": 333, + "end": 335, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "oh" + }, + "right": { + "kind": "Identifier", + "pos": 336, + "end": 338, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "no" + } + } + }, + { + "kind": "JSDocLink", + "pos": 369, + "end": 403, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 376, + "end": 381, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "https" + } + }, + { + "kind": "JSDocLink", + "pos": 526, + "end": 541, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 534, + "end": 534, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "" + } } ], - "text": "Or see {@link http://www.zombocom.com }\n{@link Standalone.Complex }" + "text": "Or see {@link http://www.zombocom.com }\n{@link Standalone.Complex }\nThis empty one: {@link} is OK.\nThis double-space one: {@link doubled } is OK too.\nThis should work, despite being badly formatted: {@link\noh.no\n}\nForgot to close this one {@link https://typescriptlang.org\n * But it's still OK.\nAlthough it skips the newline so parses the asterisks in the wrong state.\nThis shouldn't work: {@link\n * nope\n * }, because of the intermediate asterisks." }, "name": { "kind": "Identifier", @@ -176,9 +266,44 @@ "isNameFirst": true, "isBracketed": false }, - "length": 2, + "2": { + "kind": "JSDocAuthorTag", + "pos": 589, + "end": 672, + "modifierFlagsCache": 0, + "transformFlags": 0, + "tagName": { + "kind": "Identifier", + "pos": 590, + "end": 596, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "author" + }, + "comment": { + "links": [ + { + "kind": "JSDocLink", + "pos": 643, + "end": 670, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 650, + "end": 655, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "https" + } + } + ], + "text": "Alfa Romero See my home page: {@link https://example.com}" + } + }, + "length": 3, "pos": 59, - "end": 644, + "end": 672, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/jsDocTags.baseline b/tests/baselines/reference/jsDocTags.baseline index f316a9c42459d..88d265e260df1 100644 --- a/tests/baselines/reference/jsDocTags.baseline +++ b/tests/baselines/reference/jsDocTags.baseline @@ -70,7 +70,8 @@ "tags": [ { "name": "myjsdoctag", - "text": "this is a comment" + "text": "this is a comment", + "links": [] } ] } @@ -116,7 +117,8 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": "comment1 comment2", + "links": [] } ] } @@ -192,7 +194,8 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": "comment1 comment2", + "links": [] } ] } @@ -345,7 +348,8 @@ "tags": [ { "name": "returns", - "text": "a value" + "text": "a value", + "links": [] } ] } @@ -438,11 +442,13 @@ "tags": [ { "name": "param", - "text": "foo A value." + "text": "foo A value.", + "links": [] }, { "name": "returns", - "text": "Another value" + "text": "Another value", + "links": [] }, { "name": "mytag" @@ -508,7 +514,8 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": "comment1 comment2", + "links": [] } ] } @@ -571,11 +578,13 @@ "tags": [ { "name": "mytag1", - "text": "some comments\nsome more comments about mytag1" + "text": "some comments\nsome more comments about mytag1", + "links": [] }, { "name": "mytag2", - "text": "here all the comments are on a new line" + "text": "here all the comments are on a new line", + "links": [] }, { "name": "mytag3" diff --git a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline index c9bb71314dee3..ef4c9dae2f888 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline @@ -157,7 +157,8 @@ "tags": [ { "name": "return", - "text": "*crunch*" + "text": "*crunch*", + "links": [] } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTags.baseline b/tests/baselines/reference/quickInfoJsDocTags.baseline index 5717757a38294..73b345ce8f35c 100644 --- a/tests/baselines/reference/quickInfoJsDocTags.baseline +++ b/tests/baselines/reference/quickInfoJsDocTags.baseline @@ -74,15 +74,18 @@ }, { "name": "augments", - "text": "C Augments it" + "text": "C Augments it", + "links": [] }, { "name": "template", - "text": "T A template" + "text": "T A template", + "links": [] }, { "name": "type", - "text": "{number | string} A type" + "text": "{number | string} A type", + "links": [] }, { "name": "typedef", @@ -90,19 +93,23 @@ }, { "name": "property", - "text": "{number} x The prop" + "text": "{number} x The prop", + "links": [] }, { "name": "param", - "text": "x The param" + "text": "x The param", + "links": [] }, { "name": "returns", - "text": "The result" + "text": "The result", + "links": [] }, { "name": "see", - "text": "x (the parameter)" + "text": "x (the parameter)", + "links": [] } ] } diff --git a/tests/cases/compiler/APISample_jsdoc.ts b/tests/cases/compiler/APISample_jsdoc.ts index 8a7ad0d0a91ac..22f98f4797f36 100644 --- a/tests/cases/compiler/APISample_jsdoc.ts +++ b/tests/cases/compiler/APISample_jsdoc.ts @@ -63,7 +63,7 @@ function getAnnotations(this: any, node: ts.Node): Annotations | undefined { return undefined; } - const jsDocTags: ts.JSDocTagInfo[] = symbol.getJsDocTags(); + const jsDocTags: ts.JSDocTagInfo[] = symbol.getJsDocTags(this.checker); if (!jsDocTags || !jsDocTags.length) { return undefined; } diff --git a/tests/cases/fourslash/codeFixInferFromUsageJS.ts b/tests/cases/fourslash/codeFixInferFromUsageJS.ts index be36fec5825ed..dea3fec2d529c 100644 --- a/tests/cases/fourslash/codeFixInferFromUsageJS.ts +++ b/tests/cases/fourslash/codeFixInferFromUsageJS.ts @@ -9,4 +9,4 @@ //// foo += 2; ////} -verify.rangeAfterCodeFix("/** @type {number} */\nvar foo;",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0); +verify.rangeAfterCodeFix("/**\n * @type {number}\n*/\nvar foo;",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0); diff --git a/tests/cases/fourslash/codeFixInferFromUsageMemberJS.ts b/tests/cases/fourslash/codeFixInferFromUsageMemberJS.ts index f53c89b6fccbd..15b81c687ba36 100644 --- a/tests/cases/fourslash/codeFixInferFromUsageMemberJS.ts +++ b/tests/cases/fourslash/codeFixInferFromUsageMemberJS.ts @@ -30,7 +30,9 @@ verify.codeFixAll({ * @type {number[] | undefined} */ this.p = undefined; - /** @type {number[] | undefined} */ + /** + * @type {number[] | undefined} + */ this.q = undefined } method() { diff --git a/tests/cases/fourslash/codeFixInferFromUsageVariable2JS.ts b/tests/cases/fourslash/codeFixInferFromUsageVariable2JS.ts index 27482acf37713..2d96438e68d39 100644 --- a/tests/cases/fourslash/codeFixInferFromUsageVariable2JS.ts +++ b/tests/cases/fourslash/codeFixInferFromUsageVariable2JS.ts @@ -10,7 +10,9 @@ //// x++; ////}|] -verify.rangeAfterCodeFix(`/** @type {number} */ +verify.rangeAfterCodeFix(`/** + * @type {number} + */ var x; function f() { x++; diff --git a/tests/cases/fourslash/codeFixInferFromUsageVariableJS.ts b/tests/cases/fourslash/codeFixInferFromUsageVariableJS.ts index bbd5409a25ca3..ee74512e5f71a 100644 --- a/tests/cases/fourslash/codeFixInferFromUsageVariableJS.ts +++ b/tests/cases/fourslash/codeFixInferFromUsageVariableJS.ts @@ -11,4 +11,4 @@ //// x++; ////} -verify.rangeAfterCodeFix("/** @type {number } */\nvar x;", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0); +verify.rangeAfterCodeFix("/**\n * @type {number}\n*/\nvar x;", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0); diff --git a/tests/cases/fourslash/codeFixInferFromUsage_allJS.ts b/tests/cases/fourslash/codeFixInferFromUsage_allJS.ts index 00e44660a9848..f85461c4f4de5 100644 --- a/tests/cases/fourslash/codeFixInferFromUsage_allJS.ts +++ b/tests/cases/fourslash/codeFixInferFromUsage_allJS.ts @@ -40,7 +40,9 @@ function g(z) { return z * 2; } -/** @type {number | null} */ +/** + * @type {number | null} + */ let x = null; function h() { if (!x) x = 2; diff --git a/tests/cases/fourslash/commentsClassMembers.ts b/tests/cases/fourslash/commentsClassMembers.ts index 1e17f0327fe7e..e2054401bfa3f 100644 --- a/tests/cases/fourslash/commentsClassMembers.ts +++ b/tests/cases/fourslash/commentsClassMembers.ts @@ -222,7 +222,7 @@ verify.completions( name: "a", text: "(property) cWithConstructorProperty.a: number", documentation: "more info about a\nthis is first parameter a", - tags: [{ name: "param", text: "a this is first parameter a" }], + tags: [{ links:[], name: "param", text: "a this is first parameter a" }], }, }, { @@ -231,7 +231,7 @@ verify.completions( name: "a", text: "(parameter) a: number", documentation: "more info about a\nthis is first parameter a", - tags: [{ name: "param", text: "a this is first parameter a" }], + tags: [{ links:[], name: "param", text: "a this is first parameter a" }], }, isNewIdentifierLocation: true, }, diff --git a/tests/cases/fourslash/commentsCommentParsing.ts b/tests/cases/fourslash/commentsCommentParsing.ts index 4731194ba697c..6d842f4413a0e 100644 --- a/tests/cases/fourslash/commentsCommentParsing.ts +++ b/tests/cases/fourslash/commentsCommentParsing.ts @@ -251,8 +251,8 @@ verify.completions({ text: "function sum(a: number, b: number): number", documentation: "Adds two integers and returns the result", tags: [ - { name: "param", text: "a first number" }, - { name: "param", text: "b second number" }, + { name: "param", text: "a first number", links: [] }, + { name: "param", text: "b second number", links: [] }, ], }, }); @@ -283,8 +283,8 @@ verify.quickInfoAt("17aq", "(parameter) b: number", "second number"); verify.completions({ marker: "18", includes: [ - { name: "a", text: "(parameter) a: number", documentation: "first number", tags: [{ name: "param", text: "a first number" }] }, - { name: "b", text: "(parameter) b: number", documentation: "second number", tags: [{ name: "param", text: "b second number" }] }, + { name: "a", text: "(parameter) a: number", documentation: "first number", tags: [{ name: "param", text: "a first number", links: [] }] }, + { name: "b", text: "(parameter) b: number", documentation: "second number", tags: [{ name: "param", text: "b second number", links: [] }] }, ], }); @@ -327,7 +327,7 @@ verify.completions({ name: "opt", text: "(parameter) opt: any", documentation: "optional parameter", - tags: [{ name: "param", text: "opt optional parameter" }], + tags: [{ name: "param", text: "opt optional parameter", links: [] }], }, ] }); @@ -357,21 +357,21 @@ verify.completions({ text: "function multiply(a: number, b: number, c?: number, d?: any, e?: any): void", documentation: "This is multiplication function", tags: [ - { name: "param", text: "" }, - { name: "param", text: "a first number" }, - { name: "param", text: "b" }, - { name: "param", text: "c" }, - { name: "param", text: "d" }, - { name: "anotherTag", text: undefined }, - { name: "param", text: "e LastParam" }, - { name: "anotherTag", text: undefined }, + { name: "param", text: "", links: undefined }, + { name: "param", text: "a first number", links: [] }, + { name: "param", text: "b", links: undefined }, + { name: "param", text: "c", links: undefined }, + { name: "param", text: "d", links: undefined }, + { name: "anotherTag", text: undefined, links: undefined }, + { name: "param", text: "e LastParam", links: [] }, + { name: "anotherTag", text: undefined, links: undefined }, ], }, { name: "f1", text: "function f1(a: number): any (+1 overload)", documentation: "fn f1 with number", - tags: [{ name: "param", text: "b about b" }], + tags: [{ name: "param", text: "b about b", links: [] }], }, ], }); @@ -471,14 +471,14 @@ verify.completions({ name: "a", text: "(parameter) a: number", documentation: "this is inline comment for a\nit is first parameter", - tags: [{ name: "param", text: "a it is first parameter" }], + tags: [{ name: "param", text: "a it is first parameter", links: [] }], }, { name: "b", text: "(parameter) b: number", documentation: "this is inline comment for b" }, { name: "c", text: "(parameter) c: number", documentation: "it is third parameter", - tags: [{ name: "param", text: "c it is third parameter" }], + tags: [{ name: "param", text: "c it is third parameter", links: [] }], }, { name: "d", text: "(parameter) d: number" }, ], @@ -518,8 +518,8 @@ verify.completions({ text: "function jsDocParamTest(a: number, b: number, c: number, d: number): number", documentation: jsdocTestDocComment, tags: [ - { name: "param", text: "a it is first parameter" }, - { name: "param", text: "c it is third parameter" }, + { name: "param", text: "a it is first parameter", links: [] }, + { name: "param", text: "c it is third parameter", links: [] }, ], }, { name: "x", text: "var x: any", documentation: "This is a comment" }, diff --git a/tests/cases/fourslash/commentsFunctionExpression.ts b/tests/cases/fourslash/commentsFunctionExpression.ts index 01bbf40045ca0..e8ce9d1faad38 100644 --- a/tests/cases/fourslash/commentsFunctionExpression.ts +++ b/tests/cases/fourslash/commentsFunctionExpression.ts @@ -88,8 +88,8 @@ verify.completions({ text: "(parameter) s: string", documentation: "On parameter\nparam on expression\nthe first parameter!", tags: [ - { name: "param", text: "s param on expression" }, - { name: "param", text: "s the first parameter!" }, + { name: "param", text: "s param on expression", links: [] }, + { name: "param", text: "s the first parameter!", links: [] }, ], }, }); @@ -101,10 +101,10 @@ verify.completions({ text: "var assigned: (s: string) => number", documentation: "Summary on expression\nOn variable", tags: [ - { name: "param", text: "s param on expression" }, - { name: "returns", text: "return on expression" }, - { name: "param", text: "s the first parameter!" }, - { name: "returns", text: "the parameter's length" }, + { name: "param", text: "s param on expression", links: [] }, + { name: "returns", text: "return on expression", links: [] }, + { name: "param", text: "s the first parameter!", links: [] }, + { name: "returns", text: "the parameter's length", links: [] }, ], }, ]}); @@ -113,9 +113,9 @@ verify.signatureHelp({ docComment: "Summary on expression\nOn variable", parameterDocComment: "On parameter\nparam on expression\nthe first parameter!", tags: [ - { name: "param", text: "s param on expression" }, - { name: "returns", text: "return on expression" }, - { name: "param", text: "s the first parameter!" }, - { name: "returns", text: "the parameter's length" }, + { name: "param", text: "s param on expression", links: [] }, + { name: "returns", text: "return on expression", links: [] }, + { name: "param", text: "s the first parameter!", links: [] }, + { name: "returns", text: "the parameter's length", links: [] }, ], }); diff --git a/tests/cases/fourslash/completionEntryForUnionMethod.ts b/tests/cases/fourslash/completionEntryForUnionMethod.ts index 80fa6d5dd6e6c..73069969dfacb 100644 --- a/tests/cases/fourslash/completionEntryForUnionMethod.ts +++ b/tests/cases/fourslash/completionEntryForUnionMethod.ts @@ -14,8 +14,8 @@ verify.completions({ text, documentation, tags: [ - { name: "param", text: "callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array." }, - { name: "param", text: "thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value." } + { name: "param", text: "callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.", links: [] }, + { name: "param", text: "thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.", links: [] } ], }, }); diff --git a/tests/cases/fourslash/jsDocTags.ts b/tests/cases/fourslash/jsDocTags.ts index ddd1c54725060..13e6bd8b74e29 100644 --- a/tests/cases/fourslash/jsDocTags.ts +++ b/tests/cases/fourslash/jsDocTags.ts @@ -83,6 +83,6 @@ verify.completions({ text: "(method) Foo.newMethod(): void", documentation: "method documentation", kind: "method", - tags: [{ name: "mytag", text: "a JSDoc tag" }], + tags: [{ name: "mytag", text: "a JSDoc tag", links: [] }], }, }); diff --git a/tests/cases/fourslash/salsaMethodsOnAssignedFunctionExpressions.ts b/tests/cases/fourslash/salsaMethodsOnAssignedFunctionExpressions.ts index 2b433fd13c980..cbaa5ddecd0fd 100644 --- a/tests/cases/fourslash/salsaMethodsOnAssignedFunctionExpressions.ts +++ b/tests/cases/fourslash/salsaMethodsOnAssignedFunctionExpressions.ts @@ -19,6 +19,6 @@ verify.completions({ name: "m", text: "(property) C.m: (a: string) => void", documentation: "The prototype method.", - tags: [{ name: "param", text: "a Parameter definition." }], + tags: [{ name: "param", text: "a Parameter definition.", links: [] }], }, }); diff --git a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts index 16b6b80c59d9e..a9ea76c1f97b8 100644 --- a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts +++ b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts @@ -14,7 +14,7 @@ //// import a = require("./a"); //// a.fo/*2*/ -const entry = (text: string): FourSlashInterface.ExpectedCompletionEntry => ({ name: "foo", text, documentation: "Modify the parameter", tags: [{ name: "param", text: "p1" }] }); +const entry = (text: string): FourSlashInterface.ExpectedCompletionEntry => ({ name: "foo", text, documentation: "Modify the parameter", tags: [{ name: "param", text: "p1", links: undefined }] }); verify.completions( { marker: "1", includes: entry("var foo: (p1: string) => void") }, { marker: "2", exact: entry("(alias) var foo: (p1: string) => void\nimport a.foo") }, diff --git a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts index 03aeee3b0ed1f..afec3b60e8c7f 100644 --- a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts +++ b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts @@ -15,6 +15,6 @@ //// a.fo/*2*/ verify.completions( - { marker: "1", includes: { name: "foo", text: "var foo: (p1: string) => void", documentation: "Modify the parameter", tags: [{ name: "param", text: "p1" }] } }, - { marker: "2", exact: { name: "foo", text: "(alias) var foo: (p1: string) => void\nimport a.foo", documentation: "Modify the parameter", tags: [{ name: "param", text: "p1" }] } }, + { marker: "1", includes: { name: "foo", text: "var foo: (p1: string) => void", documentation: "Modify the parameter", tags: [{ name: "param", text: "p1", links: undefined }] } }, + { marker: "2", exact: { name: "foo", text: "(alias) var foo: (p1: string) => void\nimport a.foo", documentation: "Modify the parameter", tags: [{ name: "param", text: "p1", links: undefined }] } }, ); diff --git a/tests/cases/fourslash/server/completions02.ts b/tests/cases/fourslash/server/completions02.ts index 8e44edd8225c1..603d2079d66c1 100644 --- a/tests/cases/fourslash/server/completions02.ts +++ b/tests/cases/fourslash/server/completions02.ts @@ -10,9 +10,9 @@ const sortedFunctionMembers = completion.functionMembersWithPrototype.slice().sort((a, b) => a.name.localeCompare(b.name)); const exact: ReadonlyArray = [ ...sortedFunctionMembers.map(e => - e.name === "arguments" ? { ...e, kind: "property", kindModifiers: "declare" } : + e.name === "arguments" ? { ...e, kind: "property", kindModifiers: "declare", tags: [] } : e.name === "prototype" ? { ...e, kindModifiers: undefined } : e), - { name: "x", text: "var Foo.x: number" }, + { name: "x", text: "var Foo.x: number", tags: [] }, ]; verify.completions({ marker: "", exact }); From 7dd7cab31cd281bc7b38902b5ccdf2ffdc478eda Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 7 Dec 2020 11:45:47 -0800 Subject: [PATCH 11/44] fix bad merge --- src/services/codefixes/inferFromUsage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index 9b4200dd2f53c..dc030fce72c34 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -374,7 +374,7 @@ namespace ts.codefix { } else { const paramTags = map(inferences, ({ name, typeNode, isOptional }) => - factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!isOptional, factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, "")); + factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!isOptional, factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, { text: "" })); addJSDocTags(changes, sourceFile, signature, paramTags); } } From c0e8d4795105683b15b5be14e94a87ab638cc810 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 7 Dec 2020 14:35:36 -0800 Subject: [PATCH 12/44] polish parser --- src/compiler/parser.ts | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f64beb7a184eb..1f2a459952640 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7305,7 +7305,6 @@ namespace ts { state = JSDocState.BeginningOfLine; indent = 0; } - // TODO: Need to parse link tags in the initial comment text too loop: while (true) { switch (token()) { case SyntaxKind.AtToken: @@ -7354,11 +7353,9 @@ namespace ts { case SyntaxKind.EndOfFileToken: break loop; case SyntaxKind.OpenBraceToken: - // TODO: Refactor in the same way as the other parser, and probably dedupe into a single function - if (lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) { - state = JSDocState.SavingComments; - // TODO: Maybe shouldn't use 1 as the length of { ? - const link = parseLink(scanner.getTextPos() - 1); + state = JSDocState.SavingComments; + const link = parseLink(scanner.getTextPos() - 1); + if (link) { links.push(link); pushComment(scanner.getText().slice(link.pos, link.end)); break; @@ -7392,7 +7389,6 @@ namespace ts { } function createJSDocComment(): JSDoc { - // TODO: Parse links too! const comment = comments.length ? { links, text: comments.join("") } : undefined; const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); return finishNode(factory.createJSDocComment(comment, tagsArray), start, end); @@ -7584,11 +7580,8 @@ namespace ts { break; case SyntaxKind.OpenBraceToken: state = JSDocState.SavingComments; - // TODO: test margins - // TODO: Put a manual `tok = nextTokenJSDoc()` here and only call `lookAhead` if its AtToken. - // THat means I'll have to save getTextPos *before* the nextTokenJSDoc and unconditionally `continue` afterward - if (lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) { - const link = parseLink(scanner.getTextPos() - 1); + const link = parseLink(scanner.getTextPos() - 1); + if (link) { links.push(link); pushComment(scanner.getText().slice(link.pos, link.end)); } @@ -7630,9 +7623,9 @@ namespace ts { } function parseLink(start: number) { - nextTokenJSDoc(); // @ - nextTokenJSDoc(); // link - + if (!tryParse(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) { + return undefined; + } nextTokenJSDoc(); // start at token after link, then skip any whitespace skipWhitespace(); // parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error From 8bbc8b4e9a0a9748b8372d8ce843576285bddfca Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 7 Dec 2020 16:25:16 -0800 Subject: [PATCH 13/44] improve names and array types --- src/compiler/factory/nodeFactory.ts | 6 +++--- src/compiler/parser.ts | 4 ++-- src/compiler/types.ts | 10 ++++------ src/harness/client.ts | 10 +++++----- src/harness/fourslashImpl.ts | 2 +- src/server/protocol.ts | 10 +++++----- src/server/session.ts | 2 +- src/services/jsDoc.ts | 2 +- src/services/types.ts | 11 +++++------ 9 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 66cbfc11515d6..a48646ccdc7b5 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -4363,14 +4363,14 @@ namespace ts { } // @api - function createJSDocLinkNode(name: EntityName): JSDocLinkNode { - const node = createBaseNode(SyntaxKind.JSDocLink); + function createJSDocLinkNode(name: EntityName): JSDocLink { + const node = createBaseNode(SyntaxKind.JSDocLink); node.name = name; return node; } // @api - function updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode { + function updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink { return node.name !== name ? update(createJSDocLinkNode(name), node) : node; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 1f2a459952640..6840402f6edc7 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7280,7 +7280,7 @@ namespace ts { let tagsPos: number; let tagsEnd: number; const comments: string[] = []; - const links: JSDocLinkNode[] = []; + const links: JSDocLink[] = []; // + 3 for leading /**, - 5 in total for /** */ return scanner.scanRange(start + 3, length - 5, () => { @@ -7529,7 +7529,7 @@ namespace ts { function parseTagComments(indent: number, initialMargin?: string): JSDocComment | undefined { const comments: string[] = []; - const links: JSDocLinkNode[] = []; + const links: JSDocLink[] = []; let state = JSDocState.BeginningOfLine; let margin: number | undefined; function pushComment(text: string) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bd2026da2dd77..6858cc29dd137 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3149,16 +3149,14 @@ namespace ts { readonly comment?: JSDocComment; } - // TODO: Decide on a taxonomy (preferably ditch the -Node suffix here) - export interface JSDocLinkNode extends Node { + export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; } export interface JSDocComment { text: string; - // TODO: Might need to be optional I don't know - links?: JSDocLinkNode[]; + links?: JSDocLink[]; } export interface JSDocUnknownTag extends JSDocTag { @@ -7069,8 +7067,8 @@ namespace ts { updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName): JSDocNameReference; updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference; - createJSDocLinkNode(name: EntityName): JSDocLinkNode; - updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode; + createJSDocLinkNode(name: EntityName): JSDocLink; + updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; diff --git a/src/harness/client.ts b/src/harness/client.ts index 4624eb316ecf7..edda0fb523f64 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -518,16 +518,16 @@ namespace ts.server { lineMap = lineMap || this.getLineMap(fileName); return createTextSpanFromBounds( this.lineOffsetToPosition(fileName, span.start, lineMap), - this.lineOffsetToPosition(fileName, Debug.checkDefined(span.end, JSON.stringify(span)), lineMap)); + this.lineOffsetToPosition(fileName, span.end, lineMap)); } - private decodeLink(tags: readonly protocol.JSDocTagInfo[]): readonly JSDocTagInfo[] { + private decodeLink(tags: protocol.JSDocTagInfo[]): JSDocTagInfo[] { return tags.map(tag => ({ ...tag, links: tag.links?.map(link => ({ ...link, target: { - // TODO: May still need to decode MOST of the link.targets + // TODO: The JSDocLinkInfo tag data mismatches the type!! (probably wasn't correctly encoded in the first place?) textSpan: link.target as unknown as TextSpan, fileName: link.target.file, } @@ -555,8 +555,8 @@ namespace ts.server { const { items: encodedItems, applicableSpan: encodedApplicableSpan, selectedItemIndex, argumentIndex, argumentCount } = response.body; - // TODO: I thought that applicable span was a protocol span now?! I guess not. - const applicableSpan = encodedApplicableSpan as unknown as TextSpan; //this.decodeSpan(encodedApplicableSpan, fileName); + // TODO: Same here, it doesn't actually seem to be encoded + const applicableSpan = encodedApplicableSpan as unknown as TextSpan; const items = encodedItems.map(item => ({ ...item, tags: this.decodeLink(item.tags) })); return { items, applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 0823bed839176..6af8cea9d039b 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -932,7 +932,7 @@ namespace FourSlash { // assert.equal(actualDetails.kind, actual.kind); assert.equal(actualDetails.kindModifiers, actual.kindModifiers, "Expected 'kindModifiers' properties to match"); assert.equal(actualDetails.source && ts.displayPartsToString(actualDetails.source), expected.sourceDisplay, "Expected 'sourceDisplay' property to match 'source' display parts string"); - assert.deepEqual(actualDetails.tags, expected.tags, "Try harder, chai:" + JSON.stringify(actualDetails) + "\n" + JSON.stringify(expected) + " at " + this.lastKnownMarker); + assert.deepEqual(actualDetails.tags, expected.tags); } else { assert(expected.documentation === undefined && expected.tags === undefined && expected.sourceDisplay === undefined, "If specifying completion details, should specify 'text'"); diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 254b970d979fd..a4761ab32768b 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -958,10 +958,10 @@ namespace ts.server.protocol { export interface JSDocTagInfo { name: string; text?: string; - links?: readonly JSDocLink[]; + links?: JSDocLinkInfo[]; } - export interface JSDocLink extends DocumentSpan { + export interface JSDocLinkInfo extends DocumentSpan { target: FileSpan; } @@ -1947,7 +1947,7 @@ namespace ts.server.protocol { /** * JSDoc tags associated with symbol. */ - tags: readonly JSDocTagInfo[]; + tags: JSDocTagInfo[]; } /** @@ -2253,7 +2253,7 @@ namespace ts.server.protocol { /** * JSDoc tags for the symbol. */ - tags?: readonly JSDocTagInfo[]; + tags?: JSDocTagInfo[]; /** * The associated code actions for this entry @@ -2357,7 +2357,7 @@ namespace ts.server.protocol { * The signature's JSDoc tags * TODO: Changing this doesn't cause the build to fail! Need tests and probably a scan of session.ts */ - tags: readonly JSDocTagInfo[]; + tags: JSDocTagInfo[]; } /** diff --git a/src/server/session.ts b/src/server/session.ts index 260ea36e7cd33..cce3d31a0dc3d 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1250,7 +1250,7 @@ namespace ts.server { result; } - private mapJSDocTagInfo(tags: readonly JSDocTagInfo[] | undefined, project: Project): readonly protocol.JSDocTagInfo[] { + private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project): protocol.JSDocTagInfo[] { if (tags === undefined) { return []; } diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index b759e0b184c3d..53e1fe95417f2 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -123,7 +123,7 @@ namespace ts.JsDoc { return tags; } - function getLinks(tag: JSDocTag, checker: TypeChecker): JSDocLink[] | undefined { + function getLinks(tag: JSDocTag, checker: TypeChecker): JSDocLinkInfo[] | undefined { const links = tag.comment?.links; if (links) { return mapDefined(links, link => { diff --git a/src/services/types.ts b/src/services/types.ts index f8d535d8f9189..a7a2b05440c3e 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1033,10 +1033,10 @@ namespace ts { export interface JSDocTagInfo { name: string; text?: string; - links?: readonly JSDocLink[]; + links?: readonly JSDocLinkInfo[]; } - export interface JSDocLink extends DocumentSpan { + export interface JSDocLinkInfo extends DocumentSpan { target: DocumentSpan; } @@ -1046,7 +1046,7 @@ namespace ts { textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: readonly JSDocTagInfo[]; + tags?: JSDocTagInfo[]; } export type RenameInfo = RenameInfoSuccess | RenameInfoFailure; @@ -1098,7 +1098,7 @@ namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; - tags: readonly JSDocTagInfo[]; + tags: JSDocTagInfo[]; } /** @@ -1156,8 +1156,7 @@ namespace ts { kindModifiers: string; // see ScriptElementKindModifier, comma separated displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - // TODO: Find out if readonly arrays are really De Stijl hier - tags?: readonly JSDocTagInfo[]; + tags?: JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; } From 070da0be19ab457407c39555d26f8e2e1b177b8e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 7 Dec 2020 16:39:27 -0800 Subject: [PATCH 14/44] slight tweaks --- src/compiler/parser.ts | 14 ++++++-------- src/server/protocol.ts | 1 - .../DocComments.parsesCorrectly.@link tags.json | 4 ++-- .../DocComments.parsesCorrectly.authorTag.json | 4 ++-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6840402f6edc7..7708f2b031cce 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7774,17 +7774,15 @@ namespace ts { return finishNode(factory.createJSDocAuthorTag(tagName, parseTrailingTagComments(start, end, indent, indentText)), start, end); } - let comments = authorInfoWithEmail; - let links; + let comments: JSDocComment = { text: authorInfoWithEmail }; if (lookAhead(() => nextToken() !== SyntaxKind.NewLineTrivia)) { - const comment = parseTagComments(indent); - if (comment) { - comments += comment.text; - links = comment.links; + const tagComments = parseTagComments(indent); + if (tagComments) { + comments.text += tagComments.text; + comments.links = tagComments.links; } } - - return finishNode(factory.createJSDocAuthorTag(tagName, { links, text: comments }), start); + return finishNode(factory.createJSDocAuthorTag(tagName, comments), start); } function tryParseAuthorNameAndEmail(): string | undefined { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index a4761ab32768b..c89b7d6673b07 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2355,7 +2355,6 @@ namespace ts.server.protocol { /** * The signature's JSDoc tags - * TODO: Changing this doesn't cause the build to fail! Need tests and probably a scan of session.ts */ tags: JSDocTagInfo[]; } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index 33b6a96b9dbda..b0583ac6e809f 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -281,6 +281,7 @@ "escapedText": "author" }, "comment": { + "text": "Alfa Romero See my home page: {@link https://example.com}", "links": [ { "kind": "JSDocLink", @@ -297,8 +298,7 @@ "escapedText": "https" } } - ], - "text": "Alfa Romero See my home page: {@link https://example.com}" + ] } }, "length": 3, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index 75fb3c7ea8856..df0e091a67ade 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -39,8 +39,8 @@ "escapedText": "author" }, "comment": { - "links": [], - "text": "John Doe unexpected comment" + "text": "John Doe unexpected comment", + "links": [] } }, "length": 2, From fce33f1b8f185ed5fd339a9b52cbfa43c13c5712 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 8 Dec 2020 09:28:48 -0800 Subject: [PATCH 15/44] remove some done TODOs --- src/services/codefixes/inferFromUsage.ts | 6 ++-- src/services/jsDoc.ts | 1 - src/services/services.ts | 1 - .../reference/api/tsserverlibrary.d.ts | 29 +++++++++---------- tests/baselines/reference/api/typescript.d.ts | 18 ++++++------ 5 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index dc030fce72c34..76e37f339303e 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -128,7 +128,7 @@ namespace ts.codefix { const typeNode = getTypeNodeIfAccessible(type, parent, program, host); if (typeNode) { // Note that the codefix will never fire with an existing `@type` tag, so there is no need to merge tags - const typeTag = factory.createJSDocTypeTag(/*tagName*/ undefined, factory.createJSDocTypeExpression(typeNode), /*comment*/ { text: "" }); + const typeTag = factory.createJSDocTypeTag(/*tagName*/ undefined, factory.createJSDocTypeExpression(typeNode), /*comment*/ undefined); addJSDocTags(changes, sourceFile, cast(parent.parent.parent, isExpressionStatement), [typeTag]); } importAdder.writeFixes(changes); @@ -307,7 +307,7 @@ namespace ts.codefix { return; } const typeExpression = factory.createJSDocTypeExpression(typeNode); - const typeTag = isGetAccessorDeclaration(declaration) ? factory.createJSDocReturnTag(/*tagName*/ undefined, typeExpression, { text: "" }) : factory.createJSDocTypeTag(/*tagName*/ undefined, typeExpression, { text: "" }); + const typeTag = isGetAccessorDeclaration(declaration) ? factory.createJSDocReturnTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined) : factory.createJSDocTypeTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined); addJSDocTags(changes, sourceFile, parent, [typeTag]); } else if (!tryReplaceImportTypeNodeWithAutoImport(typeNode, declaration, sourceFile, changes, importAdder, getEmitScriptTarget(program.getCompilerOptions()))) { @@ -374,7 +374,7 @@ namespace ts.codefix { } else { const paramTags = map(inferences, ({ name, typeNode, isOptional }) => - factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!isOptional, factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, { text: "" })); + factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!isOptional, factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, /*comment*/ undefined)); addJSDocTags(changes, sourceFile, signature, paramTags); } } diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 53e1fe95417f2..a6da4bc20075c 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -128,7 +128,6 @@ namespace ts.JsDoc { if (links) { return mapDefined(links, link => { if (!link.name) return; - // TODO: Test this, I think getSymbolAtLocation eventually calls checkQualifiedName and then returns resolvedSymbol, but it's hard to be sure const symbol = checker.getSymbolAtLocation(link.name); if (!symbol || !symbol.valueDeclaration) return; return { diff --git a/src/services/services.ts b/src/services/services.ts index cb2848859f7fb..7d0c16a184480 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -359,7 +359,6 @@ namespace ts { } } - // TODO: Maybe link symbol resolution should be lazy so this function doesn't need to provide a checker getJsDocTags(checker: TypeChecker): JSDocTagInfo[] { if (this.tags === undefined) { this.tags = JsDoc.getJsDocTagsFromDeclarations(checker, this.declarations); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 6063ddd6bf5e6..e95cf865dfa5c 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1750,13 +1750,13 @@ declare namespace ts { readonly tagName: Identifier; readonly comment?: JSDocComment; } - export interface JSDocLinkNode extends Node { + export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; } export interface JSDocComment { text: string; - links?: JSDocLinkNode[]; + links?: JSDocLink[]; } export interface JSDocUnknownTag extends JSDocTag { readonly kind: SyntaxKind.JSDocTag; @@ -3462,8 +3462,8 @@ declare namespace ts { updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName): JSDocNameReference; updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference; - createJSDocLinkNode(name: EntityName): JSDocLinkNode; - updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode; + createJSDocLinkNode(name: EntityName): JSDocLink; + updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; @@ -5992,9 +5992,9 @@ declare namespace ts { interface JSDocTagInfo { name: string; text?: string; - links?: readonly JSDocLink[]; + links?: readonly JSDocLinkInfo[]; } - interface JSDocLink extends DocumentSpan { + interface JSDocLinkInfo extends DocumentSpan { target: DocumentSpan; } interface QuickInfo { @@ -6003,7 +6003,7 @@ declare namespace ts { textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: readonly JSDocTagInfo[]; + tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; interface RenameInfoSuccess { @@ -6050,7 +6050,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; - tags: readonly JSDocTagInfo[]; + tags: JSDocTagInfo[]; } /** * Represents a set of signature help items, and the preferred item that should be selected. @@ -6102,7 +6102,7 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: readonly JSDocTagInfo[]; + tags?: JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; } @@ -7204,9 +7204,9 @@ declare namespace ts.server.protocol { interface JSDocTagInfo { name: string; text?: string; - links?: readonly JSDocLink[]; + links?: JSDocLinkInfo[]; } - interface JSDocLink extends DocumentSpan { + interface JSDocLinkInfo extends DocumentSpan { target: FileSpan; } interface TextSpanWithContext extends TextSpan { @@ -7936,7 +7936,7 @@ declare namespace ts.server.protocol { /** * JSDoc tags associated with symbol. */ - tags: readonly JSDocTagInfo[]; + tags: JSDocTagInfo[]; } /** * Quickinfo response message. @@ -8208,7 +8208,7 @@ declare namespace ts.server.protocol { /** * JSDoc tags for the symbol. */ - tags?: readonly JSDocTagInfo[]; + tags?: JSDocTagInfo[]; /** * The associated code actions for this entry */ @@ -8291,9 +8291,8 @@ declare namespace ts.server.protocol { documentation: SymbolDisplayPart[]; /** * The signature's JSDoc tags - * TODO: Changing this doesn't cause the build to fail! Need tests and probably a scan of session.ts */ - tags: readonly JSDocTagInfo[]; + tags: JSDocTagInfo[]; } /** * Signature help items found in the response of a signature help request. diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 93e74d5201e79..0d3eab806c749 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1750,13 +1750,13 @@ declare namespace ts { readonly tagName: Identifier; readonly comment?: JSDocComment; } - export interface JSDocLinkNode extends Node { + export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; } export interface JSDocComment { text: string; - links?: JSDocLinkNode[]; + links?: JSDocLink[]; } export interface JSDocUnknownTag extends JSDocTag { readonly kind: SyntaxKind.JSDocTag; @@ -3462,8 +3462,8 @@ declare namespace ts { updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName): JSDocNameReference; updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference; - createJSDocLinkNode(name: EntityName): JSDocLinkNode; - updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode; + createJSDocLinkNode(name: EntityName): JSDocLink; + updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; @@ -5992,9 +5992,9 @@ declare namespace ts { interface JSDocTagInfo { name: string; text?: string; - links?: readonly JSDocLink[]; + links?: readonly JSDocLinkInfo[]; } - interface JSDocLink extends DocumentSpan { + interface JSDocLinkInfo extends DocumentSpan { target: DocumentSpan; } interface QuickInfo { @@ -6003,7 +6003,7 @@ declare namespace ts { textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: readonly JSDocTagInfo[]; + tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; interface RenameInfoSuccess { @@ -6050,7 +6050,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; - tags: readonly JSDocTagInfo[]; + tags: JSDocTagInfo[]; } /** * Represents a set of signature help items, and the preferred item that should be selected. @@ -6102,7 +6102,7 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - tags?: readonly JSDocTagInfo[]; + tags?: JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; } From 7ac40d42c82466a0a71a1fffa20e06c5f8a0ef7c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 8 Dec 2020 10:37:14 -0800 Subject: [PATCH 16/44] more tests + resulting fixes --- src/compiler/checker.ts | 4 + src/compiler/parser.ts | 9 +- src/compiler/types.ts | 2 +- src/services/jsDoc.ts | 5 +- tests/baselines/reference/jsdocLink1.baseline | 115 ++++++++++++++++++ tests/baselines/reference/jsdocLink2.baseline | 115 ++++++++++++++++++ tests/cases/fourslash/jsdocLink1.ts | 16 +++ tests/cases/fourslash/jsdocLink2.ts | 18 +++ 8 files changed, 277 insertions(+), 7 deletions(-) create mode 100644 tests/baselines/reference/jsdocLink1.baseline create mode 100644 tests/baselines/reference/jsdocLink2.baseline create mode 100644 tests/cases/fourslash/jsdocLink1.ts create mode 100644 tests/cases/fourslash/jsdocLink2.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3d975cee88cdf..69f93466f3a61 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -37568,6 +37568,10 @@ namespace ts { const meaning = SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Value; return resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true, getHostSignatureFromJSDoc(name)); } + else if (name.parent.kind === SyntaxKind.JSDocLink) { + const meaning = SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Value | SymbolFlags.Alias; + return resolveEntityName(name, meaning, /*ignoreErrors*/ true); + } if (name.parent.kind === SyntaxKind.TypePredicate) { return resolveEntityName(name, /*meaning*/ SymbolFlags.FunctionScopedVariable); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7708f2b031cce..ca282a56d7580 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -529,6 +529,8 @@ namespace ts { return forEach((node).typeParameters, cbNode) || forEach((node).parameters, cbNode) || visitNode(cbNode, (node).type); + case SyntaxKind.JSDocLink: + return visitNode(cbNode, (node as JSDocLink).name); case SyntaxKind.JSDocTypeLiteral: return forEach((node as JSDocTypeLiteral).jsDocPropertyTags, cbNode); case SyntaxKind.JSDocTag: @@ -537,7 +539,8 @@ namespace ts { case SyntaxKind.JSDocPrivateTag: case SyntaxKind.JSDocProtectedTag: case SyntaxKind.JSDocReadonlyTag: - return visitNode(cbNode, (node as JSDocTag).tagName); + return visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links) + || visitNode(cbNode, (node as JSDocTag).tagName); case SyntaxKind.PartiallyEmittedExpression: return visitNode(cbNode, (node).expression); } @@ -7389,7 +7392,7 @@ namespace ts { } function createJSDocComment(): JSDoc { - const comment = comments.length ? { links, text: comments.join("") } : undefined; + const comment = comments.length ? { links: createNodeArray(links, -1, -1), text: comments.join("") } : undefined; const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); return finishNode(factory.createJSDocComment(comment, tagsArray), start, end); } @@ -7619,7 +7622,7 @@ namespace ts { removeLeadingNewlines(comments); removeTrailingWhitespace(comments); - return comments.length === 0 ? undefined : { links, text: comments.join("") }; + return comments.length === 0 ? undefined : { links: createNodeArray(links, -1, -1), text: comments.join("") }; } function parseLink(start: number) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6858cc29dd137..ae244984c2f99 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3156,7 +3156,7 @@ namespace ts { export interface JSDocComment { text: string; - links?: JSDocLink[]; + links?: NodeArray; } export interface JSDocUnknownTag extends JSDocTag { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index a6da4bc20075c..129d6341a6938 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -131,8 +131,8 @@ namespace ts.JsDoc { const symbol = checker.getSymbolAtLocation(link.name); if (!symbol || !symbol.valueDeclaration) return; return { - fileName: getSourceFileOfNode(see).fileName, - textSpan: createTextSpanFromNode(see), + fileName: getSourceFileOfNode(link).fileName, + textSpan: createTextSpanFromNode(link), target: { fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, textSpan: createTextSpanFromNode(symbol.valueDeclaration) @@ -140,7 +140,6 @@ namespace ts.JsDoc { }; }); } - const see = tag as JSDocSeeTag; } function getCommentText(tag: JSDocTag): string | undefined { diff --git a/tests/baselines/reference/jsdocLink1.baseline b/tests/baselines/reference/jsdocLink1.baseline new file mode 100644 index 0000000000000..68a9cb48cc567 --- /dev/null +++ b/tests/baselines/reference/jsdocLink1.baseline @@ -0,0 +1,115 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "position": 189 + }, + "quickInfo": { + "kind": "function", + "kindModifiers": "", + "textSpan": { + "start": 189, + "length": 2 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "CC", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "{@link C}", + "kind": "text" + } + ], + "tags": [ + { + "name": "wat", + "text": "Makes a {@link C}. A default one.\n{@link C()}\n{@link C|postfix text}\n{@link unformatted postfix text}", + "links": [ + { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 45, + "length": 9 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + }, + { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 74, + "length": 11 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + }, + { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 89, + "length": 22 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + } + ] + }, + { + "name": "see", + "text": "{" + }, + { + "name": "link", + "text": "C} its great", + "links": [] + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/jsdocLink2.baseline b/tests/baselines/reference/jsdocLink2.baseline new file mode 100644 index 0000000000000..6ab0a844309c8 --- /dev/null +++ b/tests/baselines/reference/jsdocLink2.baseline @@ -0,0 +1,115 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/script.ts", + "position": 177 + }, + "quickInfo": { + "kind": "function", + "kindModifiers": "", + "textSpan": { + "start": 177, + "length": 2 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "CC", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "{@link C}", + "kind": "text" + } + ], + "tags": [ + { + "name": "wat", + "text": "Makes a {@link C}. A default one.\n{@link C()}\n{@link C|postfix text}\n{@link unformatted postfix text}", + "links": [ + { + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 33, + "length": 9 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink2.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + }, + { + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 62, + "length": 11 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink2.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + }, + { + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 77, + "length": 22 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink2.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + } + ] + }, + { + "name": "see", + "text": "{" + }, + { + "name": "link", + "text": "C} its great", + "links": [] + } + ] + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/jsdocLink1.ts b/tests/cases/fourslash/jsdocLink1.ts new file mode 100644 index 0000000000000..df42c496a9bed --- /dev/null +++ b/tests/cases/fourslash/jsdocLink1.ts @@ -0,0 +1,16 @@ +/// + +//// class C { +//// } +//// /** +//// * {@link C} +//// * @wat Makes a {@link C}. A default one. +//// * {@link C()} +//// * {@link C|postfix text} +//// * {@link unformatted postfix text} +//// * @see {@link C} its great +//// */ +//// function /**/CC() { +//// } + +verify.baselineQuickInfo(); diff --git a/tests/cases/fourslash/jsdocLink2.ts b/tests/cases/fourslash/jsdocLink2.ts new file mode 100644 index 0000000000000..35151957d126a --- /dev/null +++ b/tests/cases/fourslash/jsdocLink2.ts @@ -0,0 +1,18 @@ +/// + +// @Filename: jsdocLink2.ts +//// class C { +//// } +// @Filename: script.ts +//// /** +//// * {@link C} +//// * @wat Makes a {@link C}. A default one. +//// * {@link C()} +//// * {@link C|postfix text} +//// * {@link unformatted postfix text} +//// * @see {@link C} its great +//// */ +//// function /**/CC() { +//// } + +verify.baselineQuickInfo(); From 6b1d4cea03cbc35356d6fe712bce3cbea2949981 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 8 Dec 2020 11:00:08 -0800 Subject: [PATCH 17/44] add+fix cross-module tests --- src/compiler/checker.ts | 2 +- src/compiler/parser.ts | 37 ++++-- tests/baselines/reference/jsdocLink3.baseline | 115 ++++++++++++++++++ tests/cases/fourslash/jsdocLink3.ts | 19 +++ 4 files changed, 159 insertions(+), 14 deletions(-) create mode 100644 tests/baselines/reference/jsdocLink3.baseline create mode 100644 tests/cases/fourslash/jsdocLink3.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 69f93466f3a61..d0a625d4b63fc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -37569,7 +37569,7 @@ namespace ts { return resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true, getHostSignatureFromJSDoc(name)); } else if (name.parent.kind === SyntaxKind.JSDocLink) { - const meaning = SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Value | SymbolFlags.Alias; + const meaning = SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Value; return resolveEntityName(name, meaning, /*ignoreErrors*/ true); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ca282a56d7580..ed8555c4ebeb6 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -481,10 +481,12 @@ namespace ts { return visitNodes(cbNode, cbNodes, (node).parameters) || visitNode(cbNode, (node).type); case SyntaxKind.JSDocComment: - return visitNodes(cbNode, cbNodes, (node).tags); + return visitNodes(cbNode, cbNodes, (node as JSDoc).comment?.links) + || visitNodes(cbNode, cbNodes, (node).tags); case SyntaxKind.JSDocSeeTag: return visitNode(cbNode, (node as JSDocSeeTag).tagName) || - visitNode(cbNode, (node as JSDocSeeTag).name); + visitNode(cbNode, (node as JSDocSeeTag).name) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); case SyntaxKind.JSDocNameReference: return visitNode(cbNode, (node as JSDocNameReference).name); case SyntaxKind.JSDocParameterTag: @@ -492,39 +494,48 @@ namespace ts { return visitNode(cbNode, (node as JSDocTag).tagName) || ((node as JSDocPropertyLikeTag).isNameFirst ? visitNode(cbNode, (node).name) || - visitNode(cbNode, (node).typeExpression) + visitNode(cbNode, (node).typeExpression) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links) : visitNode(cbNode, (node).typeExpression) || - visitNode(cbNode, (node).name)); + visitNode(cbNode, (node).name)) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); case SyntaxKind.JSDocAuthorTag: return visitNode(cbNode, (node as JSDocTag).tagName); case SyntaxKind.JSDocImplementsTag: return visitNode(cbNode, (node as JSDocTag).tagName) || - visitNode(cbNode, (node).class); + visitNode(cbNode, (node).class) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); case SyntaxKind.JSDocAugmentsTag: return visitNode(cbNode, (node as JSDocTag).tagName) || - visitNode(cbNode, (node).class); + visitNode(cbNode, (node).class) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); case SyntaxKind.JSDocTemplateTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node).constraint) || - visitNodes(cbNode, cbNodes, (node).typeParameters); + visitNodes(cbNode, cbNodes, (node).typeParameters) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); case SyntaxKind.JSDocTypedefTag: return visitNode(cbNode, (node as JSDocTag).tagName) || ((node as JSDocTypedefTag).typeExpression && (node as JSDocTypedefTag).typeExpression!.kind === SyntaxKind.JSDocTypeExpression ? visitNode(cbNode, (node).typeExpression) || - visitNode(cbNode, (node).fullName) + visitNode(cbNode, (node).fullName) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links) : visitNode(cbNode, (node).fullName) || - visitNode(cbNode, (node).typeExpression)); + visitNode(cbNode, (node).typeExpression)) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); case SyntaxKind.JSDocCallbackTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocCallbackTag).fullName) || - visitNode(cbNode, (node as JSDocCallbackTag).typeExpression); + visitNode(cbNode, (node as JSDocCallbackTag).typeExpression) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); case SyntaxKind.JSDocReturnTag: case SyntaxKind.JSDocTypeTag: case SyntaxKind.JSDocThisTag: case SyntaxKind.JSDocEnumTag: return visitNode(cbNode, (node as JSDocTag).tagName) || - visitNode(cbNode, (node as JSDocReturnTag | JSDocTypeTag | JSDocThisTag | JSDocEnumTag).typeExpression); + visitNode(cbNode, (node as JSDocReturnTag | JSDocTypeTag | JSDocThisTag | JSDocEnumTag).typeExpression) || + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); case SyntaxKind.JSDocSignature: return forEach((node).typeParameters, cbNode) || forEach((node).parameters, cbNode) || @@ -539,8 +550,8 @@ namespace ts { case SyntaxKind.JSDocPrivateTag: case SyntaxKind.JSDocProtectedTag: case SyntaxKind.JSDocReadonlyTag: - return visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links) - || visitNode(cbNode, (node as JSDocTag).tagName); + return visitNode(cbNode, (node as JSDocTag).tagName) + || visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); case SyntaxKind.PartiallyEmittedExpression: return visitNode(cbNode, (node).expression); } diff --git a/tests/baselines/reference/jsdocLink3.baseline b/tests/baselines/reference/jsdocLink3.baseline new file mode 100644 index 0000000000000..1f278b7c12365 --- /dev/null +++ b/tests/baselines/reference/jsdocLink3.baseline @@ -0,0 +1,115 @@ +[ + { + "marker": { + "fileName": "/module1.ts", + "position": 210 + }, + "quickInfo": { + "kind": "function", + "kindModifiers": "", + "textSpan": { + "start": 210, + "length": 2 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "CC", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "{@link C}", + "kind": "text" + } + ], + "tags": [ + { + "name": "wat", + "text": "Makes a {@link C}. A default one.\n{@link C()}\n{@link C|postfix text}\n{@link unformatted postfix text}", + "links": [ + { + "fileName": "/module1.ts", + "textSpan": { + "start": 66, + "length": 9 + }, + "target": { + "fileName": "/jsdocLink3.ts", + "textSpan": { + "start": 0, + "length": 18 + } + } + }, + { + "fileName": "/module1.ts", + "textSpan": { + "start": 95, + "length": 11 + }, + "target": { + "fileName": "/jsdocLink3.ts", + "textSpan": { + "start": 0, + "length": 18 + } + } + }, + { + "fileName": "/module1.ts", + "textSpan": { + "start": 110, + "length": 22 + }, + "target": { + "fileName": "/jsdocLink3.ts", + "textSpan": { + "start": 0, + "length": 18 + } + } + } + ] + }, + { + "name": "see", + "text": "{" + }, + { + "name": "link", + "text": "C} its great", + "links": [] + } + ] + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/jsdocLink3.ts b/tests/cases/fourslash/jsdocLink3.ts new file mode 100644 index 0000000000000..f31363a834210 --- /dev/null +++ b/tests/cases/fourslash/jsdocLink3.ts @@ -0,0 +1,19 @@ +/// + +// @Filename: /jsdocLink3.ts +//// export class C { +//// } +// @Filename: /module1.ts +//// import { C } from './jsdocLink3' +//// /** +//// * {@link C} +//// * @wat Makes a {@link C}. A default one. +//// * {@link C()} +//// * {@link C|postfix text} +//// * {@link unformatted postfix text} +//// * @see {@link C} its great +//// */ +//// function /**/CC() { +//// } + +verify.baselineQuickInfo(); From e4f111efb0e704e336b2e976c549603118bf8961 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 8 Dec 2020 11:48:38 -0800 Subject: [PATCH 18/44] Support `@see {@link` Plus find-all-refs support equivalent to @see's. --- src/compiler/checker.ts | 2 +- src/compiler/factory/nodeTests.ts | 4 + src/compiler/parser.ts | 3 +- src/services/services.ts | 2 +- src/services/utilities.ts | 2 +- ...ocComments.parsesCorrectly.@link tags.json | 66 +++++++++++------ ...ts.parsesCorrectly.Nested @param tags.json | 16 +++- ...parsesCorrectly.argSynonymForParamTag.json | 8 +- ...sCorrectly.argumentSynonymForParamTag.json | 8 +- ...parsesCorrectly.asteriskAfterPreamble.json | 8 +- ...DocComments.parsesCorrectly.authorTag.json | 8 +- ...sCorrectly.consecutive newline tokens.json | 8 +- ...less-than and greater-than characters.json | 8 +- ...DocComments.parsesCorrectly.paramTag1.json | 8 +- ...arsesCorrectly.paramTagBracketedName1.json | 8 +- ...arsesCorrectly.paramTagBracketedName2.json | 8 +- ...parsesCorrectly.paramTagNameThenType2.json | 8 +- ...ocComments.parsesCorrectly.returnTag2.json | 8 +- ...Comments.parsesCorrectly.templateTag6.json | 8 +- ...mments.parsesCorrectly.threeAsterisks.json | 8 +- .../reference/api/tsserverlibrary.d.ts | 3 +- tests/baselines/reference/api/typescript.d.ts | 3 +- tests/baselines/reference/jsdocLink1.baseline | 23 ++++-- tests/baselines/reference/jsdocLink2.baseline | 23 ++++-- tests/baselines/reference/jsdocLink3.baseline | 23 ++++-- ...sdocLink_findAllReferences1.baseline.jsonc | 73 +++++++++++++++++++ .../reference/jsdocLink_rename1.baseline | 7 ++ .../fourslash/jsdocLink_findAllReferences1.ts | 9 +++ tests/cases/fourslash/jsdocLink_rename1.ts | 9 +++ 29 files changed, 310 insertions(+), 62 deletions(-) create mode 100644 tests/baselines/reference/jsdocLink_findAllReferences1.baseline.jsonc create mode 100644 tests/baselines/reference/jsdocLink_rename1.baseline create mode 100644 tests/cases/fourslash/jsdocLink_findAllReferences1.ts create mode 100644 tests/cases/fourslash/jsdocLink_rename1.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d0a625d4b63fc..53d12699c027a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -37568,7 +37568,7 @@ namespace ts { const meaning = SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Value; return resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true, getHostSignatureFromJSDoc(name)); } - else if (name.parent.kind === SyntaxKind.JSDocLink) { + else if (isJSDocLink(name.parent)) { const meaning = SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Value; return resolveEntityName(name, meaning, /*ignoreErrors*/ true); } diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index 3f334edc0d61b..f03d2b6317f40 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -707,6 +707,10 @@ namespace ts { return node.kind === SyntaxKind.JSDocNameReference; } + export function isJSDocLink(node: Node): node is JSDocLink { + return node.kind === SyntaxKind.JSDocLink; + } + export function isJSDocAllType(node: Node): node is JSDocAllType { return node.kind === SyntaxKind.JSDocAllType; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ed8555c4ebeb6..634834bd5e45d 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7775,7 +7775,8 @@ namespace ts { } function parseSeeTag(start: number, tagName: Identifier, indent?: number, indentText?: string): JSDocSeeTag { - const nameExpression = parseJSDocNameReference(); + const isLink = lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"); + const nameExpression = isLink ? undefined : parseJSDocNameReference(); const end = getNodePos(); const comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, end, indent, indentText) : undefined; return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments), start, end); diff --git a/src/services/services.ts b/src/services/services.ts index 7d0c16a184480..3b14da82c9ee9 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -173,7 +173,7 @@ namespace ts { const token = scanner.scan(); const textPos = scanner.getTextPos(); if (textPos <= end) { - if (token === SyntaxKind.Identifier) { + if (token === SyntaxKind.Identifier && !isJSDocLink(parent)) { Debug.fail(`Did not expect ${Debug.formatSyntaxKind(parent.kind)} to have an Identifier in its trivia`); } nodes.push(createNode(token, pos, textPos, parent)); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index bcfe1f8aff435..f5d2c3f52fdf9 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -105,7 +105,7 @@ namespace ts { else if (isDeclarationName(node)) { return getMeaningFromDeclaration(node.parent); } - else if (isEntityName(node) && isJSDocNameReference(node.parent)) { + else if (isEntityName(node) && (isJSDocNameReference(node.parent) || isJSDocLink(node.parent))) { return SemanticMeaning.All; } else if (isTypeReference(node)) { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index b0583ac6e809f..c47a401569bdb 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -6,8 +6,8 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "links": [ - { + "links": { + "0": { "kind": "JSDocLink", "pos": 7, "end": 21, @@ -22,7 +22,7 @@ "escapedText": "first" } }, - { + "1": { "kind": "JSDocLink", "pos": 32, "end": 49, @@ -36,8 +36,13 @@ "transformFlags": 0, "escapedText": "link" } - } - ], + }, + "length": 2, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "{@link first }\nInside {@link link text} thing" }, "tags": { @@ -56,8 +61,8 @@ "escapedText": "param" }, "comment": { - "links": [ - { + "links": { + "0": { "kind": "JSDocLink", "pos": 79, "end": 98, @@ -86,8 +91,13 @@ "escapedText": "Reference" } } - } - ], + }, + "length": 1, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "See also {@link A.Reference}" }, "name": { @@ -116,8 +126,8 @@ "escapedText": "param" }, "comment": { - "links": [ - { + "links": { + "0": { "kind": "JSDocLink", "pos": 120, "end": 152, @@ -132,7 +142,7 @@ "escapedText": "http" } }, - { + "1": { "kind": "JSDocLink", "pos": 156, "end": 183, @@ -162,7 +172,7 @@ } } }, - { + "2": { "kind": "JSDocLink", "pos": 203, "end": 210, @@ -177,7 +187,7 @@ "escapedText": "" } }, - { + "3": { "kind": "JSDocLink", "pos": 244, "end": 262, @@ -192,7 +202,7 @@ "escapedText": "doubled" } }, - { + "4": { "kind": "JSDocLink", "pos": 326, "end": 340, @@ -222,7 +232,7 @@ } } }, - { + "5": { "kind": "JSDocLink", "pos": 369, "end": 403, @@ -237,7 +247,7 @@ "escapedText": "https" } }, - { + "6": { "kind": "JSDocLink", "pos": 526, "end": 541, @@ -251,8 +261,13 @@ "transformFlags": 0, "escapedText": "" } - } - ], + }, + "length": 7, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Or see {@link http://www.zombocom.com }\n{@link Standalone.Complex }\nThis empty one: {@link} is OK.\nThis double-space one: {@link doubled } is OK too.\nThis should work, despite being badly formatted: {@link\noh.no\n}\nForgot to close this one {@link https://typescriptlang.org\n * But it's still OK.\nAlthough it skips the newline so parses the asterisks in the wrong state.\nThis shouldn't work: {@link\n * nope\n * }, because of the intermediate asterisks." }, "name": { @@ -282,8 +297,8 @@ }, "comment": { "text": "Alfa Romero See my home page: {@link https://example.com}", - "links": [ - { + "links": { + "0": { "kind": "JSDocLink", "pos": 643, "end": 670, @@ -297,8 +312,13 @@ "transformFlags": 0, "escapedText": "https" } - } - ] + }, + "length": 1, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + } } }, "length": 3, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json index c43cb4d88956b..357e691404d76 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -21,7 +21,13 @@ "escapedText": "param" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Doc doc" }, "typeExpression": { @@ -52,7 +58,13 @@ "escapedText": "param" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Doc for f" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index e760dd529c3f9..bb0cbffdca8dc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -21,7 +21,13 @@ "escapedText": "arg" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Description" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index e31131e7b39af..521b6100de6e9 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -21,7 +21,13 @@ "escapedText": "argument" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Description" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json index 3764860013f96..f6e556b5b0176 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json @@ -6,7 +6,13 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "* @type {number}" } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index df0e091a67ade..df229bb3c5b65 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -40,7 +40,13 @@ }, "comment": { "text": "John Doe unexpected comment", - "links": [] + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + } } }, "length": 2, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json index 073f41863bdbc..b221ec330af62 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json @@ -21,7 +21,13 @@ "escapedText": "example" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Some\n\ntext\r\nwith newlines." } }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index 06fe6897ed1b6..398f73a1a674e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -21,7 +21,13 @@ "escapedText": "param" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "hi\n< > still part of the previous comment" }, "name": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index 952060a2a7408..217e0af9a269e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -21,7 +21,13 @@ "escapedText": "param" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Description text follows" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index 6cc10bebbbf6c..0cf96860d8d76 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -21,7 +21,13 @@ "escapedText": "param" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Description text follows" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index bc8a4f356226c..08ef73797599d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -21,7 +21,13 @@ "escapedText": "param" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Description text follows" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index 2dcd8265e1140..06765c6abbf9a 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -21,7 +21,13 @@ "escapedText": "param" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Description" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json index 3e31a6d3be52c..a4cdde739fd34 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json @@ -22,7 +22,13 @@ "escapedText": "return" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Description text follows" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json index 74af8279a2dcb..e666b205e8ba6 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json @@ -21,7 +21,13 @@ "escapedText": "template" }, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "Description of type parameters." }, "typeParameters": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json index 7fa4e11e14113..2c499a05c830d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json @@ -6,7 +6,13 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "links": [], + "links": { + "length": 0, + "pos": -1, + "end": -1, + "hasTrailingComma": false, + "transformFlags": 0 + }, "text": "*" } } \ No newline at end of file diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index e95cf865dfa5c..db5683b89d23a 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1756,7 +1756,7 @@ declare namespace ts { } export interface JSDocComment { text: string; - links?: JSDocLink[]; + links?: NodeArray; } export interface JSDocUnknownTag extends JSDocTag { readonly kind: SyntaxKind.JSDocTag; @@ -4500,6 +4500,7 @@ declare namespace ts { function isUnparsedSource(node: Node): node is UnparsedSource; function isJSDocTypeExpression(node: Node): node is JSDocTypeExpression; function isJSDocNameReference(node: Node): node is JSDocNameReference; + function isJSDocLink(node: Node): node is JSDocLink; function isJSDocAllType(node: Node): node is JSDocAllType; function isJSDocUnknownType(node: Node): node is JSDocUnknownType; function isJSDocNullableType(node: Node): node is JSDocNullableType; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 0d3eab806c749..c33d79635a112 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1756,7 +1756,7 @@ declare namespace ts { } export interface JSDocComment { text: string; - links?: JSDocLink[]; + links?: NodeArray; } export interface JSDocUnknownTag extends JSDocTag { readonly kind: SyntaxKind.JSDocTag; @@ -4500,6 +4500,7 @@ declare namespace ts { function isUnparsedSource(node: Node): node is UnparsedSource; function isJSDocTypeExpression(node: Node): node is JSDocTypeExpression; function isJSDocNameReference(node: Node): node is JSDocNameReference; + function isJSDocLink(node: Node): node is JSDocLink; function isJSDocAllType(node: Node): node is JSDocAllType; function isJSDocUnknownType(node: Node): node is JSDocUnknownType; function isJSDocNullableType(node: Node): node is JSDocNullableType; diff --git a/tests/baselines/reference/jsdocLink1.baseline b/tests/baselines/reference/jsdocLink1.baseline index 68a9cb48cc567..5d77f2930802e 100644 --- a/tests/baselines/reference/jsdocLink1.baseline +++ b/tests/baselines/reference/jsdocLink1.baseline @@ -102,12 +102,23 @@ }, { "name": "see", - "text": "{" - }, - { - "name": "link", - "text": "C} its great", - "links": [] + "text": "{@link C} its great", + "links": [ + { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 156, + "length": 9 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + } + ] } ] } diff --git a/tests/baselines/reference/jsdocLink2.baseline b/tests/baselines/reference/jsdocLink2.baseline index 6ab0a844309c8..b124d5b400caf 100644 --- a/tests/baselines/reference/jsdocLink2.baseline +++ b/tests/baselines/reference/jsdocLink2.baseline @@ -102,12 +102,23 @@ }, { "name": "see", - "text": "{" - }, - { - "name": "link", - "text": "C} its great", - "links": [] + "text": "{@link C} its great", + "links": [ + { + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 144, + "length": 9 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink2.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + } + ] } ] } diff --git a/tests/baselines/reference/jsdocLink3.baseline b/tests/baselines/reference/jsdocLink3.baseline index 1f278b7c12365..daf05926e4368 100644 --- a/tests/baselines/reference/jsdocLink3.baseline +++ b/tests/baselines/reference/jsdocLink3.baseline @@ -102,12 +102,23 @@ }, { "name": "see", - "text": "{" - }, - { - "name": "link", - "text": "C} its great", - "links": [] + "text": "{@link C} its great", + "links": [ + { + "fileName": "/module1.ts", + "textSpan": { + "start": 177, + "length": 9 + }, + "target": { + "fileName": "/jsdocLink3.ts", + "textSpan": { + "start": 0, + "length": 18 + } + } + } + ] } ] } diff --git a/tests/baselines/reference/jsdocLink_findAllReferences1.baseline.jsonc b/tests/baselines/reference/jsdocLink_findAllReferences1.baseline.jsonc new file mode 100644 index 0000000000000..8fc9184f886d2 --- /dev/null +++ b/tests/baselines/reference/jsdocLink_findAllReferences1.baseline.jsonc @@ -0,0 +1,73 @@ +// === /tests/cases/fourslash/jsdocLink_findAllReferences1.ts === +// interface [|A|] {} +// /** +// * {@link [|A|]()} is ok +// */ +// declare const a: [|A|] + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/jsdocLink_findAllReferences1.ts", + "kind": "interface", + "name": "interface A", + "textSpan": { + "start": 10, + "length": 1 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/jsdocLink_findAllReferences1.ts", + "contextSpan": { + "start": 0, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 29, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/jsdocLink_findAllReferences1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 61, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/jsdocLink_findAllReferences1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/jsdocLink_rename1.baseline b/tests/baselines/reference/jsdocLink_rename1.baseline new file mode 100644 index 0000000000000..42d9421881cfd --- /dev/null +++ b/tests/baselines/reference/jsdocLink_rename1.baseline @@ -0,0 +1,7 @@ +/*====== /tests/cases/fourslash/jsdocLink_rename1.ts ======*/ + +interface [|RENAME|] {} +/** + * {@link RENAME()} is ok + */ +declare const a: RENAME diff --git a/tests/cases/fourslash/jsdocLink_findAllReferences1.ts b/tests/cases/fourslash/jsdocLink_findAllReferences1.ts new file mode 100644 index 0000000000000..656ae3fe7934c --- /dev/null +++ b/tests/cases/fourslash/jsdocLink_findAllReferences1.ts @@ -0,0 +1,9 @@ +/// + +//// interface A/**/ {} +//// /** +//// * {@link A()} is ok +//// */ +//// declare const a: A + +verify.baselineFindAllReferences(""); diff --git a/tests/cases/fourslash/jsdocLink_rename1.ts b/tests/cases/fourslash/jsdocLink_rename1.ts new file mode 100644 index 0000000000000..e49fd5c124bf1 --- /dev/null +++ b/tests/cases/fourslash/jsdocLink_rename1.ts @@ -0,0 +1,9 @@ +/// + +//// interface A/**/ {} +//// /** +//// * {@link A()} is ok +//// */ +//// declare const a: A + +verify.baselineRename('', {}) From 64baa187800fcc452191eae1cdcbe95ddac1d468 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 8 Dec 2020 12:13:53 -0800 Subject: [PATCH 19/44] add server test --- src/compiler/parser.ts | 2 +- src/testRunner/tsconfig.json | 1 + src/testRunner/unittests/tsserver/jsdocTag.ts | 62 +++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 src/testRunner/unittests/tsserver/jsdocTag.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 634834bd5e45d..3eb44ae2a1ca0 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7789,7 +7789,7 @@ namespace ts { return finishNode(factory.createJSDocAuthorTag(tagName, parseTrailingTagComments(start, end, indent, indentText)), start, end); } - let comments: JSDocComment = { text: authorInfoWithEmail }; + const comments: JSDocComment = { text: authorInfoWithEmail }; if (lookAhead(() => nextToken() !== SyntaxKind.NewLineTrivia)) { const tagComments = parseTagComments(indent); if (tagComments) { diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index c024bdb0d6d37..bb8de5a66f50b 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -172,6 +172,7 @@ "unittests/tsserver/importHelpers.ts", "unittests/tsserver/importSuggestionsCache.ts", "unittests/tsserver/inferredProjects.ts", + "unittests/tsserver/jsdocTag.ts", "unittests/tsserver/languageService.ts", "unittests/tsserver/maxNodeModuleJsDepth.ts", "unittests/tsserver/metadataInResponse.ts", diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts new file mode 100644 index 0000000000000..d496722db2be1 --- /dev/null +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -0,0 +1,62 @@ +namespace ts.projectSystem { + describe("unittests:: tsserver:: jsdoc @link ", () => { + it("should provide a target span for a working link", () => { + // TODO: (1) based on a dynamic file test + // (2) didn't work outside a tag + const file: File = { + path: "someFile1.js", + content: `class C { } +/** @wat {@link C} */ +var x = 1` + }; + const host = createServerHost([libFile], { useCaseSensitiveFileNames: true }); + const projectService = createProjectService(host); + projectService.setCompilerOptionsForInferredProjects({ + module: ModuleKind.CommonJS, + allowJs: true, + allowSyntheticDefaultImports: true, + allowNonTsExtensions: true + }); + projectService.openClientFile(file.path, `class C { } +/** @wat {@link C} */ +var x = 1`); + + const project = projectService.inferredProjects[0]; + const indexOfX = file.content.indexOf("x"); + assert.deepEqual(project.getLanguageService(/*ensureSynchronized*/ true).getQuickInfoAtPosition(file.path, indexOfX), { + kind: ScriptElementKind.variableElement, + kindModifiers: "", + textSpan: { start: indexOfX, length: 1 }, + displayParts: [ + { text: "var", kind: "keyword" }, + { text: " ", kind: "space" }, + { text: "x", kind: "localName" }, + { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, + { text: "number", kind: "keyword" } + ], + documentation: [], + tags: [{ + links: [{ + fileName: "someFile1.js", + target: { + fileName: "someFile1.js", + textSpan: { + length: 11, + start: 0, + } + }, + textSpan: { + length: 9, + start: 21, + }, + }], + name: "wat", + text: "{@link C}", + }] + }); + + + }); + }); +} From c307c03db8f81d5b58ebe75bfe8deee5269d58e6 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 10 Dec 2020 16:20:47 -0800 Subject: [PATCH 20/44] Make comments actually part of the AST --- src/compiler/factory/nodeFactory.ts | 18 +++ src/compiler/parser.ts | 106 ++++++++------ src/compiler/types.ts | 5 +- src/compiler/utilitiesPublic.ts | 8 +- src/deprecatedCompat/deprecations.ts | 2 +- src/services/classifier.ts | 3 + src/services/codefixes/inferFromUsage.ts | 3 +- src/services/services.ts | 2 +- ...ocComments.parsesCorrectly.@link tags.json | 48 +++++-- ...ts.parsesCorrectly.Nested @param tags.json | 24 ++-- ...parsesCorrectly.argSynonymForParamTag.json | 12 +- ...sCorrectly.argumentSynonymForParamTag.json | 12 +- ...parsesCorrectly.asteriskAfterPreamble.json | 12 +- ...DocComments.parsesCorrectly.authorTag.json | 134 +++++++++++------- ...sCorrectly.consecutive newline tokens.json | 16 +-- ...ments.parsesCorrectly.leadingAsterisk.json | 4 +- ...less-than and greater-than characters.json | 12 +- ...nts.parsesCorrectly.noLeadingAsterisk.json | 4 +- ...Comments.parsesCorrectly.noReturnType.json | 4 +- ...DocComments.parsesCorrectly.paramTag1.json | 12 +- ...arsesCorrectly.paramTagBracketedName1.json | 12 +- ...arsesCorrectly.paramTagBracketedName2.json | 12 +- ...parsesCorrectly.paramTagNameThenType2.json | 12 +- ...ocComments.parsesCorrectly.returnTag1.json | 4 +- ...ocComments.parsesCorrectly.returnTag2.json | 16 +-- ...cComments.parsesCorrectly.returnsTag1.json | 4 +- ...cComments.parsesCorrectly.templateTag.json | 4 +- ...Comments.parsesCorrectly.templateTag2.json | 4 +- ...Comments.parsesCorrectly.templateTag3.json | 4 +- ...Comments.parsesCorrectly.templateTag4.json | 4 +- ...Comments.parsesCorrectly.templateTag5.json | 4 +- ...Comments.parsesCorrectly.templateTag6.json | 16 +-- ...mments.parsesCorrectly.threeAsterisks.json | 12 +- .../DocComments.parsesCorrectly.typeTag.json | 4 +- .../reference/api/tsserverlibrary.d.ts | 73 +++++----- tests/baselines/reference/api/typescript.d.ts | 73 +++++----- .../reference/checkJsdocTypeTag5.errors.txt | 2 +- .../reference/checkJsdocTypeTag6.errors.txt | 4 +- .../enumTagCircularReference.errors.txt | 2 +- ...findAllRefs_importType_js.1.baseline.jsonc | 2 +- .../findAllRefs_importType_js.baseline.jsonc | 4 +- tests/baselines/reference/jsDocTags.baseline | 27 ++-- .../jsdocImportTypeNodeNamespace.errors.txt | 2 +- .../reference/jsdocTypeTagCast.errors.txt | 10 +- .../quickInfoDisplayPartsParameters.baseline | 3 +- .../quickInfoForJSDocCodefence.baseline | 6 +- .../quickInfoForJSDocUnknownTag.baseline | 15 +- .../reference/quickInfoJsDocTags.baseline | 21 +-- .../smartSelection_JSDocTags1.baseline | 3 +- .../smartSelection_JSDocTags2.baseline | 3 +- .../smartSelection_JSDocTags9.baseline | 2 +- ...rReferenceOnConstructorFunction.errors.txt | 3 +- ...nusedTypeParameters_templateTag.errors.txt | 2 +- ...usedTypeParameters_templateTag2.errors.txt | 6 +- .../codeFixUnusedIdentifier_all_delete_js.ts | 16 +-- ...eFixUnusedIdentifier_delete_templateTag.ts | 3 +- tests/cases/fourslash/commentsClassMembers.ts | 4 +- .../cases/fourslash/commentsCommentParsing.ts | 24 ++-- .../fourslash/commentsFunctionExpression.ts | 20 +-- .../completionEntryForUnionMethod.ts | 4 +- .../fourslash/findAllRefsJsDocTypeDef_js.ts | 2 +- .../findAllRefsTypedef_importType.ts | 2 +- tests/cases/fourslash/jsDocTags.ts | 2 +- .../jsdocTypedefTagSemanticMeaning0.ts | 2 +- ...lsaMethodsOnAssignedFunctionExpressions.ts | 2 +- .../server/jsdocTypedefTagRename02.ts | 2 +- ...tacticClassificationForJSDocTemplateTag.ts | 5 +- .../syntacticClassificationsDocComment1.ts | 2 +- 68 files changed, 481 insertions(+), 425 deletions(-) diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index a48646ccdc7b5..0cd68c689218f 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -372,6 +372,8 @@ namespace ts { get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocDeprecatedTag); }, createJSDocUnknownTag, updateJSDocUnknownTag, + createJSDocCommentComment, + updateJSDocCommentComment, createJSDocComment, updateJSDocComment, createJsxElement, @@ -4451,6 +4453,22 @@ namespace ts { : node; } + // @api + function createJSDocCommentComment(text: string, links?: readonly JSDocLink[]): JSDocComment { + const node = createBaseNode(SyntaxKind.JSDocCommentComment); + node.text = text; + node.links = asNodeArray(links); + return node; + } + + // @api + function updateJSDocCommentComment(node: JSDocComment, text: string, links?: readonly JSDocLink[]): JSDocComment { + return node.text !== text + || node.links !== links + ? update(createJSDocCommentComment(text, links), node) + : node; + } + // @api function createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined) { const node = createBaseNode(SyntaxKind.JSDocComment); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index c2c8569577df4..284daba6c0d75 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -481,12 +481,14 @@ namespace ts { return visitNodes(cbNode, cbNodes, (node).parameters) || visitNode(cbNode, (node).type); case SyntaxKind.JSDocComment: - return visitNodes(cbNode, cbNodes, (node as JSDoc).comment?.links) + return visitNode(cbNode, (node as JSDoc).comment) || visitNodes(cbNode, cbNodes, (node).tags); + case SyntaxKind.JSDocCommentComment: + return visitNodes(cbNode, cbNodes, (node as JSDocComment).links); case SyntaxKind.JSDocSeeTag: return visitNode(cbNode, (node as JSDocSeeTag).tagName) || visitNode(cbNode, (node as JSDocSeeTag).name) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); + visitNode(cbNode, (node as JSDocTag).comment); case SyntaxKind.JSDocNameReference: return visitNode(cbNode, (node as JSDocNameReference).name); case SyntaxKind.JSDocParameterTag: @@ -495,47 +497,47 @@ namespace ts { ((node as JSDocPropertyLikeTag).isNameFirst ? visitNode(cbNode, (node).name) || visitNode(cbNode, (node).typeExpression) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links) + visitNode(cbNode, (node as JSDocTag).comment) : visitNode(cbNode, (node).typeExpression) || visitNode(cbNode, (node).name)) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); + visitNode(cbNode, (node as JSDocTag).comment); case SyntaxKind.JSDocAuthorTag: return visitNode(cbNode, (node as JSDocTag).tagName); case SyntaxKind.JSDocImplementsTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node).class) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); + visitNode(cbNode, (node as JSDocTag).comment); case SyntaxKind.JSDocAugmentsTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node).class) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); + visitNode(cbNode, (node as JSDocTag).comment); case SyntaxKind.JSDocTemplateTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node).constraint) || visitNodes(cbNode, cbNodes, (node).typeParameters) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); + visitNode(cbNode, (node as JSDocTag).comment); case SyntaxKind.JSDocTypedefTag: return visitNode(cbNode, (node as JSDocTag).tagName) || ((node as JSDocTypedefTag).typeExpression && (node as JSDocTypedefTag).typeExpression!.kind === SyntaxKind.JSDocTypeExpression ? visitNode(cbNode, (node).typeExpression) || visitNode(cbNode, (node).fullName) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links) + visitNode(cbNode, (node as JSDocTag).comment) : visitNode(cbNode, (node).fullName) || visitNode(cbNode, (node).typeExpression)) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); + visitNode(cbNode, (node as JSDocTag).comment); case SyntaxKind.JSDocCallbackTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocCallbackTag).fullName) || visitNode(cbNode, (node as JSDocCallbackTag).typeExpression) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); + visitNode(cbNode, (node as JSDocTag).comment); case SyntaxKind.JSDocReturnTag: case SyntaxKind.JSDocTypeTag: case SyntaxKind.JSDocThisTag: case SyntaxKind.JSDocEnumTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocReturnTag | JSDocTypeTag | JSDocThisTag | JSDocEnumTag).typeExpression) || - visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); + visitNode(cbNode, (node as JSDocTag).comment); case SyntaxKind.JSDocSignature: return forEach((node).typeParameters, cbNode) || forEach((node).parameters, cbNode) || @@ -551,7 +553,7 @@ namespace ts { case SyntaxKind.JSDocProtectedTag: case SyntaxKind.JSDocReadonlyTag: return visitNode(cbNode, (node as JSDocTag).tagName) - || visitNodes(cbNode, cbNodes, (node as JSDocTag).comment?.links); + || visitNode(cbNode, (node as JSDocTag).comment); case SyntaxKind.PartiallyEmittedExpression: return visitNode(cbNode, (node).expression); } @@ -7293,6 +7295,9 @@ namespace ts { let tags: JSDocTag[]; let tagsPos: number; let tagsEnd: number; + let linksPos: number; + let linksEnd: number; + let commentsPos: number | undefined; const comments: string[] = []; const links: JSDocLink[] = []; @@ -7324,6 +7329,7 @@ namespace ts { case SyntaxKind.AtToken: if (state === JSDocState.BeginningOfLine || state === JSDocState.SawAsterisk) { removeTrailingWhitespace(comments); + if (!commentsPos) commentsPos = getNodePos(); addTag(parseTag(indent)); // NOTE: According to usejsdoc.org, a tag goes to end of line, except the last tag. // Real-world comments may break this rule, so "BeginningOfLine" will not be a real line beginning @@ -7368,9 +7374,12 @@ namespace ts { break loop; case SyntaxKind.OpenBraceToken: state = JSDocState.SavingComments; - const link = parseLink(scanner.getTextPos() - 1); + const linkStart = scanner.getTextPos() - 1; + const link = parseLink(linkStart); if (link) { links.push(link); + if (!linksPos) linksPos = linkStart; + linksEnd = scanner.getTextPos(); pushComment(scanner.getText().slice(link.pos, link.end)); break; } @@ -7403,7 +7412,11 @@ namespace ts { } function createJSDocComment(): JSDoc { - const comment = comments.length ? { links: createNodeArray(links, -1, -1), text: comments.join("") } : undefined; + const linksArray = links.length ? createNodeArray(links, linksPos, linksEnd) : undefined; + if (comments.length && tags) Debug.assertIsDefined(commentsPos); + const comment = comments.length + ? finishNode(factory.createJSDocCommentComment(comments.join(""), linksArray), start, commentsPos) + : undefined; const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); return finishNode(factory.createJSDocComment(comment, tagsArray), start, end); } @@ -7542,7 +7555,10 @@ namespace ts { } function parseTagComments(indent: number, initialMargin?: string): JSDocComment | undefined { + const commentsPos = getNodePos(); const comments: string[] = []; + let linksPos; + let linksEnd; const links: JSDocLink[] = []; let state = JSDocState.BeginningOfLine; let margin: number | undefined; @@ -7594,9 +7610,12 @@ namespace ts { break; case SyntaxKind.OpenBraceToken: state = JSDocState.SavingComments; - const link = parseLink(scanner.getTextPos() - 1); + const linkStart = scanner.getTextPos() - 1; + const link = parseLink(linkStart); if (link) { + if (!linksPos) linksPos = linkStart; links.push(link); + linksEnd = scanner.getTextPos(); pushComment(scanner.getText().slice(link.pos, link.end)); } else { @@ -7633,7 +7652,10 @@ namespace ts { removeLeadingNewlines(comments); removeTrailingWhitespace(comments); - return comments.length === 0 ? undefined : { links: createNodeArray(links, -1, -1), text: comments.join("") }; + if (comments.length) { + const comment = factory.createJSDocCommentComment(comments.join(""), links.length ? createNodeArray(links, linksPos ?? indent, linksEnd) : undefined); + return finishNode(comment, commentsPos, scanner.getTextPos()); + } } function parseLink(start: number) { @@ -7653,8 +7675,7 @@ namespace ts { } function parseUnknownTag(start: number, tagName: Identifier, indent: number, indentText: string) { - const end = getNodePos(); - return finishNode(factory.createJSDocUnknownTag(tagName, parseTrailingTagComments(start, end, indent, indentText)), start, end); + return finishNode(factory.createJSDocUnknownTag(tagName, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start); } function addTag(tag: JSDocTag | undefined): void { @@ -7759,8 +7780,7 @@ namespace ts { } const typeExpression = tryParseTypeExpression(); - const end = getNodePos(); - return finishNode(factory.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start, end, indent, indentText)), start, end); + return finishNode(factory.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start); } function parseTypeTag(start: number, tagName: Identifier, indent?: number, indentText?: string): JSDocTypeTag { @@ -7769,27 +7789,28 @@ namespace ts { } const typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); - const end = getNodePos(); - const comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, end, indent, indentText) : undefined; - return finishNode(factory.createJSDocTypeTag(tagName, typeExpression, comments), start, end); + const comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined; + return finishNode(factory.createJSDocTypeTag(tagName, typeExpression, comments), start); } function parseSeeTag(start: number, tagName: Identifier, indent?: number, indentText?: string): JSDocSeeTag { const isLink = lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"); const nameExpression = isLink ? undefined : parseJSDocNameReference(); - const end = getNodePos(); - const comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, end, indent, indentText) : undefined; - return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments), start, end); + const comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined; + return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments), start); } function parseAuthorTag(start: number, tagName: Identifier, indent: number, indentText: string): JSDocAuthorTag { - const comments: JSDocComment = { text: parseAuthorNameAndEmail() }; + const commentStart = getNodePos(); + let text = parseAuthorNameAndEmail(); + let links; const tagComments = parseTrailingTagComments(start, end, indent, indentText); if (tagComments) { - comments.text += tagComments.text; - comments.links = tagComments.links; + text += tagComments.text; + links = tagComments.links; } - return finishNode(factory.createJSDocAuthorTag(tagName, comments.text || comments.links ? comments : undefined), start); + const comment = text || links ? finishNode(factory.createJSDocCommentComment(text, links), commentStart) : undefined; + return finishNode(factory.createJSDocAuthorTag(tagName, comment), start); } function parseAuthorNameAndEmail(): string { @@ -7817,14 +7838,12 @@ namespace ts { function parseImplementsTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocImplementsTag { const className = parseExpressionWithTypeArgumentsForAugments(); - const end = getNodePos(); - return finishNode(factory.createJSDocImplementsTag(tagName, className, parseTrailingTagComments(start, end, margin, indentText)), start, end); + return finishNode(factory.createJSDocImplementsTag(tagName, className, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); } function parseAugmentsTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocAugmentsTag { const className = parseExpressionWithTypeArgumentsForAugments(); - const end = getNodePos(); - return finishNode(factory.createJSDocAugmentsTag(tagName, className, parseTrailingTagComments(start, end, margin, indentText)), start, end); + return finishNode(factory.createJSDocAugmentsTag(tagName, className, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); } function parseExpressionWithTypeArgumentsForAugments(): ExpressionWithTypeArguments & { expression: Identifier | PropertyAccessEntityNameExpression } { @@ -7851,22 +7870,19 @@ namespace ts { } function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: JSDocComment) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { - const end = getNodePos(); - return finishNode(createTag(tagName, parseTrailingTagComments(start, end, margin, indentText)), start, end); + return finishNode(createTag(tagName, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); } function parseThisTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocThisTag { const typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); skipWhitespace(); - const end = getNodePos(); - return finishNode(factory.createJSDocThisTag(tagName, typeExpression, parseTrailingTagComments(start, end, margin, indentText)), start, end); + return finishNode(factory.createJSDocThisTag(tagName, typeExpression, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); } function parseEnumTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocEnumTag { const typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); skipWhitespace(); - const end = getNodePos(); - return finishNode(factory.createJSDocEnumTag(tagName, typeExpression, parseTrailingTagComments(start, end, margin, indentText)), start, end); + return finishNode(factory.createJSDocEnumTag(tagName, typeExpression, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); } function parseTypedefTag(start: number, tagName: Identifier, indent: number, indentText: string): JSDocTypedefTag { @@ -7925,7 +7941,7 @@ namespace ts { } const typedefTag = factory.createJSDocTypedefTag(tagName, typeExpression, fullName, comment); - return finishNode(typedefTag, start, end); + return finishNode(typedefTag, start); } function parseJSDocTypeNameWithNamespace(nested?: boolean) { @@ -7977,11 +7993,10 @@ namespace ts { } }); const typeExpression = finishNode(factory.createJSDocSignature(/*typeParameters*/ undefined, parameters, returnTag), start); - const end = getNodePos(); if (!comment) { - comment = parseTrailingTagComments(start, end, indent, indentText); + comment = parseTrailingTagComments(start, getNodePos(), indent, indentText); } - return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start, end); + return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start); } function escapedTextsEqual(a: EntityName, b: EntityName): boolean { @@ -8097,8 +8112,7 @@ namespace ts { // TODO: Consider only parsing a single type parameter if there is a constraint. const constraint = token() === SyntaxKind.OpenBraceToken ? parseJSDocTypeExpression() : undefined; const typeParameters = parseTemplateTagTypeParameters(); - const end = getNodePos(); - return finishNode(factory.createJSDocTemplateTag(tagName, constraint, typeParameters, parseTrailingTagComments(start, end, indent, indentText)), start, end); + return finishNode(factory.createJSDocTemplateTag(tagName, constraint, typeParameters, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start); } function parseOptionalJsdoc(t: JSDocSyntaxKind): boolean { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ae244984c2f99..e5c575bbc528f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -373,6 +373,7 @@ namespace ts { // https://jsdoc.app/about-namepaths.html JSDocNamepathType, JSDocComment, + JSDocCommentComment, JSDocTypeLiteral, JSDocSignature, JSDocLink, @@ -3154,7 +3155,7 @@ namespace ts { readonly name?: EntityName; } - export interface JSDocComment { + export interface JSDocComment extends Node { text: string; links?: NodeArray; } @@ -7113,6 +7114,8 @@ namespace ts { updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag; createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; + createJSDocCommentComment(text: string, links?: readonly JSDocLink[]): JSDocComment; + updateJSDocCommentComment(node: JSDocComment, text: string, links?: readonly JSDocLink[]): JSDocComment; createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 6722e7ad5be1f..3e3aeb3b9e86b 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1845,7 +1845,13 @@ 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 || node.kind === SyntaxKind.JSDocNamepathType || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node); + return node.kind === SyntaxKind.JSDocComment + || node.kind === SyntaxKind.JSDocCommentComment + || node.kind === SyntaxKind.JSDocNamepathType + || node.kind === SyntaxKind.JSDocLink + || isJSDocTag(node) + || isJSDocTypeLiteral(node) + || isJSDocSignature(node); } // TODO: determine what this does before making it public. diff --git a/src/deprecatedCompat/deprecations.ts b/src/deprecatedCompat/deprecations.ts index 0946dff6f25ad..2549b9610ea1a 100644 --- a/src/deprecatedCompat/deprecations.ts +++ b/src/deprecatedCompat/deprecations.ts @@ -1216,7 +1216,7 @@ namespace ts { /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ export const createJSDocParamTag = Debug.deprecate(function createJSDocParamTag(name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, comment?: string): JSDocParameterTag { - return factory.createJSDocParameterTag(/*tagName*/ undefined, name, isBracketed, typeExpression, /*isNameFirst*/ false, comment ? { text: comment } : undefined); + return factory.createJSDocParameterTag(/*tagName*/ undefined, name, isBracketed, typeExpression, /*isNameFirst*/ false, comment ? factory.createJSDocCommentComment(comment) : undefined); }, factoryDeprecation); /** @deprecated Use `factory.createComma` or the factory supplied by your transformation context instead. */ diff --git a/src/services/classifier.ts b/src/services/classifier.ts index fc9cad9c5a71d..fd8d5cc2ea7fa 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -740,6 +740,9 @@ namespace ts { pos = tag.end; break; } + if (tag.comment) { + pushCommentRange(tag.comment.pos, tag.comment.end - tag.comment.pos); + } } } diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index c9705e82db745..d50c3a59f97bf 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -282,6 +282,7 @@ namespace ts.codefix { program: Program, host: LanguageServiceHost, cancellationToken: CancellationToken, + ): void { const param = firstOrUndefined(setAccessorDeclaration.parameters); if (param && isIdentifier(setAccessorDeclaration.name) && isIdentifier(param.name)) { @@ -387,7 +388,7 @@ namespace ts.codefix { if (merged) oldTags[i] = merged; return !!merged; })); - const tag = factory.createJSDocComment({ text: comments.join("\n") }, factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); + const tag = factory.createJSDocComment(factory.createJSDocCommentComment(comments.join("\n")), factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); const jsDocNode = parent.kind === SyntaxKind.ArrowFunction ? getJsDocNodeForArrowFunction(parent) : parent; jsDocNode.jsDoc = parent.jsDoc; jsDocNode.jsDocCache = parent.jsDocCache; diff --git a/src/services/services.ts b/src/services/services.ts index 3b14da82c9ee9..7d0c16a184480 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -173,7 +173,7 @@ namespace ts { const token = scanner.scan(); const textPos = scanner.getTextPos(); if (textPos <= end) { - if (token === SyntaxKind.Identifier && !isJSDocLink(parent)) { + if (token === SyntaxKind.Identifier) { Debug.fail(`Did not expect ${Debug.formatSyntaxKind(parent.kind)} to have an Identifier in its trivia`); } nodes.push(createNode(token, pos, textPos, parent)); diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index c47a401569bdb..68120d5683aa7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -6,6 +6,12 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { + "kind": "JSDocCommentComment", + "pos": 0, + "end": 59, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "{@link first }\nInside {@link link text} thing", "links": { "0": { "kind": "JSDocLink", @@ -38,12 +44,11 @@ } }, "length": 2, - "pos": -1, - "end": -1, + "pos": 7, + "end": 49, "hasTrailingComma": false, "transformFlags": 0 - }, - "text": "{@link first }\nInside {@link link text} thing" + } }, "tags": { "0": { @@ -61,6 +66,12 @@ "escapedText": "param" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 70, + "end": 102, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "See also {@link A.Reference}", "links": { "0": { "kind": "JSDocLink", @@ -93,12 +104,11 @@ } }, "length": 1, - "pos": -1, - "end": -1, + "pos": 79, + "end": 98, "hasTrailingComma": false, "transformFlags": 0 - }, - "text": "See also {@link A.Reference}" + } }, "name": { "kind": "Identifier", @@ -126,6 +136,12 @@ "escapedText": "param" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 113, + "end": 589, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Or see {@link http://www.zombocom.com }\n{@link Standalone.Complex }\nThis empty one: {@link} is OK.\nThis double-space one: {@link doubled } is OK too.\nThis should work, despite being badly formatted: {@link\noh.no\n}\nForgot to close this one {@link https://typescriptlang.org\n * But it's still OK.\nAlthough it skips the newline so parses the asterisks in the wrong state.\nThis shouldn't work: {@link\n * nope\n * }, because of the intermediate asterisks.", "links": { "0": { "kind": "JSDocLink", @@ -263,12 +279,11 @@ } }, "length": 7, - "pos": -1, - "end": -1, + "pos": 120, + "end": 541, "hasTrailingComma": false, "transformFlags": 0 - }, - "text": "Or see {@link http://www.zombocom.com }\n{@link Standalone.Complex }\nThis empty one: {@link} is OK.\nThis double-space one: {@link doubled } is OK too.\nThis should work, despite being badly formatted: {@link\noh.no\n}\nForgot to close this one {@link https://typescriptlang.org\n * But it's still OK.\nAlthough it skips the newline so parses the asterisks in the wrong state.\nThis shouldn't work: {@link\n * nope\n * }, because of the intermediate asterisks." + } }, "name": { "kind": "Identifier", @@ -296,6 +311,11 @@ "escapedText": "author" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 597, + "end": 672, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Alfa Romero See my home page: {@link https://example.com}", "links": { "0": { @@ -314,8 +334,8 @@ } }, "length": 1, - "pos": -1, - "end": -1, + "pos": 643, + "end": 670, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json index 357e691404d76..674bcdd21be2b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -21,13 +21,11 @@ "escapedText": "param" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 24, + "end": 34, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Doc doc" }, "typeExpression": { @@ -58,13 +56,11 @@ "escapedText": "param" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 54, + "end": 64, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Doc for f" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index bb0cbffdca8dc..47dee40afb22d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -21,13 +21,11 @@ "escapedText": "arg" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 28, + "end": 42, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Description" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index 521b6100de6e9..95d6022dc4caa 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -21,13 +21,11 @@ "escapedText": "argument" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 33, + "end": 47, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Description" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json index f6e556b5b0176..9295ce3d9c129 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json @@ -6,13 +6,11 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 0, + "end": 21, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "* @type {number}" } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index 118c1e8813a54..16fb005b9e387 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -21,6 +21,11 @@ "escapedText": "author" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 15, + "end": 50, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "John Doe " } }, @@ -39,14 +44,12 @@ "escapedText": "author" }, "comment": { - "text": "John Doe unexpected comment", - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - } + "kind": "JSDocCommentComment", + "pos": 58, + "end": 112, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "John Doe unexpected comment" } }, "2": { @@ -64,14 +67,12 @@ "escapedText": "author" }, "comment": { - "text": "108 <108@actionbutton.net> Video Games Forever", - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - } + "kind": "JSDocCommentComment", + "pos": 120, + "end": 170, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "108 <108@actionbutton.net> Video Games Forever" } }, "3": { @@ -89,6 +90,11 @@ "escapedText": "author" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 178, + "end": 227, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Multiple Ats " } }, @@ -107,6 +113,11 @@ "escapedText": "author" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 235, + "end": 272, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Multiple Open Carets " } }, @@ -125,14 +136,12 @@ "escapedText": "author" }, "comment": { - "text": "Multiple Close Carets invalid>but>who>cares>", - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - } + "kind": "JSDocCommentComment", + "pos": 280, + "end": 338, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Multiple Close Carets invalid>but>who>cares>" } }, "6": { @@ -150,6 +159,11 @@ "escapedText": "author" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 346, + "end": 381, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Unclosed Carets " } }, @@ -204,6 +228,11 @@ "escapedText": "author" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 437, + "end": 445, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Line" } }, @@ -252,6 +281,11 @@ "escapedText": "author" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 469, + "end": 486, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Empty authors" } }, @@ -285,6 +319,11 @@ "escapedText": "author" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 510, + "end": 522, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Comments" } }, @@ -303,6 +342,11 @@ "escapedText": "author" }, "comment": { + "kind": "JSDocCommentComment", + "pos": 530, + "end": 559, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Early Close Caret > " } }, @@ -321,20 +365,18 @@ "escapedText": "author" }, "comment": { - "text": "No Line Breaks: must be on the same line to parse" } }, @@ -371,14 +411,12 @@ "escapedText": "author" }, "comment": { - "text": "Long Comment I\nwant to keep commenting down here, I dunno.", - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - } + "kind": "JSDocCommentComment", + "pos": 653, + "end": 736, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Long Comment I\nwant to keep commenting down here, I dunno." } }, "length": 19, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json index b221ec330af62..f3e0722fd1a10 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTag", "pos": 7, - "end": 19, + "end": 53, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -21,19 +21,17 @@ "escapedText": "example" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 19, + "end": 53, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Some\n\ntext\r\nwith newlines." } }, "length": 1, "pos": 7, - "end": 19, + "end": 53, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json index 1289886390bdf..27a284ebe7bae 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTypeTag", "pos": 8, - "end": 22, + "end": 25, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -38,7 +38,7 @@ }, "length": 1, "pos": 8, - "end": 22, + "end": 25, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index 398f73a1a674e..fb055f94b794b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -21,13 +21,11 @@ "escapedText": "param" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 16, + "end": 59, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "hi\n< > still part of the previous comment" }, "name": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json index 1289886390bdf..27a284ebe7bae 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTypeTag", "pos": 8, - "end": 22, + "end": 25, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -38,7 +38,7 @@ }, "length": 1, "pos": 8, - "end": 22, + "end": 25, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json index e7e8b9d13d78b..052aa1c5aa6c5 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocReturnTag", "pos": 8, - "end": 15, + "end": 18, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -24,7 +24,7 @@ }, "length": 1, "pos": 8, - "end": 15, + "end": 18, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index 217e0af9a269e..a497996159437 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -21,13 +21,11 @@ "escapedText": "param" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 30, + "end": 57, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Description text follows" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index 0cf96860d8d76..c4133f3324bc2 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -21,13 +21,11 @@ "escapedText": "param" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 31, + "end": 59, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Description text follows" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index 08ef73797599d..ff7e6700b2185 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -21,13 +21,11 @@ "escapedText": "param" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 36, + "end": 64, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Description text follows" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index 06765c6abbf9a..06995e3692fd5 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -21,13 +21,11 @@ "escapedText": "param" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 29, + "end": 44, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Description" }, "typeExpression": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json index a7f96aa220f0d..e5d3ee7b6149a 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocReturnTag", "pos": 8, - "end": 24, + "end": 27, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -38,7 +38,7 @@ }, "length": 1, "pos": 8, - "end": 24, + "end": 27, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json index a4cdde739fd34..b492b3504c8eb 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocReturnTag", "pos": 8, - "end": 24, + "end": 52, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -22,13 +22,11 @@ "escapedText": "return" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 24, + "end": 52, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Description text follows" }, "typeExpression": { @@ -48,7 +46,7 @@ }, "length": 1, "pos": 8, - "end": 24, + "end": 52, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json index a0af3c57f2543..230dd41541585 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocReturnTag", "pos": 8, - "end": 25, + "end": 28, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -37,7 +37,7 @@ }, "length": 1, "pos": 8, - "end": 25, + "end": 28, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json index 14d338f4368c3..50c772455d0ec 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 19, + "end": 22, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -45,7 +45,7 @@ }, "length": 1, "pos": 8, - "end": 19, + "end": 22, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json index 0217b5efc5749..1b4c8e8976951 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 21, + "end": 24, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -60,7 +60,7 @@ }, "length": 1, "pos": 8, - "end": 21, + "end": 24, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json index 1761d1f67b3c4..15bab6344a35b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 22, + "end": 25, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -60,7 +60,7 @@ }, "length": 1, "pos": 8, - "end": 22, + "end": 25, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json index 1761d1f67b3c4..15bab6344a35b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 22, + "end": 25, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -60,7 +60,7 @@ }, "length": 1, "pos": 8, - "end": 22, + "end": 25, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json index d0faa579c0826..e3f4dceb82b74 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 23, + "end": 26, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -60,7 +60,7 @@ }, "length": 1, "pos": 8, - "end": 23, + "end": 26, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json index e666b205e8ba6..3bc06c47763e3 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 24, + "end": 58, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -21,13 +21,11 @@ "escapedText": "template" }, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 24, + "end": 58, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Description of type parameters." }, "typeParameters": { @@ -70,7 +68,7 @@ }, "length": 1, "pos": 8, - "end": 24, + "end": 58, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json index 2c499a05c830d..cd85c9a253b82 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json @@ -6,13 +6,11 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "links": { - "length": 0, - "pos": -1, - "end": -1, - "hasTrailingComma": false, - "transformFlags": 0 - }, + "kind": "JSDocCommentComment", + "pos": 0, + "end": 5, + "modifierFlagsCache": 0, + "transformFlags": 0, "text": "*" } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json index 1289886390bdf..27a284ebe7bae 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json @@ -9,7 +9,7 @@ "0": { "kind": "JSDocTypeTag", "pos": 8, - "end": 22, + "end": 25, "modifierFlagsCache": 0, "transformFlags": 0, "tagName": { @@ -38,7 +38,7 @@ }, "length": 1, "pos": 8, - "end": 22, + "end": 25, "hasTrailingComma": false, "transformFlags": 0 } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index db5683b89d23a..7112242c879ac 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -416,37 +416,38 @@ declare namespace ts { JSDocVariadicType = 309, JSDocNamepathType = 310, JSDocComment = 311, - JSDocTypeLiteral = 312, - JSDocSignature = 313, - JSDocLink = 314, - JSDocTag = 315, - JSDocAugmentsTag = 316, - JSDocImplementsTag = 317, - JSDocAuthorTag = 318, - JSDocDeprecatedTag = 319, - JSDocClassTag = 320, - JSDocPublicTag = 321, - JSDocPrivateTag = 322, - JSDocProtectedTag = 323, - JSDocReadonlyTag = 324, - JSDocCallbackTag = 325, - JSDocEnumTag = 326, - JSDocParameterTag = 327, - JSDocReturnTag = 328, - JSDocThisTag = 329, - JSDocTypeTag = 330, - JSDocTemplateTag = 331, - JSDocTypedefTag = 332, - JSDocSeeTag = 333, - JSDocPropertyTag = 334, - SyntaxList = 335, - NotEmittedStatement = 336, - PartiallyEmittedExpression = 337, - CommaListExpression = 338, - MergeDeclarationMarker = 339, - EndOfDeclarationMarker = 340, - SyntheticReferenceExpression = 341, - Count = 342, + JSDocCommentComment = 312, + JSDocTypeLiteral = 313, + JSDocSignature = 314, + JSDocLink = 315, + JSDocTag = 316, + JSDocAugmentsTag = 317, + JSDocImplementsTag = 318, + JSDocAuthorTag = 319, + JSDocDeprecatedTag = 320, + JSDocClassTag = 321, + JSDocPublicTag = 322, + JSDocPrivateTag = 323, + JSDocProtectedTag = 324, + JSDocReadonlyTag = 325, + JSDocCallbackTag = 326, + JSDocEnumTag = 327, + JSDocParameterTag = 328, + JSDocReturnTag = 329, + JSDocThisTag = 330, + JSDocTypeTag = 331, + JSDocTemplateTag = 332, + JSDocTypedefTag = 333, + JSDocSeeTag = 334, + JSDocPropertyTag = 335, + SyntaxList = 336, + NotEmittedStatement = 337, + PartiallyEmittedExpression = 338, + CommaListExpression = 339, + MergeDeclarationMarker = 340, + EndOfDeclarationMarker = 341, + SyntheticReferenceExpression = 342, + Count = 343, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -475,9 +476,9 @@ declare namespace ts { LastStatement = 248, FirstNode = 157, FirstJSDocNode = 301, - LastJSDocNode = 334, - FirstJSDocTagNode = 315, - LastJSDocTagNode = 334, + LastJSDocNode = 335, + FirstJSDocTagNode = 316, + LastJSDocTagNode = 335, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -1754,7 +1755,7 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; } - export interface JSDocComment { + export interface JSDocComment extends Node { text: string; links?: NodeArray; } @@ -3508,6 +3509,8 @@ declare namespace ts { updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag; createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; + createJSDocCommentComment(text: string, links?: readonly JSDocLink[]): JSDocComment; + updateJSDocCommentComment(node: JSDocComment, text: string, links?: readonly JSDocLink[]): JSDocComment; createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index c33d79635a112..86787059f6304 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -416,37 +416,38 @@ declare namespace ts { JSDocVariadicType = 309, JSDocNamepathType = 310, JSDocComment = 311, - JSDocTypeLiteral = 312, - JSDocSignature = 313, - JSDocLink = 314, - JSDocTag = 315, - JSDocAugmentsTag = 316, - JSDocImplementsTag = 317, - JSDocAuthorTag = 318, - JSDocDeprecatedTag = 319, - JSDocClassTag = 320, - JSDocPublicTag = 321, - JSDocPrivateTag = 322, - JSDocProtectedTag = 323, - JSDocReadonlyTag = 324, - JSDocCallbackTag = 325, - JSDocEnumTag = 326, - JSDocParameterTag = 327, - JSDocReturnTag = 328, - JSDocThisTag = 329, - JSDocTypeTag = 330, - JSDocTemplateTag = 331, - JSDocTypedefTag = 332, - JSDocSeeTag = 333, - JSDocPropertyTag = 334, - SyntaxList = 335, - NotEmittedStatement = 336, - PartiallyEmittedExpression = 337, - CommaListExpression = 338, - MergeDeclarationMarker = 339, - EndOfDeclarationMarker = 340, - SyntheticReferenceExpression = 341, - Count = 342, + JSDocCommentComment = 312, + JSDocTypeLiteral = 313, + JSDocSignature = 314, + JSDocLink = 315, + JSDocTag = 316, + JSDocAugmentsTag = 317, + JSDocImplementsTag = 318, + JSDocAuthorTag = 319, + JSDocDeprecatedTag = 320, + JSDocClassTag = 321, + JSDocPublicTag = 322, + JSDocPrivateTag = 323, + JSDocProtectedTag = 324, + JSDocReadonlyTag = 325, + JSDocCallbackTag = 326, + JSDocEnumTag = 327, + JSDocParameterTag = 328, + JSDocReturnTag = 329, + JSDocThisTag = 330, + JSDocTypeTag = 331, + JSDocTemplateTag = 332, + JSDocTypedefTag = 333, + JSDocSeeTag = 334, + JSDocPropertyTag = 335, + SyntaxList = 336, + NotEmittedStatement = 337, + PartiallyEmittedExpression = 338, + CommaListExpression = 339, + MergeDeclarationMarker = 340, + EndOfDeclarationMarker = 341, + SyntheticReferenceExpression = 342, + Count = 343, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -475,9 +476,9 @@ declare namespace ts { LastStatement = 248, FirstNode = 157, FirstJSDocNode = 301, - LastJSDocNode = 334, - FirstJSDocTagNode = 315, - LastJSDocTagNode = 334, + LastJSDocNode = 335, + FirstJSDocTagNode = 316, + LastJSDocTagNode = 335, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -1754,7 +1755,7 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; } - export interface JSDocComment { + export interface JSDocComment extends Node { text: string; links?: NodeArray; } @@ -3508,6 +3509,8 @@ declare namespace ts { updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag; createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; + createJSDocCommentComment(text: string, links?: readonly JSDocLink[]): JSDocComment; + updateJSDocCommentComment(node: JSDocComment, text: string, links?: readonly JSDocLink[]): JSDocComment; createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; diff --git a/tests/baselines/reference/checkJsdocTypeTag5.errors.txt b/tests/baselines/reference/checkJsdocTypeTag5.errors.txt index 022817b999744..5b8669e7ff19d 100644 --- a/tests/baselines/reference/checkJsdocTypeTag5.errors.txt +++ b/tests/baselines/reference/checkJsdocTypeTag5.errors.txt @@ -50,7 +50,7 @@ tests/cases/conformance/jsdoc/test.js(34,5): error TS2322: Type '1 | 2' is not a /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ /** @type {Gioconda} */ - ~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~ !!! error TS8030: The type of a function declaration must match the function's signature. function monaLisa(sb) { return typeof sb === 'string' ? 1 : 2; diff --git a/tests/baselines/reference/checkJsdocTypeTag6.errors.txt b/tests/baselines/reference/checkJsdocTypeTag6.errors.txt index bbc2e8cd6b1df..af065a8384517 100644 --- a/tests/baselines/reference/checkJsdocTypeTag6.errors.txt +++ b/tests/baselines/reference/checkJsdocTypeTag6.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/jsdoc/test.js(10,5): error TS8030: The type of a functio ==== tests/cases/conformance/jsdoc/test.js (3 errors) ==== /** @type {number} */ - ~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS8030: The type of a function declaration must match the function's signature. function f() { return 1 @@ -19,7 +19,7 @@ tests/cases/conformance/jsdoc/test.js(10,5): error TS8030: The type of a functio } /** @type {(a: number) => number} */ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8030: The type of a function declaration must match the function's signature. function add1(a, b) { return a + b; } diff --git a/tests/baselines/reference/enumTagCircularReference.errors.txt b/tests/baselines/reference/enumTagCircularReference.errors.txt index f42be3719f9af..891434394f377 100644 --- a/tests/baselines/reference/enumTagCircularReference.errors.txt +++ b/tests/baselines/reference/enumTagCircularReference.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/jsdoc/bug27142.js(1,5): error TS2456: Type alias 'E' cir ==== tests/cases/conformance/jsdoc/bug27142.js (1 errors) ==== /** @enum {E} */ - ~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2456: Type alias 'E' circularly references itself. const E = { x: 0 }; \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefs_importType_js.1.baseline.jsonc b/tests/baselines/reference/findAllRefs_importType_js.1.baseline.jsonc index fa8e4c790bf3b..ebef05bb5ce16 100644 --- a/tests/baselines/reference/findAllRefs_importType_js.1.baseline.jsonc +++ b/tests/baselines/reference/findAllRefs_importType_js.1.baseline.jsonc @@ -142,7 +142,7 @@ "fileName": "/b.js", "contextSpan": { "start": 4, - "length": 21 + "length": 22 }, "isWriteAccess": false, "isDefinition": false diff --git a/tests/baselines/reference/findAllRefs_importType_js.baseline.jsonc b/tests/baselines/reference/findAllRefs_importType_js.baseline.jsonc index f87ee79a297ce..0f7a7aefb2b52 100644 --- a/tests/baselines/reference/findAllRefs_importType_js.baseline.jsonc +++ b/tests/baselines/reference/findAllRefs_importType_js.baseline.jsonc @@ -44,7 +44,7 @@ "fileName": "/b.js", "contextSpan": { "start": 4, - "length": 21 + "length": 22 }, "isWriteAccess": false, "isDefinition": false @@ -57,7 +57,7 @@ "fileName": "/b.js", "contextSpan": { "start": 46, - "length": 23 + "length": 24 }, "isWriteAccess": false, "isDefinition": false diff --git a/tests/baselines/reference/jsDocTags.baseline b/tests/baselines/reference/jsDocTags.baseline index 88d265e260df1..f316a9c42459d 100644 --- a/tests/baselines/reference/jsDocTags.baseline +++ b/tests/baselines/reference/jsDocTags.baseline @@ -70,8 +70,7 @@ "tags": [ { "name": "myjsdoctag", - "text": "this is a comment", - "links": [] + "text": "this is a comment" } ] } @@ -117,8 +116,7 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2", - "links": [] + "text": "comment1 comment2" } ] } @@ -194,8 +192,7 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2", - "links": [] + "text": "comment1 comment2" } ] } @@ -348,8 +345,7 @@ "tags": [ { "name": "returns", - "text": "a value", - "links": [] + "text": "a value" } ] } @@ -442,13 +438,11 @@ "tags": [ { "name": "param", - "text": "foo A value.", - "links": [] + "text": "foo A value." }, { "name": "returns", - "text": "Another value", - "links": [] + "text": "Another value" }, { "name": "mytag" @@ -514,8 +508,7 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2", - "links": [] + "text": "comment1 comment2" } ] } @@ -578,13 +571,11 @@ "tags": [ { "name": "mytag1", - "text": "some comments\nsome more comments about mytag1", - "links": [] + "text": "some comments\nsome more comments about mytag1" }, { "name": "mytag2", - "text": "here all the comments are on a new line", - "links": [] + "text": "here all the comments are on a new line" }, { "name": "mytag3" diff --git a/tests/baselines/reference/jsdocImportTypeNodeNamespace.errors.txt b/tests/baselines/reference/jsdocImportTypeNodeNamespace.errors.txt index 40f0e3c974eab..571c3f52cbbcb 100644 --- a/tests/baselines/reference/jsdocImportTypeNodeNamespace.errors.txt +++ b/tests/baselines/reference/jsdocImportTypeNodeNamespace.errors.txt @@ -12,7 +12,7 @@ tests/cases/compiler/Main.js(2,14): error TS2352: Conversion of type 'string' to ==== tests/cases/compiler/Main.js (1 errors) ==== export default function () { return /** @type {import('./GeometryType.js').default} */ ('Point'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type 'string' to type 'typeof _default' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. } \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTypeTagCast.errors.txt b/tests/baselines/reference/jsdocTypeTagCast.errors.txt index c82eabc65cd63..fb4487c036906 100644 --- a/tests/baselines/reference/jsdocTypeTagCast.errors.txt +++ b/tests/baselines/reference/jsdocTypeTagCast.errors.txt @@ -26,7 +26,7 @@ tests/cases/conformance/jsdoc/b.js(67,8): error TS2454: Variable 'numOrStr' is u var W = /** @type {string} */(/** @type {*} */ (4)); var W = /** @type {string} */(4); // Error - ~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. /** @type {*} */ @@ -69,7 +69,7 @@ tests/cases/conformance/jsdoc/b.js(67,8): error TS2454: Variable 'numOrStr' is u someBase = /** @type {SomeBase} */(someDerived); someBase = /** @type {SomeBase} */(someBase); someBase = /** @type {SomeBase} */(someOther); // Error - ~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type 'SomeOther' to type 'SomeBase' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. !!! error TS2352: Property 'p' is missing in type 'SomeOther' but required in type 'SomeBase'. !!! related TS2728 tests/cases/conformance/jsdoc/b.js:17:9: 'p' is declared here. @@ -77,17 +77,17 @@ tests/cases/conformance/jsdoc/b.js(67,8): error TS2454: Variable 'numOrStr' is u someDerived = /** @type {SomeDerived} */(someDerived); someDerived = /** @type {SomeDerived} */(someBase); someDerived = /** @type {SomeDerived} */(someOther); // Error - ~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type 'SomeOther' to type 'SomeDerived' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. !!! error TS2352: Type 'SomeOther' is missing the following properties from type 'SomeDerived': x, p someOther = /** @type {SomeOther} */(someDerived); // Error - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type 'SomeDerived' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. !!! error TS2352: Property 'q' is missing in type 'SomeDerived' but required in type 'SomeOther'. !!! related TS2728 tests/cases/conformance/jsdoc/b.js:28:9: 'q' is declared here. someOther = /** @type {SomeOther} */(someBase); // Error - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type 'SomeBase' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. !!! error TS2352: Property 'q' is missing in type 'SomeBase' but required in type 'SomeOther'. !!! related TS2728 tests/cases/conformance/jsdoc/b.js:28:9: 'q' is declared here. diff --git a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline index ef4c9dae2f888..c9bb71314dee3 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline @@ -157,8 +157,7 @@ "tags": [ { "name": "return", - "text": "*crunch*", - "links": [] + "text": "*crunch*" } ] } diff --git a/tests/baselines/reference/quickInfoForJSDocCodefence.baseline b/tests/baselines/reference/quickInfoForJSDocCodefence.baseline index 05cb7ddd4aa34..a88755fefc947 100644 --- a/tests/baselines/reference/quickInfoForJSDocCodefence.baseline +++ b/tests/baselines/reference/quickInfoForJSDocCodefence.baseline @@ -49,8 +49,7 @@ "tags": [ { "name": "example", - "text": "```\n1 + 2\n```", - "links": [] + "text": "```\n1 + 2\n```" } ] } @@ -105,8 +104,7 @@ "tags": [ { "name": "example", - "text": "``\n1 + 2\n`", - "links": [] + "text": "``\n1 + 2\n`" } ] } diff --git a/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline b/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline index c0f9fff5abe8e..25b2f8fe9c0fa 100644 --- a/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline +++ b/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline @@ -49,8 +49,7 @@ "tags": [ { "name": "example", - "text": "if (true) {\n foo()\n}", - "links": [] + "text": "if (true) {\n foo()\n}" } ] } @@ -105,8 +104,7 @@ "tags": [ { "name": "example", - "text": "{\n foo()\n}", - "links": [] + "text": "{\n foo()\n}" } ] } @@ -161,8 +159,7 @@ "tags": [ { "name": "example", - "text": " x y\n 12345\n b", - "links": [] + "text": " x y\n 12345\n b" } ] } @@ -220,8 +217,7 @@ }, { "name": "example", - "text": " x y\n 12345\n b", - "links": [] + "text": " x y\n 12345\n b" } ] } @@ -279,8 +275,7 @@ }, { "name": "example", - "text": "x y\n12345\n b", - "links": [] + "text": "x y\n12345\n b" } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTags.baseline b/tests/baselines/reference/quickInfoJsDocTags.baseline index 73b345ce8f35c..5717757a38294 100644 --- a/tests/baselines/reference/quickInfoJsDocTags.baseline +++ b/tests/baselines/reference/quickInfoJsDocTags.baseline @@ -74,18 +74,15 @@ }, { "name": "augments", - "text": "C Augments it", - "links": [] + "text": "C Augments it" }, { "name": "template", - "text": "T A template", - "links": [] + "text": "T A template" }, { "name": "type", - "text": "{number | string} A type", - "links": [] + "text": "{number | string} A type" }, { "name": "typedef", @@ -93,23 +90,19 @@ }, { "name": "property", - "text": "{number} x The prop", - "links": [] + "text": "{number} x The prop" }, { "name": "param", - "text": "x The param", - "links": [] + "text": "x The param" }, { "name": "returns", - "text": "The result", - "links": [] + "text": "The result" }, { "name": "see", - "text": "x (the parameter)", - "links": [] + "text": "x (the parameter)" } ] } diff --git a/tests/baselines/reference/smartSelection_JSDocTags1.baseline b/tests/baselines/reference/smartSelection_JSDocTags1.baseline index 0e390bc2fef6e..26c5fb2e9b3bb 100644 --- a/tests/baselines/reference/smartSelection_JSDocTags1.baseline +++ b/tests/baselines/reference/smartSelection_JSDocTags1.baseline @@ -16,7 +16,8 @@ function foo() { return [] } Array<{ value: string }> - @returns {Array<{ value: string }>} + @returns {Array<{ value: string }>}↲ +• /** diff --git a/tests/baselines/reference/smartSelection_JSDocTags2.baseline b/tests/baselines/reference/smartSelection_JSDocTags2.baseline index 8177bd36144c2..e7c80be468838 100644 --- a/tests/baselines/reference/smartSelection_JSDocTags2.baseline +++ b/tests/baselines/reference/smartSelection_JSDocTags2.baseline @@ -7,7 +7,8 @@ const foo; string - @type {string} + @type {string}↲ +• /** diff --git a/tests/baselines/reference/smartSelection_JSDocTags9.baseline b/tests/baselines/reference/smartSelection_JSDocTags9.baseline index 0d4bdc8eced5c..9192ca8fdc22e 100644 --- a/tests/baselines/reference/smartSelection_JSDocTags9.baseline +++ b/tests/baselines/reference/smartSelection_JSDocTags9.baseline @@ -8,7 +8,7 @@ const Foo = { number - @enum {number} + @enum {number}• /** @enum {number} */ diff --git a/tests/baselines/reference/typeTagCircularReferenceOnConstructorFunction.errors.txt b/tests/baselines/reference/typeTagCircularReferenceOnConstructorFunction.errors.txt index d98cb9297dc37..2060aa77ea50d 100644 --- a/tests/baselines/reference/typeTagCircularReferenceOnConstructorFunction.errors.txt +++ b/tests/baselines/reference/typeTagCircularReferenceOnConstructorFunction.errors.txt @@ -5,8 +5,9 @@ tests/cases/conformance/jsdoc/bug27346.js(2,4): error TS8030: The type of a func /** * @type {MyClass} ~~~~~~~~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. */ + ~ +!!! error TS8030: The type of a function declaration must match the function's signature. function MyClass() { } MyClass.prototype = {}; \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameters_templateTag.errors.txt b/tests/baselines/reference/unusedTypeParameters_templateTag.errors.txt index 46f6b6b2fd35c..9f815287ff8d3 100644 --- a/tests/baselines/reference/unusedTypeParameters_templateTag.errors.txt +++ b/tests/baselines/reference/unusedTypeParameters_templateTag.errors.txt @@ -3,7 +3,7 @@ ==== /a.js (1 errors) ==== /** @template T */ - ~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS6133: 'T' is declared but its value is never read. function f() {} \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameters_templateTag2.errors.txt b/tests/baselines/reference/unusedTypeParameters_templateTag2.errors.txt index 9f9ef45f88d47..63378f0485ad3 100644 --- a/tests/baselines/reference/unusedTypeParameters_templateTag2.errors.txt +++ b/tests/baselines/reference/unusedTypeParameters_templateTag2.errors.txt @@ -9,8 +9,9 @@ * @template T * @template V ~~~~~~~~~~~ -!!! error TS6133: 'V' is declared but its value is never read. */ + ~ +!!! error TS6133: 'V' is declared but its value is never read. class C1 { constructor() { /** @type {T} */ @@ -21,8 +22,9 @@ /** * @template T,V ~~~~~~~~~~~~~ -!!! error TS6205: All type parameters are unused. */ + ~ +!!! error TS6205: All type parameters are unused. class C2 { constructor() { } } diff --git a/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_js.ts b/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_js.ts index 7920810cacf50..cd9a2138f727c 100644 --- a/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_js.ts +++ b/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_js.ts @@ -40,35 +40,29 @@ verify.codeFixAll({ fixId: "unusedIdentifier_delete", fixAllDescription: ts.Diagnostics.Delete_all_unused_declarations.message, newFileContent: -`/** Parameter doc comment */ +`/** */ function f() {} /** * Doc - * Comment - */ + * */ function g() {} /** * Doc - * Comment - * Comment - */ + * */ function h() {} /** * Doc - * Comment - */ + * */ function h2() {} -/** Comment @return {void} */ +/** @return {void} */ function i() {} /** Doc -comment -comment @param {number} x */ function j(x) { return x; }`, diff --git a/tests/cases/fourslash/codeFixUnusedIdentifier_delete_templateTag.ts b/tests/cases/fourslash/codeFixUnusedIdentifier_delete_templateTag.ts index 01ab6985d8374..5c0dae5b521dd 100644 --- a/tests/cases/fourslash/codeFixUnusedIdentifier_delete_templateTag.ts +++ b/tests/cases/fourslash/codeFixUnusedIdentifier_delete_templateTag.ts @@ -55,7 +55,6 @@ verify.codeFix({ description: "Remove template tag", newFileContent: `/** - * Comment - */ + * */ function both() {}`, }); diff --git a/tests/cases/fourslash/commentsClassMembers.ts b/tests/cases/fourslash/commentsClassMembers.ts index e2054401bfa3f..c7bfbd6c51133 100644 --- a/tests/cases/fourslash/commentsClassMembers.ts +++ b/tests/cases/fourslash/commentsClassMembers.ts @@ -222,7 +222,7 @@ verify.completions( name: "a", text: "(property) cWithConstructorProperty.a: number", documentation: "more info about a\nthis is first parameter a", - tags: [{ links:[], name: "param", text: "a this is first parameter a" }], + tags: [{ links: undefined, name: "param", text: "a this is first parameter a" }], }, }, { @@ -231,7 +231,7 @@ verify.completions( name: "a", text: "(parameter) a: number", documentation: "more info about a\nthis is first parameter a", - tags: [{ links:[], name: "param", text: "a this is first parameter a" }], + tags: [{ links: undefined, name: "param", text: "a this is first parameter a" }], }, isNewIdentifierLocation: true, }, diff --git a/tests/cases/fourslash/commentsCommentParsing.ts b/tests/cases/fourslash/commentsCommentParsing.ts index 6d842f4413a0e..884fc8e9e15c3 100644 --- a/tests/cases/fourslash/commentsCommentParsing.ts +++ b/tests/cases/fourslash/commentsCommentParsing.ts @@ -251,8 +251,8 @@ verify.completions({ text: "function sum(a: number, b: number): number", documentation: "Adds two integers and returns the result", tags: [ - { name: "param", text: "a first number", links: [] }, - { name: "param", text: "b second number", links: [] }, + { name: "param", text: "a first number", links: undefined }, + { name: "param", text: "b second number", links: undefined }, ], }, }); @@ -283,8 +283,8 @@ verify.quickInfoAt("17aq", "(parameter) b: number", "second number"); verify.completions({ marker: "18", includes: [ - { name: "a", text: "(parameter) a: number", documentation: "first number", tags: [{ name: "param", text: "a first number", links: [] }] }, - { name: "b", text: "(parameter) b: number", documentation: "second number", tags: [{ name: "param", text: "b second number", links: [] }] }, + { name: "a", text: "(parameter) a: number", documentation: "first number", tags: [{ name: "param", text: "a first number", links: undefined }] }, + { name: "b", text: "(parameter) b: number", documentation: "second number", tags: [{ name: "param", text: "b second number", links: undefined }] }, ], }); @@ -327,7 +327,7 @@ verify.completions({ name: "opt", text: "(parameter) opt: any", documentation: "optional parameter", - tags: [{ name: "param", text: "opt optional parameter", links: [] }], + tags: [{ name: "param", text: "opt optional parameter", links: undefined }], }, ] }); @@ -358,12 +358,12 @@ verify.completions({ documentation: "This is multiplication function", tags: [ { name: "param", text: "", links: undefined }, - { name: "param", text: "a first number", links: [] }, + { name: "param", text: "a first number", links: undefined }, { name: "param", text: "b", links: undefined }, { name: "param", text: "c", links: undefined }, { name: "param", text: "d", links: undefined }, { name: "anotherTag", text: undefined, links: undefined }, - { name: "param", text: "e LastParam", links: [] }, + { name: "param", text: "e LastParam", links: undefined }, { name: "anotherTag", text: undefined, links: undefined }, ], }, @@ -371,7 +371,7 @@ verify.completions({ name: "f1", text: "function f1(a: number): any (+1 overload)", documentation: "fn f1 with number", - tags: [{ name: "param", text: "b about b", links: [] }], + tags: [{ name: "param", text: "b about b", links: undefined }], }, ], }); @@ -471,14 +471,14 @@ verify.completions({ name: "a", text: "(parameter) a: number", documentation: "this is inline comment for a\nit is first parameter", - tags: [{ name: "param", text: "a it is first parameter", links: [] }], + tags: [{ name: "param", text: "a it is first parameter", links: undefined }], }, { name: "b", text: "(parameter) b: number", documentation: "this is inline comment for b" }, { name: "c", text: "(parameter) c: number", documentation: "it is third parameter", - tags: [{ name: "param", text: "c it is third parameter", links: [] }], + tags: [{ name: "param", text: "c it is third parameter", links: undefined }], }, { name: "d", text: "(parameter) d: number" }, ], @@ -518,8 +518,8 @@ verify.completions({ text: "function jsDocParamTest(a: number, b: number, c: number, d: number): number", documentation: jsdocTestDocComment, tags: [ - { name: "param", text: "a it is first parameter", links: [] }, - { name: "param", text: "c it is third parameter", links: [] }, + { name: "param", text: "a it is first parameter", links: undefined }, + { name: "param", text: "c it is third parameter", links: undefined }, ], }, { name: "x", text: "var x: any", documentation: "This is a comment" }, diff --git a/tests/cases/fourslash/commentsFunctionExpression.ts b/tests/cases/fourslash/commentsFunctionExpression.ts index e8ce9d1faad38..1fdb00b2ec539 100644 --- a/tests/cases/fourslash/commentsFunctionExpression.ts +++ b/tests/cases/fourslash/commentsFunctionExpression.ts @@ -88,8 +88,8 @@ verify.completions({ text: "(parameter) s: string", documentation: "On parameter\nparam on expression\nthe first parameter!", tags: [ - { name: "param", text: "s param on expression", links: [] }, - { name: "param", text: "s the first parameter!", links: [] }, + { name: "param", text: "s param on expression", links: undefined }, + { name: "param", text: "s the first parameter!", links: undefined }, ], }, }); @@ -101,10 +101,10 @@ verify.completions({ text: "var assigned: (s: string) => number", documentation: "Summary on expression\nOn variable", tags: [ - { name: "param", text: "s param on expression", links: [] }, - { name: "returns", text: "return on expression", links: [] }, - { name: "param", text: "s the first parameter!", links: [] }, - { name: "returns", text: "the parameter's length", links: [] }, + { name: "param", text: "s param on expression", links: undefined }, + { name: "returns", text: "return on expression", links: undefined }, + { name: "param", text: "s the first parameter!", links: undefined }, + { name: "returns", text: "the parameter's length", links: undefined }, ], }, ]}); @@ -113,9 +113,9 @@ verify.signatureHelp({ docComment: "Summary on expression\nOn variable", parameterDocComment: "On parameter\nparam on expression\nthe first parameter!", tags: [ - { name: "param", text: "s param on expression", links: [] }, - { name: "returns", text: "return on expression", links: [] }, - { name: "param", text: "s the first parameter!", links: [] }, - { name: "returns", text: "the parameter's length", links: [] }, + { name: "param", text: "s param on expression", links: undefined }, + { name: "returns", text: "return on expression", links: undefined }, + { name: "param", text: "s the first parameter!", links: undefined }, + { name: "returns", text: "the parameter's length", links: undefined }, ], }); diff --git a/tests/cases/fourslash/completionEntryForUnionMethod.ts b/tests/cases/fourslash/completionEntryForUnionMethod.ts index 73069969dfacb..2190f2ec69a4e 100644 --- a/tests/cases/fourslash/completionEntryForUnionMethod.ts +++ b/tests/cases/fourslash/completionEntryForUnionMethod.ts @@ -14,8 +14,8 @@ verify.completions({ text, documentation, tags: [ - { name: "param", text: "callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.", links: [] }, - { name: "param", text: "thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.", links: [] } + { name: "param", text: "callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.", links: undefined }, + { name: "param", text: "thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.", links: undefined } ], }, }); diff --git a/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts b/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts index fb3cdf5bc33a3..844c2532775c6 100644 --- a/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts +++ b/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts @@ -5,7 +5,7 @@ // @allowJs: true // @Filename: /a.js -/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|]|] */ +/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|] |]*/ //// /////** //// * @return {[|T|]} diff --git a/tests/cases/fourslash/findAllRefsTypedef_importType.ts b/tests/cases/fourslash/findAllRefsTypedef_importType.ts index 4816406d518f3..f84632d729d74 100644 --- a/tests/cases/fourslash/findAllRefsTypedef_importType.ts +++ b/tests/cases/fourslash/findAllRefsTypedef_importType.ts @@ -4,7 +4,7 @@ // @Filename: /a.js ////module.exports = 0; -/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Foo|]|] */ +/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Foo|] |]*/ ////const dummy = 0; // @Filename: /b.js diff --git a/tests/cases/fourslash/jsDocTags.ts b/tests/cases/fourslash/jsDocTags.ts index 13e6bd8b74e29..a358b2f86ae41 100644 --- a/tests/cases/fourslash/jsDocTags.ts +++ b/tests/cases/fourslash/jsDocTags.ts @@ -83,6 +83,6 @@ verify.completions({ text: "(method) Foo.newMethod(): void", documentation: "method documentation", kind: "method", - tags: [{ name: "mytag", text: "a JSDoc tag", links: [] }], + tags: [{ name: "mytag", text: "a JSDoc tag", links: undefined }], }, }); diff --git a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts index 44156116d2f83..4d4bb63058f5c 100644 --- a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts +++ b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts @@ -3,7 +3,7 @@ // @allowJs: true // @Filename: a.js -/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|]|] */ +/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|] |]*/ ////[|const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}T|] = 1;|] diff --git a/tests/cases/fourslash/salsaMethodsOnAssignedFunctionExpressions.ts b/tests/cases/fourslash/salsaMethodsOnAssignedFunctionExpressions.ts index cbaa5ddecd0fd..b4ea55aed5f8a 100644 --- a/tests/cases/fourslash/salsaMethodsOnAssignedFunctionExpressions.ts +++ b/tests/cases/fourslash/salsaMethodsOnAssignedFunctionExpressions.ts @@ -19,6 +19,6 @@ verify.completions({ name: "m", text: "(property) C.m: (a: string) => void", documentation: "The prototype method.", - tags: [{ name: "param", text: "a Parameter definition.", links: [] }], + tags: [{ name: "param", text: "a Parameter definition.", links: undefined }], }, }); diff --git a/tests/cases/fourslash/server/jsdocTypedefTagRename02.ts b/tests/cases/fourslash/server/jsdocTypedefTagRename02.ts index 30c99deb0a86c..45bfd871aea5c 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTagRename02.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTagRename02.ts @@ -3,7 +3,7 @@ // @allowNonTsExtensions: true // @Filename: jsDocTypedef_form2.js //// -//// /** [|@typedef {(string | number)} [|{| "contextRangeIndex": 0 |}NumberLike|]|] */ +//// /** [|@typedef {(string | number)} [|{| "contextRangeIndex": 0 |}NumberLike|] |]*/ //// //// /** @type {[|NumberLike|]} */ //// var numberLike; diff --git a/tests/cases/fourslash/syntacticClassificationForJSDocTemplateTag.ts b/tests/cases/fourslash/syntacticClassificationForJSDocTemplateTag.ts index 0f8169828b30d..4ee90fd376068 100644 --- a/tests/cases/fourslash/syntacticClassificationForJSDocTemplateTag.ts +++ b/tests/cases/fourslash/syntacticClassificationForJSDocTemplateTag.ts @@ -1,6 +1,6 @@ /// -/////** @template T */ +/////** @template T baring strait */ ////function ident: T { ////} @@ -10,7 +10,8 @@ verify.syntacticClassificationsAre( c.punctuation("@"), c.docCommentTagName("template"), c.typeParameterName("T"), - c.comment(" */"), + c.comment("baring strait "), + c.comment("*/"), c.keyword("function"), c.identifier("ident"), c.punctuation("<"), diff --git a/tests/cases/fourslash/syntacticClassificationsDocComment1.ts b/tests/cases/fourslash/syntacticClassificationsDocComment1.ts index 5a0194e8c5ad2..88f75610a1b65 100644 --- a/tests/cases/fourslash/syntacticClassificationsDocComment1.ts +++ b/tests/cases/fourslash/syntacticClassificationsDocComment1.ts @@ -11,7 +11,7 @@ verify.syntacticClassificationsAre( c.punctuation("{"), c.keyword("number"), c.punctuation("}"), - c.comment(" */"), + c.comment("*/"), c.keyword("var"), c.identifier("v"), c.punctuation(";")); From 1a3e95b52c4c4bddcc05f9cba58067a06102d664 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 10 Dec 2020 17:11:14 -0800 Subject: [PATCH 21/44] Add span for link.name in language service/protocol --- src/harness/client.ts | 1 + src/server/protocol.ts | 1 + src/server/session.ts | 4 +++- src/services/jsDoc.ts | 1 + src/services/types.ts | 1 + src/testRunner/unittests/tsserver/jsdocTag.ts | 4 ++++ .../baselines/reference/api/tsserverlibrary.d.ts | 2 ++ tests/baselines/reference/api/typescript.d.ts | 1 + tests/baselines/reference/jsdocLink1.baseline | 16 ++++++++++++++++ tests/baselines/reference/jsdocLink2.baseline | 16 ++++++++++++++++ tests/baselines/reference/jsdocLink3.baseline | 16 ++++++++++++++++ 11 files changed, 62 insertions(+), 1 deletion(-) diff --git a/src/harness/client.ts b/src/harness/client.ts index edda0fb523f64..1b78d55cce374 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -526,6 +526,7 @@ namespace ts.server { ...tag, links: tag.links?.map(link => ({ ...link, + name: link.name as unknown as TextSpan, target: { // TODO: The JSDocLinkInfo tag data mismatches the type!! (probably wasn't correctly encoded in the first place?) textSpan: link.target as unknown as TextSpan, diff --git a/src/server/protocol.ts b/src/server/protocol.ts index c89b7d6673b07..c0d7d97461847 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -962,6 +962,7 @@ namespace ts.server.protocol { } export interface JSDocLinkInfo extends DocumentSpan { + name: FileSpan; target: FileSpan; } diff --git a/src/server/session.ts b/src/server/session.ts index cce3d31a0dc3d..ac8b94cf9c314 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1259,8 +1259,10 @@ namespace ts.server { text, links: links?.map(link => ({ ...link, + name: this.toFileSpan(link.fileName, link.name, project), target: this.toFileSpan(link.target.fileName, link.target.textSpan, project), - }))})); + })) + })); } private mapDefinitionInfo(definitions: readonly DefinitionInfo[], project: Project): readonly protocol.FileSpanWithContext[] { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 129d6341a6938..75bbfd1750222 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -133,6 +133,7 @@ namespace ts.JsDoc { return { fileName: getSourceFileOfNode(link).fileName, textSpan: createTextSpanFromNode(link), + name: createTextSpanFromNode(link.name), target: { fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, textSpan: createTextSpanFromNode(symbol.valueDeclaration) diff --git a/src/services/types.ts b/src/services/types.ts index a7a2b05440c3e..ec5d36e3985f8 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1037,6 +1037,7 @@ namespace ts { } export interface JSDocLinkInfo extends DocumentSpan { + name: TextSpan; target: DocumentSpan; } diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index d496722db2be1..e0e5ccbb50fba 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -39,6 +39,10 @@ var x = 1`); tags: [{ links: [{ fileName: "someFile1.js", + name: { + length: 1, + start: 28, + }, target: { fileName: "someFile1.js", textSpan: { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 7112242c879ac..496bfac9b6f64 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -5999,6 +5999,7 @@ declare namespace ts { links?: readonly JSDocLinkInfo[]; } interface JSDocLinkInfo extends DocumentSpan { + name: TextSpan; target: DocumentSpan; } interface QuickInfo { @@ -7211,6 +7212,7 @@ declare namespace ts.server.protocol { links?: JSDocLinkInfo[]; } interface JSDocLinkInfo extends DocumentSpan { + name: FileSpan; target: FileSpan; } interface TextSpanWithContext extends TextSpan { diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 86787059f6304..7627716d1ec99 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -5999,6 +5999,7 @@ declare namespace ts { links?: readonly JSDocLinkInfo[]; } interface JSDocLinkInfo extends DocumentSpan { + name: TextSpan; target: DocumentSpan; } interface QuickInfo { diff --git a/tests/baselines/reference/jsdocLink1.baseline b/tests/baselines/reference/jsdocLink1.baseline index 5d77f2930802e..597c1ce90e538 100644 --- a/tests/baselines/reference/jsdocLink1.baseline +++ b/tests/baselines/reference/jsdocLink1.baseline @@ -62,6 +62,10 @@ "start": 45, "length": 9 }, + "name": { + "start": 52, + "length": 1 + }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", "textSpan": { @@ -76,6 +80,10 @@ "start": 74, "length": 11 }, + "name": { + "start": 81, + "length": 1 + }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", "textSpan": { @@ -90,6 +98,10 @@ "start": 89, "length": 22 }, + "name": { + "start": 96, + "length": 1 + }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", "textSpan": { @@ -110,6 +122,10 @@ "start": 156, "length": 9 }, + "name": { + "start": 163, + "length": 1 + }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", "textSpan": { diff --git a/tests/baselines/reference/jsdocLink2.baseline b/tests/baselines/reference/jsdocLink2.baseline index b124d5b400caf..f3bdf1e0d0681 100644 --- a/tests/baselines/reference/jsdocLink2.baseline +++ b/tests/baselines/reference/jsdocLink2.baseline @@ -62,6 +62,10 @@ "start": 33, "length": 9 }, + "name": { + "start": 40, + "length": 1 + }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", "textSpan": { @@ -76,6 +80,10 @@ "start": 62, "length": 11 }, + "name": { + "start": 69, + "length": 1 + }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", "textSpan": { @@ -90,6 +98,10 @@ "start": 77, "length": 22 }, + "name": { + "start": 84, + "length": 1 + }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", "textSpan": { @@ -110,6 +122,10 @@ "start": 144, "length": 9 }, + "name": { + "start": 151, + "length": 1 + }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", "textSpan": { diff --git a/tests/baselines/reference/jsdocLink3.baseline b/tests/baselines/reference/jsdocLink3.baseline index daf05926e4368..4614f9e4d57b5 100644 --- a/tests/baselines/reference/jsdocLink3.baseline +++ b/tests/baselines/reference/jsdocLink3.baseline @@ -62,6 +62,10 @@ "start": 66, "length": 9 }, + "name": { + "start": 73, + "length": 1 + }, "target": { "fileName": "/jsdocLink3.ts", "textSpan": { @@ -76,6 +80,10 @@ "start": 95, "length": 11 }, + "name": { + "start": 102, + "length": 1 + }, "target": { "fileName": "/jsdocLink3.ts", "textSpan": { @@ -90,6 +98,10 @@ "start": 110, "length": 22 }, + "name": { + "start": 117, + "length": 1 + }, "target": { "fileName": "/jsdocLink3.ts", "textSpan": { @@ -110,6 +122,10 @@ "start": 177, "length": 9 }, + "name": { + "start": 184, + "length": 1 + }, "target": { "fileName": "/jsdocLink3.ts", "textSpan": { From ce966fc23ec5fbc0497ebc807f90af2f991d52a6 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 14 Dec 2020 08:30:42 -0800 Subject: [PATCH 22/44] Make checker optional in getJSDocTags Also change to JSDocCommentText from JSDocCommentComment --- src/compiler/emitter.ts | 4 +- src/compiler/factory/nodeFactory.ts | 70 ++++----- src/compiler/parser.ts | 14 +- src/compiler/types.ts | 97 +++++++------ src/compiler/utilitiesPublic.ts | 2 +- src/deprecatedCompat/deprecations.ts | 2 +- src/services/codefixes/inferFromUsage.ts | 4 +- src/services/jsDoc.ts | 4 +- src/services/services.ts | 6 +- src/services/types.ts | 2 +- ...ocComments.parsesCorrectly.@link tags.json | 8 +- ...ts.parsesCorrectly.Nested @param tags.json | 4 +- ...parsesCorrectly.argSynonymForParamTag.json | 2 +- ...sCorrectly.argumentSynonymForParamTag.json | 2 +- ...parsesCorrectly.asteriskAfterPreamble.json | 2 +- ...DocComments.parsesCorrectly.authorTag.json | 32 ++-- ...sCorrectly.consecutive newline tokens.json | 2 +- ...less-than and greater-than characters.json | 2 +- ...DocComments.parsesCorrectly.paramTag1.json | 2 +- ...arsesCorrectly.paramTagBracketedName1.json | 2 +- ...arsesCorrectly.paramTagBracketedName2.json | 2 +- ...parsesCorrectly.paramTagNameThenType2.json | 2 +- ...ocComments.parsesCorrectly.returnTag2.json | 2 +- ...Comments.parsesCorrectly.templateTag6.json | 2 +- ...mments.parsesCorrectly.threeAsterisks.json | 2 +- .../reference/api/tsserverlibrary.d.ts | 137 +++++++++--------- tests/baselines/reference/api/typescript.d.ts | 137 +++++++++--------- 27 files changed, 275 insertions(+), 272 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 355c9cc7cacd2..d5ab6d5af95d8 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3653,7 +3653,7 @@ namespace ts { emitJSDocComment(tag.comment); } - function emitJSDocTypeLiteral(lit: JSDocTypeLiteral) { + function emitJSDocTypeLiteral(lit:JSDocTypeLiteral) { emitList(lit, factory.createNodeArray(lit.jsDocPropertyTags), ListFormat.JSDocComment); } @@ -3692,7 +3692,7 @@ namespace ts { emit(tagName); } - function emitJSDocComment(comment: JSDocComment | undefined) { + function emitJSDocComment(comment: JSDocCommentText | undefined) { if (comment?.text) { writeSpace(); write(comment.text); diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 0cd68c689218f..2875d68e77ed3 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -34,10 +34,10 @@ namespace ts { const getJSDocPrimaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => () => createJSDocPrimaryTypeWorker(kind)); const getJSDocUnaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => (type: T["type"]) => createJSDocUnaryTypeWorker(kind, type)); const getJSDocUnaryTypeUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, type: T["type"]) => updateJSDocUnaryTypeWorker(kind, node, type)); - const getJSDocSimpleTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, comment?: JSDocComment) => createJSDocSimpleTagWorker(kind, tagName, comment)); - const getJSDocSimpleTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, comment?: JSDocComment) => updateJSDocSimpleTagWorker(kind, node, tagName, comment)); - const getJSDocTypeLikeTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment) => createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment)); - const getJSDocTypeLikeTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment) => updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment)); + const getJSDocSimpleTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, comment?: JSDocCommentText) => createJSDocSimpleTagWorker(kind, tagName, comment)); + const getJSDocSimpleTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, comment?: JSDocCommentText) => updateJSDocSimpleTagWorker(kind, node, tagName, comment)); + const getJSDocTypeLikeTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText) => createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment)); + const getJSDocTypeLikeTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText) => updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment)); const factory: NodeFactory = { get parenthesizer() { return parenthesizerRules(); }, @@ -372,8 +372,8 @@ namespace ts { get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocDeprecatedTag); }, createJSDocUnknownTag, updateJSDocUnknownTag, - createJSDocCommentComment, - updateJSDocCommentComment, + createJSDocCommentText, + updateJSDocCommentText, createJSDocComment, updateJSDocComment, createJsxElement, @@ -4204,7 +4204,7 @@ namespace ts { } // @api - function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: JSDocComment | undefined) { + function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: JSDocCommentText | undefined) { const node = createBaseNode(kind); node.tagName = tagName; node.comment = comment; @@ -4212,7 +4212,7 @@ namespace ts { } // @api - function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment): JSDocTemplateTag { + function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText): JSDocTemplateTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTemplateTag, tagName ?? createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); @@ -4220,7 +4220,7 @@ namespace ts { } // @api - function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocComment | undefined): JSDocTemplateTag { + function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocCommentText | undefined): JSDocTemplateTag { return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters @@ -4230,7 +4230,7 @@ namespace ts { } // @api - function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocTypedefTag { + function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocTypedefTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTypedefTag, tagName ?? createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4239,7 +4239,7 @@ namespace ts { } // @api - function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocTypedefTag { + function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocTypedefTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4249,7 +4249,7 @@ namespace ts { } // @api - function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocParameterTag { + function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocParameterTag { const node = createBaseJSDocTag(SyntaxKind.JSDocParameterTag, tagName ?? createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4259,7 +4259,7 @@ namespace ts { } // @api - function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocParameterTag { + function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocParameterTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4271,7 +4271,7 @@ namespace ts { } // @api - function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocPropertyTag { + function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocPropertyTag { const node = createBaseJSDocTag(SyntaxKind.JSDocPropertyTag, tagName ?? createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4281,7 +4281,7 @@ namespace ts { } // @api - function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocPropertyTag { + function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocPropertyTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4293,7 +4293,7 @@ namespace ts { } // @api - function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocCallbackTag { + function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocCallbackTag { const node = createBaseJSDocTag(SyntaxKind.JSDocCallbackTag, tagName ?? createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4302,7 +4302,7 @@ namespace ts { } // @api - function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocCallbackTag { + function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocCallbackTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4312,14 +4312,14 @@ namespace ts { } // @api - function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocComment): JSDocAugmentsTag { + function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocCommentText): JSDocAugmentsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocAugmentsTag, tagName ?? createIdentifier("augments"), comment); node.class = className; return node; } // @api - function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: JSDocComment | undefined): JSDocAugmentsTag { + function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: JSDocCommentText | undefined): JSDocAugmentsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4328,21 +4328,21 @@ namespace ts { } // @api - function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocComment): JSDocImplementsTag { + function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocCommentText): JSDocImplementsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocImplementsTag, tagName ?? createIdentifier("implements"), comment); node.class = className; return node; } // @api - function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag { + function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag { const node = createBaseJSDocTag(SyntaxKind.JSDocSeeTag, tagName ?? createIdentifier("see"), comment); node.name = name; return node; } // @api - function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag { + function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag { return node.tagName !== tagName || node.name !== name || node.comment !== comment @@ -4379,7 +4379,7 @@ namespace ts { } // @api - function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: JSDocComment | undefined): JSDocImplementsTag { + function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: JSDocCommentText | undefined): JSDocImplementsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4395,7 +4395,7 @@ namespace ts { // createJSDocProtectedTag // createJSDocReadonlyTag // createJSDocDeprecatedTag - function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: JSDocComment) { + function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: JSDocCommentText) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); return node; } @@ -4408,7 +4408,7 @@ namespace ts { // updateJSDocProtectedTag // updateJSDocReadonlyTag // updateJSDocDeprecatedTag - function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: JSDocComment | undefined) { + function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: JSDocCommentText | undefined) { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) : @@ -4420,7 +4420,7 @@ namespace ts { // createJSDocReturnTag // createJSDocThisTag // createJSDocEnumTag - function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment) { + function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); node.typeExpression = typeExpression; return node; @@ -4431,7 +4431,7 @@ namespace ts { // updateJSDocReturnTag // updateJSDocThisTag // updateJSDocEnumTag - function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined) { + function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined) { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment @@ -4440,13 +4440,13 @@ namespace ts { } // @api - function createJSDocUnknownTag(tagName: Identifier, comment?: JSDocComment): JSDocUnknownTag { + function createJSDocUnknownTag(tagName: Identifier, comment?: JSDocCommentText): JSDocUnknownTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTag, tagName, comment); return node; } // @api - function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag { + function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocCommentText | undefined): JSDocUnknownTag { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocUnknownTag(tagName, comment), node) @@ -4454,23 +4454,23 @@ namespace ts { } // @api - function createJSDocCommentComment(text: string, links?: readonly JSDocLink[]): JSDocComment { - const node = createBaseNode(SyntaxKind.JSDocCommentComment); + function createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText { + const node = createBaseNode(SyntaxKind.JSDocCommentText); node.text = text; node.links = asNodeArray(links); return node; } // @api - function updateJSDocCommentComment(node: JSDocComment, text: string, links?: readonly JSDocLink[]): JSDocComment { + function updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText { return node.text !== text || node.links !== links - ? update(createJSDocCommentComment(text, links), node) + ? update(createJSDocCommentText(text, links), node) : node; } // @api - function createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined) { + function createJSDocComment(comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) { const node = createBaseNode(SyntaxKind.JSDocComment); node.comment = comment; node.tags = asNodeArray(tags); @@ -4478,7 +4478,7 @@ namespace ts { } // @api - function updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined) { + function updateJSDocComment(node: JSDoc, comment: JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined) { return node.comment !== comment || node.tags !== tags ? update(createJSDocComment(comment, tags), node) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 284daba6c0d75..a42ecfbf6f67e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -483,8 +483,8 @@ namespace ts { case SyntaxKind.JSDocComment: return visitNode(cbNode, (node as JSDoc).comment) || visitNodes(cbNode, cbNodes, (node).tags); - case SyntaxKind.JSDocCommentComment: - return visitNodes(cbNode, cbNodes, (node as JSDocComment).links); + case SyntaxKind.JSDocCommentText: + return visitNodes(cbNode, cbNodes, (node as JSDocCommentText).links); case SyntaxKind.JSDocSeeTag: return visitNode(cbNode, (node as JSDocSeeTag).tagName) || visitNode(cbNode, (node as JSDocSeeTag).name) || @@ -7415,7 +7415,7 @@ namespace ts { const linksArray = links.length ? createNodeArray(links, linksPos, linksEnd) : undefined; if (comments.length && tags) Debug.assertIsDefined(commentsPos); const comment = comments.length - ? finishNode(factory.createJSDocCommentComment(comments.join(""), linksArray), start, commentsPos) + ? finishNode(factory.createJSDocCommentText(comments.join(""), linksArray), start, commentsPos) : undefined; const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); return finishNode(factory.createJSDocComment(comment, tagsArray), start, end); @@ -7554,7 +7554,7 @@ namespace ts { return parseTagComments(margin, indentText.slice(margin)); } - function parseTagComments(indent: number, initialMargin?: string): JSDocComment | undefined { + function parseTagComments(indent: number, initialMargin?: string): JSDocCommentText | undefined { const commentsPos = getNodePos(); const comments: string[] = []; let linksPos; @@ -7653,7 +7653,7 @@ namespace ts { removeLeadingNewlines(comments); removeTrailingWhitespace(comments); if (comments.length) { - const comment = factory.createJSDocCommentComment(comments.join(""), links.length ? createNodeArray(links, linksPos ?? indent, linksEnd) : undefined); + const comment = factory.createJSDocCommentText(comments.join(""), links.length ? createNodeArray(links, linksPos ?? indent, linksEnd) : undefined); return finishNode(comment, commentsPos, scanner.getTextPos()); } } @@ -7809,7 +7809,7 @@ namespace ts { text += tagComments.text; links = tagComments.links; } - const comment = text || links ? finishNode(factory.createJSDocCommentComment(text, links), commentStart) : undefined; + const comment = text || links ? finishNode(factory.createJSDocCommentText(text, links), commentStart) : undefined; return finishNode(factory.createJSDocAuthorTag(tagName, comment), start); } @@ -7869,7 +7869,7 @@ namespace ts { return node; } - function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: JSDocComment) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { + function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: JSDocCommentText) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { return finishNode(createTag(tagName, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b6b07d0179064..3e6b02d6d845d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -373,7 +373,7 @@ namespace ts { // https://jsdoc.app/about-namepaths.html JSDocNamepathType, JSDocComment, - JSDocCommentComment, + JSDocCommentText, JSDocTypeLiteral, JSDocSignature, JSDocLink, @@ -3141,13 +3141,13 @@ namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: JSDocComment; + readonly comment?: JSDocCommentText; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: JSDocComment; + readonly comment?: JSDocCommentText; } export interface JSDocLink extends Node { @@ -3155,7 +3155,8 @@ namespace ts { readonly name?: EntityName; } - export interface JSDocComment extends Node { + export interface JSDocCommentText extends Node { + readonly kind: SyntaxKind.JSDocCommentText; text: string; links?: NodeArray; } @@ -7150,50 +7151,50 @@ namespace ts { updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocComment | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocComment): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocComment | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocComment): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocComment | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: JSDocComment): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; - createJSDocCommentComment(text: string, links?: readonly JSDocLink[]): JSDocComment; - updateJSDocCommentComment(node: JSDocComment, text: string, links?: readonly JSDocLink[]): JSDocComment; - createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocCommentText | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocCommentText): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocCommentText | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocCommentText): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocCommentText | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: JSDocCommentText): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocCommentText | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; + createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText; + updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText; + createJSDocComment(comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; // // JSX diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 3e3aeb3b9e86b..dac3f66b8d1ce 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1846,7 +1846,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 - || node.kind === SyntaxKind.JSDocCommentComment + || node.kind === SyntaxKind.JSDocCommentText || node.kind === SyntaxKind.JSDocNamepathType || node.kind === SyntaxKind.JSDocLink || isJSDocTag(node) diff --git a/src/deprecatedCompat/deprecations.ts b/src/deprecatedCompat/deprecations.ts index 2549b9610ea1a..1ed9ad7d9cef6 100644 --- a/src/deprecatedCompat/deprecations.ts +++ b/src/deprecatedCompat/deprecations.ts @@ -1216,7 +1216,7 @@ namespace ts { /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ export const createJSDocParamTag = Debug.deprecate(function createJSDocParamTag(name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, comment?: string): JSDocParameterTag { - return factory.createJSDocParameterTag(/*tagName*/ undefined, name, isBracketed, typeExpression, /*isNameFirst*/ false, comment ? factory.createJSDocCommentComment(comment) : undefined); + return factory.createJSDocParameterTag(/*tagName*/ undefined, name, isBracketed, typeExpression, /*isNameFirst*/ false, comment ? factory.createJSDocCommentText(comment) : undefined); }, factoryDeprecation); /** @deprecated Use `factory.createComma` or the factory supplied by your transformation context instead. */ diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index d50c3a59f97bf..dd4763eba74e1 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -281,7 +281,7 @@ namespace ts.codefix { setAccessorDeclaration: SetAccessorDeclaration, program: Program, host: LanguageServiceHost, - cancellationToken: CancellationToken, + cancellationToken: CancellationToken, ): void { const param = firstOrUndefined(setAccessorDeclaration.parameters); @@ -388,7 +388,7 @@ namespace ts.codefix { if (merged) oldTags[i] = merged; return !!merged; })); - const tag = factory.createJSDocComment(factory.createJSDocCommentComment(comments.join("\n")), factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); + const tag = factory.createJSDocComment(factory.createJSDocCommentText(comments.join("\n")), factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); const jsDocNode = parent.kind === SyntaxKind.ArrowFunction ? getJsDocNodeForArrowFunction(parent) : parent; jsDocNode.jsDoc = parent.jsDoc; jsDocNode.jsDocCache = parent.jsDocCache; diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 75bbfd1750222..da5ed609c1af2 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -112,12 +112,12 @@ namespace ts.JsDoc { } } - export function getJsDocTagsFromDeclarations(checker: TypeChecker, declarations?: Declaration[]): JSDocTagInfo[] { + export function getJsDocTagsFromDeclarations(declarations?: Declaration[], checker?: TypeChecker): JSDocTagInfo[] { // Only collect doc comments from duplicate declarations once. const tags: JSDocTagInfo[] = []; forEachUnique(declarations, declaration => { for (const tag of getJSDocTags(declaration)) { - tags.push({ name: tag.tagName.text, text: getCommentText(tag), links: getLinks(tag, checker) }); + tags.push({ name: tag.tagName.text, text: getCommentText(tag), links: checker ? getLinks(tag, checker) : undefined }); } }); return tags; diff --git a/src/services/services.ts b/src/services/services.ts index 669ef9504f6df..182a8587e268e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -359,9 +359,9 @@ namespace ts { } } - getJsDocTags(checker: TypeChecker): JSDocTagInfo[] { + getJsDocTags(checker?: TypeChecker): JSDocTagInfo[] { if (this.tags === undefined) { - this.tags = JsDoc.getJsDocTagsFromDeclarations(checker, this.declarations); + this.tags = JsDoc.getJsDocTagsFromDeclarations(this.declarations, checker); } return this.tags; @@ -550,7 +550,7 @@ namespace ts { getJsDocTags(): JSDocTagInfo[] { if (this.jsDocTags === undefined) { - this.jsDocTags = this.declaration ? JsDoc.getJsDocTagsFromDeclarations(this.checker, [this.declaration]) : []; + this.jsDocTags = this.declaration ? JsDoc.getJsDocTagsFromDeclarations([this.declaration], this.checker) : []; } return this.jsDocTags; diff --git a/src/services/types.ts b/src/services/types.ts index f5b8e95ebbf8b..8810c0b7304e9 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -43,7 +43,7 @@ namespace ts { getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; /* @internal */ getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] - getJsDocTags(checker: TypeChecker): JSDocTagInfo[]; + getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; } export interface Type { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index 68120d5683aa7..cd61d62dee754 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -6,7 +6,7 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 0, "end": 59, "modifierFlagsCache": 0, @@ -66,7 +66,7 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 70, "end": 102, "modifierFlagsCache": 0, @@ -136,7 +136,7 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 113, "end": 589, "modifierFlagsCache": 0, @@ -311,7 +311,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 597, "end": 672, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json index 674bcdd21be2b..7b5e597a00aad 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -21,7 +21,7 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 24, "end": 34, "modifierFlagsCache": 0, @@ -56,7 +56,7 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 54, "end": 64, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index 47dee40afb22d..3bc35e984c160 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -21,7 +21,7 @@ "escapedText": "arg" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 28, "end": 42, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index 95d6022dc4caa..d6cfc231ee42f 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -21,7 +21,7 @@ "escapedText": "argument" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 33, "end": 47, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json index 9295ce3d9c129..5be4dbc03aa2c 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json @@ -6,7 +6,7 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 0, "end": 21, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index 16fb005b9e387..669c1e44bcf47 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -21,7 +21,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 15, "end": 50, "modifierFlagsCache": 0, @@ -44,7 +44,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 58, "end": 112, "modifierFlagsCache": 0, @@ -67,7 +67,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 120, "end": 170, "modifierFlagsCache": 0, @@ -90,7 +90,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 178, "end": 227, "modifierFlagsCache": 0, @@ -113,7 +113,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 235, "end": 272, "modifierFlagsCache": 0, @@ -136,7 +136,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 280, "end": 338, "modifierFlagsCache": 0, @@ -159,7 +159,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 346, "end": 381, "modifierFlagsCache": 0, @@ -182,7 +182,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 389, "end": 398, "modifierFlagsCache": 0, @@ -205,7 +205,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 406, "end": 429, "modifierFlagsCache": 0, @@ -228,7 +228,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 437, "end": 445, "modifierFlagsCache": 0, @@ -281,7 +281,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 469, "end": 486, "modifierFlagsCache": 0, @@ -319,7 +319,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 510, "end": 522, "modifierFlagsCache": 0, @@ -342,7 +342,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 530, "end": 559, "modifierFlagsCache": 0, @@ -365,7 +365,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 567, "end": 598, "modifierFlagsCache": 0, @@ -388,7 +388,7 @@ "escapedText": "address" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 606, "end": 645, "modifierFlagsCache": 0, @@ -411,7 +411,7 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 653, "end": 736, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json index f3e0722fd1a10..1cad64c9cecdc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json @@ -21,7 +21,7 @@ "escapedText": "example" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 19, "end": 53, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index fb055f94b794b..84dda35bc39c1 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -21,7 +21,7 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 16, "end": 59, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index a497996159437..eff8ac668e69f 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -21,7 +21,7 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 30, "end": 57, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index c4133f3324bc2..00ad77b4ef0f3 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -21,7 +21,7 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 31, "end": 59, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index ff7e6700b2185..314c356528484 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -21,7 +21,7 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 36, "end": 64, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index 06995e3692fd5..d4c2a7b95445b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -21,7 +21,7 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 29, "end": 44, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json index b492b3504c8eb..0ca532259d2f7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json @@ -22,7 +22,7 @@ "escapedText": "return" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 24, "end": 52, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json index 3bc06c47763e3..5105f08165d55 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json @@ -21,7 +21,7 @@ "escapedText": "template" }, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 24, "end": 58, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json index cd85c9a253b82..06921f3216130 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json @@ -6,7 +6,7 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "kind": "JSDocCommentComment", + "kind": "JSDocCommentText", "pos": 0, "end": 5, "modifierFlagsCache": 0, diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index bf4641df555a1..06df59f72652f 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -416,7 +416,7 @@ declare namespace ts { JSDocVariadicType = 309, JSDocNamepathType = 310, JSDocComment = 311, - JSDocCommentComment = 312, + JSDocCommentText = 312, JSDocTypeLiteral = 313, JSDocSignature = 314, JSDocLink = 315, @@ -1744,18 +1744,19 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: JSDocComment; + readonly comment?: JSDocCommentText; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: JSDocComment; + readonly comment?: JSDocCommentText; } export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; } - export interface JSDocComment extends Node { + export interface JSDocCommentText extends Node { + readonly kind: SyntaxKind.JSDocCommentText; text: string; links?: NodeArray; } @@ -3467,50 +3468,50 @@ declare namespace ts { updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocComment | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocComment): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocComment | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocComment): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocComment | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: JSDocComment): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; - createJSDocCommentComment(text: string, links?: readonly JSDocLink[]): JSDocComment; - updateJSDocCommentComment(node: JSDocComment, text: string, links?: readonly JSDocLink[]): JSDocComment; - createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocCommentText | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocCommentText): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocCommentText | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocCommentText): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocCommentText | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: JSDocCommentText): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocCommentText | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; + createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText; + updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText; + createJSDocComment(comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -5300,7 +5301,7 @@ declare namespace ts { getName(): string; getDeclarations(): Declaration[] | undefined; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; - getJsDocTags(checker: TypeChecker): JSDocTagInfo[]; + getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; } interface Type { getFlags(): TypeFlags; @@ -10593,51 +10594,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: JSDocComment | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: JSDocCommentText | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocComment | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocCommentText | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: JSDocComment | undefined) => JSDocAugmentsTag; + }, comment?: JSDocCommentText | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocComment | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocCommentText | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocComment | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocCommentText | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocComment | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocCommentText | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: JSDocComment | undefined) => JSDocImplementsTag; + }, comment?: JSDocCommentText | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: JSDocComment | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: JSDocCommentText | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index e840dee497f47..4ef259e3860ca 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -416,7 +416,7 @@ declare namespace ts { JSDocVariadicType = 309, JSDocNamepathType = 310, JSDocComment = 311, - JSDocCommentComment = 312, + JSDocCommentText = 312, JSDocTypeLiteral = 313, JSDocSignature = 314, JSDocLink = 315, @@ -1744,18 +1744,19 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: JSDocComment; + readonly comment?: JSDocCommentText; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: JSDocComment; + readonly comment?: JSDocCommentText; } export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; } - export interface JSDocComment extends Node { + export interface JSDocCommentText extends Node { + readonly kind: SyntaxKind.JSDocCommentText; text: string; links?: NodeArray; } @@ -3467,50 +3468,50 @@ declare namespace ts { updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocComment | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocComment): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocComment | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocComment): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocComment): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocComment | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocComment | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocComment): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocComment | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocComment): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocComment | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocComment): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocComment | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocComment): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocComment | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: JSDocComment): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocComment | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocComment): JSDocDeprecatedTag; - createJSDocCommentComment(text: string, links?: readonly JSDocLink[]): JSDocComment; - updateJSDocCommentComment(node: JSDocComment, text: string, links?: readonly JSDocLink[]): JSDocComment; - createJSDocComment(comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: JSDocComment | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocCommentText | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocCommentText): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocCommentText | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocCommentText): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocCommentText | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: JSDocCommentText): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocCommentText | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; + createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText; + updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText; + createJSDocComment(comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -5300,7 +5301,7 @@ declare namespace ts { getName(): string; getDeclarations(): Declaration[] | undefined; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; - getJsDocTags(checker: TypeChecker): JSDocTagInfo[]; + getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; } interface Type { getFlags(): TypeFlags; @@ -6923,51 +6924,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: JSDocComment | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: JSDocCommentText | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: JSDocComment | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocComment | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocCommentText | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: JSDocComment | undefined) => JSDocAugmentsTag; + }, comment?: JSDocCommentText | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocComment | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocComment | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocComment | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocCommentText | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocComment | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocCommentText | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocComment | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocCommentText | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: JSDocComment | undefined) => JSDocImplementsTag; + }, comment?: JSDocCommentText | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: JSDocComment | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: JSDocComment | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: JSDocCommentText | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ From fdb67a60345ba8bb94462bda825ce8459c0cf621 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 14 Dec 2020 09:03:30 -0800 Subject: [PATCH 23/44] Use getTokenValue instead of getTokenText Measure twice, slice once --- src/compiler/parser.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index a42ecfbf6f67e..193c241bfcd28 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7659,7 +7659,7 @@ namespace ts { } function parseLink(start: number) { - if (!tryParse(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) { + if (!tryParse(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenValue() === "link")) { return undefined; } nextTokenJSDoc(); // start at token after link, then skip any whitespace @@ -7794,7 +7794,7 @@ namespace ts { } function parseSeeTag(start: number, tagName: Identifier, indent?: number, indentText?: string): JSDocSeeTag { - const isLink = lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"); + const isLink = lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenValue() === "link"); const nameExpression = isLink ? undefined : parseJSDocNameReference(); const comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined; return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments), start); From 543b6abe1ecebe81c1938319752cda5f862c3034 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 14 Dec 2020 16:16:14 -0800 Subject: [PATCH 24/44] Add missing support for top-level links The language service and protocol were missing support for top-level links. This commit adds that plumbing. --- src/compiler/emitter.ts | 2 +- src/harness/client.ts | 23 ++- src/server/protocol.ts | 15 ++ src/server/session.ts | 16 +- src/services/codefixes/inferFromUsage.ts | 3 +- src/services/completions.ts | 8 +- src/services/jsDoc.ts | 24 ++- src/services/services.ts | 32 ++- src/services/signatureHelp.ts | 6 +- src/services/symbolDisplay.ts | 9 +- src/services/types.ts | 7 +- .../unittests/tsserver/completions.ts | 1 + .../unittests/tsserver/dynamicFiles.ts | 1 + src/testRunner/unittests/tsserver/jsdocTag.ts | 63 +++++- .../unittests/tsserver/webServer.ts | 1 + .../reference/api/tsserverlibrary.d.ts | 20 +- tests/baselines/reference/api/typescript.d.ts | 7 +- .../reference/jsDocAliasQuickInfo.baseline | 3 + tests/baselines/reference/jsDocTags.baseline | 9 + tests/baselines/reference/jsDocTypeTag1.js | 13 ++ tests/baselines/reference/jsDocTypeTag2.js | 12 ++ tests/baselines/reference/jsDocTypedef1.js | 4 +- tests/baselines/reference/jsdocLink1.baseline | 20 ++ tests/baselines/reference/jsdocLink2.baseline | 20 ++ tests/baselines/reference/jsdocLink3.baseline | 20 ++ ...splayPartsArrowFunctionExpression.baseline | 24 ++- .../quickInfoDisplayPartsClass.baseline | 15 +- ...ickInfoDisplayPartsClassAccessors.baseline | 96 ++++++--- ...kInfoDisplayPartsClassConstructor.baseline | 78 ++++--- .../quickInfoDisplayPartsClassMethod.baseline | 48 +++-- ...uickInfoDisplayPartsClassProperty.baseline | 48 +++-- .../quickInfoDisplayPartsConst.baseline | 48 +++-- .../quickInfoDisplayPartsEnum1.baseline | 90 +++++--- .../quickInfoDisplayPartsEnum2.baseline | 90 +++++--- .../quickInfoDisplayPartsEnum3.baseline | 90 +++++--- ...layPartsExternalModuleAlias_file0.baseline | 18 +- ...ckInfoDisplayPartsExternalModules.baseline | 51 +++-- .../quickInfoDisplayPartsFunction.baseline | 42 ++-- ...nfoDisplayPartsFunctionExpression.baseline | 18 +- .../quickInfoDisplayPartsInterface.baseline | 9 +- ...kInfoDisplayPartsInterfaceMembers.baseline | 27 ++- ...foDisplayPartsInternalModuleAlias.baseline | 24 ++- .../quickInfoDisplayPartsLet.baseline | 48 +++-- ...nfoDisplayPartsLiteralLikeNames01.baseline | 30 ++- ...uickInfoDisplayPartsLocalFunction.baseline | 48 +++-- .../quickInfoDisplayPartsModules.baseline | 51 +++-- .../quickInfoDisplayPartsParameters.baseline | 25 ++- .../quickInfoDisplayPartsTypeAlias.baseline | 18 +- ...oDisplayPartsTypeParameterInClass.baseline | 123 +++++++---- ...splayPartsTypeParameterInFunction.baseline | 36 ++-- ...arameterInFunctionLikeInTypeAlias.baseline | 9 +- ...playPartsTypeParameterInInterface.baseline | 195 ++++++++++++------ ...playPartsTypeParameterInTypeAlias.baseline | 18 +- .../quickInfoDisplayPartsVar.baseline | 42 ++-- ...quickInfoDisplayPartsVar.shims-pp.baseline | 42 ++-- .../quickInfoDisplayPartsVar.shims.baseline | 42 ++-- ...oDisplayPartsVarWithStringTypes01.baseline | 9 +- .../quickInfoForJSDocCodefence.baseline | 2 + .../quickInfoForJSDocUnknownTag.baseline | 5 + .../reference/quickInfoJsDocTags.baseline | 1 + ...rtiesWithIdenticalJSDocComments01.baseline | 3 +- .../completionEntryDetailAcrossFiles01.ts | 8 +- .../completionEntryDetailAcrossFiles02.ts | 16 +- 63 files changed, 1361 insertions(+), 565 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d5ab6d5af95d8..3930a4df94121 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3653,7 +3653,7 @@ namespace ts { emitJSDocComment(tag.comment); } - function emitJSDocTypeLiteral(lit:JSDocTypeLiteral) { + function emitJSDocTypeLiteral(lit: JSDocTypeLiteral) { emitList(lit, factory.createNodeArray(lit.jsDocPropertyTags), ListFormat.JSDocComment); } diff --git a/src/harness/client.ts b/src/harness/client.ts index ff554470137e8..1c2e9932ea33f 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -176,7 +176,8 @@ namespace ts.server { textSpan: this.decodeSpan(body, fileName), displayParts: [{ kind: "text", text: body.displayString }], documentation: [{ kind: "text", text: body.documentation }], - tags: this.decodeLink(body.tags) + links: this.decodeLinks(body.links), + tags: this.decodeLinkTags(body.tags) }; } @@ -223,8 +224,9 @@ namespace ts.server { const response = this.processResponse(request); Debug.assert(response.body!.length === 1, "Unexpected length of completion details response body."); const convertedCodeActions = map(response.body![0].codeActions, ({ description, changes }) => ({ description, changes: this.convertChanges(changes, fileName) })); - const tags = response.body![0].tags ? this.decodeLink(response.body![0].tags) : undefined; - return { ...response.body![0], tags, codeActions: convertedCodeActions }; + const tags = response.body![0].tags ? this.decodeLinkTags(response.body![0].tags) : undefined; + const links = response.body![0].links ? this.decodeLinks(response.body![0].links) : undefined; + return { ...response.body![0], links, tags, codeActions: convertedCodeActions }; } getCompletionEntrySymbol(_fileName: string, _position: number, _entryName: string): Symbol { @@ -533,10 +535,8 @@ namespace ts.server { this.lineOffsetToPosition(fileName, span.end, lineMap)); } - private decodeLink(tags: protocol.JSDocTagInfo[]): JSDocTagInfo[] { - return tags.map(tag => ({ - ...tag, - links: tag.links?.map(link => ({ + private decodeLinks(links: protocol.JSDocLinkInfo[]): JSDocLinkInfo[] { + return links.map(link => ({ ...link, name: link.name as unknown as TextSpan, target: { @@ -544,7 +544,12 @@ namespace ts.server { textSpan: link.target as unknown as TextSpan, fileName: link.target.file, } - })) + })); + } + private decodeLinkTags(tags: protocol.JSDocTagInfo[]): JSDocTagInfo[] { + return tags.map(tag => ({ + ...tag, + links: tag.links ? this.decodeLinks(tag.links) : undefined })); } @@ -570,7 +575,7 @@ namespace ts.server { // TODO: Same here, it doesn't actually seem to be encoded const applicableSpan = encodedApplicableSpan as unknown as TextSpan; - const items = encodedItems.map(item => ({ ...item, tags: this.decodeLink(item.tags) })); + const items = encodedItems.map(item => ({ ...item, links: this.decodeLinks(item.links), tags: this.decodeLinkTags(item.tags) })); return { items, applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; } diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 3addbbc7ebece..88b3d0a4cb531 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1967,6 +1967,11 @@ namespace ts.server.protocol { */ documentation: string; + /** + * JSDoc links associated with symbol. + */ + links: JSDocLinkInfo[]; + /** * JSDoc tags associated with symbol. */ @@ -2273,6 +2278,11 @@ namespace ts.server.protocol { */ documentation?: SymbolDisplayPart[]; + /** + * JSDoc links associated with symbol. + */ + links?: JSDocLinkInfo[]; + /** * JSDoc tags for the symbol. */ @@ -2376,6 +2386,11 @@ namespace ts.server.protocol { */ documentation: SymbolDisplayPart[]; + /** + * JSDoc links associated with symbol. + */ + links: JSDocLinkInfo[]; + /** * The signature's JSDoc tags */ diff --git a/src/server/session.ts b/src/server/session.ts index e3624138e5ba9..718a6746695b2 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1273,21 +1273,21 @@ namespace ts.server { result; } - private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project): protocol.JSDocTagInfo[] { - if (tags === undefined) { + private mapJSDocLinkInfo(links: JSDocLinkInfo[] | undefined, project: Project): protocol.JSDocLinkInfo[] { + if (links === undefined) { return []; } - return tags.map(({ name, text, links }) => ({ - name, - text, - links: links?.map(link => ({ + return links.map(link => ({ ...link, name: this.toFileSpan(link.fileName, link.name, project), target: this.toFileSpan(link.target.fileName, link.target.textSpan, project), - })) })); } + private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project): protocol.JSDocTagInfo[] { + return tags ? tags.map(tag => ({ ...tag, links: this.mapJSDocLinkInfo(tag.links, project) })) : []; + } + private mapDefinitionInfo(definitions: readonly DefinitionInfo[], project: Project): readonly protocol.FileSpanWithContext[] { return definitions.map(def => this.toFileSpanWithContext(def.fileName, def.textSpan, def.contextSpan, project)); } @@ -1710,6 +1710,7 @@ namespace ts.server { end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), displayString, documentation: docString, + links: this.mapJSDocLinkInfo(quickInfo.links, project), tags: this.mapJSDocTagInfo(quickInfo.tags, project) }; } @@ -1859,6 +1860,7 @@ namespace ts.server { : result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)), + links: this.mapJSDocLinkInfo(details.links, project), tags: this.mapJSDocTagInfo(details.tags, project) })); } diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index dd4763eba74e1..8d09a405e742d 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -281,7 +281,8 @@ namespace ts.codefix { setAccessorDeclaration: SetAccessorDeclaration, program: Program, host: LanguageServiceHost, - cancellationToken: CancellationToken, + cancellationToken: CancellationToken, + ): void { const param = firstOrUndefined(setAccessorDeclaration.parameters); diff --git a/src/services/completions.ts b/src/services/completions.ts index 810a7dfdebe16..7c5ebfb06fc3e 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -693,15 +693,15 @@ namespace ts.Completions { } export function createCompletionDetailsForSymbol(symbol: Symbol, checker: TypeChecker, sourceFile: SourceFile, location: Node, cancellationToken: CancellationToken, codeActions?: CodeAction[], sourceDisplay?: SymbolDisplayPart[]): CompletionEntryDetails { - const { displayParts, documentation, symbolKind, tags } = + const { displayParts, documentation, links, symbolKind, tags } = checker.runWithCancellationToken(cancellationToken, checker => SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, sourceFile, location, location, SemanticMeaning.All) ); - return createCompletionDetails(symbol.name, SymbolDisplay.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay); + return createCompletionDetails(symbol.name, SymbolDisplay.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, links, tags, codeActions, sourceDisplay); } - export function createCompletionDetails(name: string, kindModifiers: string, kind: ScriptElementKind, displayParts: SymbolDisplayPart[], documentation?: SymbolDisplayPart[], tags?: JSDocTagInfo[], codeActions?: CodeAction[], source?: SymbolDisplayPart[]): CompletionEntryDetails { - return { name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source }; + export function createCompletionDetails(name: string, kindModifiers: string, kind: ScriptElementKind, displayParts: SymbolDisplayPart[], documentation?: SymbolDisplayPart[], links?: JSDocLinkInfo[], tags?: JSDocTagInfo[], codeActions?: CodeAction[], source?: SymbolDisplayPart[]): CompletionEntryDetails { + return { name, kindModifiers, kind, displayParts, documentation, links, tags, codeActions, source }; } interface CodeActionsAndSourceDisplay { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index da5ed609c1af2..ec63ce2c1fb68 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -123,7 +123,27 @@ namespace ts.JsDoc { return tags; } - function getLinks(tag: JSDocTag, checker: TypeChecker): JSDocLinkInfo[] | undefined { + export function getJsDocLinksFromDeclarations(declarations?: Declaration[], checker?: TypeChecker): JSDocLinkInfo[] { + // Only collect doc comments from duplicate declarations once. + const links: JSDocLinkInfo[] = []; + if (!declarations || !checker) { + return links; + } + forEachUnique(declarations, declaration => { + for (const comment of getJSDocCommentsAndTags(declaration)) { + if (isJSDoc(comment)) { + const newLinks = getLinks(comment, checker); + if (newLinks) { + links.push(...newLinks); + } + } + } + }); + return links; + + } + + function getLinks(tag: JSDoc | JSDocTag, checker: TypeChecker): JSDocLinkInfo[] | undefined { const links = tag.comment?.links; if (links) { return mapDefined(links, link => { @@ -209,6 +229,7 @@ namespace ts.JsDoc { kindModifiers: "", displayParts: [textPart(name)], documentation: emptyArray, + links: undefined, tags: undefined, codeActions: undefined, }; @@ -243,6 +264,7 @@ namespace ts.JsDoc { kindModifiers: "", displayParts: [textPart(name)], documentation: emptyArray, + links: undefined, tags: undefined, codeActions: undefined, }; diff --git a/src/services/services.ts b/src/services/services.ts index 182a8587e268e..0f0d977b138cc 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -292,14 +292,12 @@ namespace ts { // Undefined is used to indicate the value has not been computed. If, after computing, the // symbol has no doc comment, then the empty array will be returned. documentationComment?: SymbolDisplayPart[]; + tags?: JSDocTagInfo[]; // same + links?: JSDocLinkInfo[]; // same contextualGetAccessorDocumentationComment?: SymbolDisplayPart[]; contextualSetAccessorDocumentationComment?: SymbolDisplayPart[]; - // Undefined is used to indicate the value has not been computed. If, after computing, the - // symbol has no JSDoc tags, then the empty array will be returned. - tags?: JSDocTagInfo[]; - constructor(flags: SymbolFlags, name: __String) { this.flags = flags; this.escapedName = name; @@ -359,6 +357,14 @@ namespace ts { } } + getJsDocLinks(checker: TypeChecker): JSDocLinkInfo[] { + if (this.links === undefined) { + this.links = JsDoc.getJsDocLinksFromDeclarations(this.declarations, checker); + } + + return this.links; + } + getJsDocTags(checker?: TypeChecker): JSDocTagInfo[] { if (this.tags === undefined) { this.tags = JsDoc.getJsDocTagsFromDeclarations(this.declarations, checker); @@ -521,10 +527,8 @@ namespace ts { // Undefined is used to indicate the value has not been computed. If, after computing, the // symbol has no doc comment, then the empty array will be returned. documentationComment?: SymbolDisplayPart[]; - - // Undefined is used to indicate the value has not been computed. If, after computing, the - // symbol has no doc comment, then the empty array will be returned. - jsDocTags?: JSDocTagInfo[]; + jsDocTags?: JSDocTagInfo[]; // same + jsDocLinks?: JSDocLinkInfo[]; // same constructor(checker: TypeChecker, flags: SignatureFlags) { this.checker = checker; @@ -548,6 +552,14 @@ namespace ts { return this.documentationComment || (this.documentationComment = getDocumentationComment(singleElementArray(this.declaration), this.checker)); } + getJsDocLinks(): JSDocLinkInfo[] { + if (this.jsDocLinks === undefined) { + this.jsDocLinks = this.declaration ? JsDoc.getJsDocLinksFromDeclarations([this.declaration], this.checker) : []; + } + + return this.jsDocLinks; + } + getJsDocTags(): JSDocTagInfo[] { if (this.jsDocTags === undefined) { this.jsDocTags = this.declaration ? JsDoc.getJsDocTagsFromDeclarations([this.declaration], this.checker) : []; @@ -1598,11 +1610,12 @@ namespace ts { textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile), displayParts: typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(nodeForQuickInfo))), documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : undefined, + links: type.symbol ? type.symbol.getJsDocLinks(typeChecker): undefined, tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : undefined }; } - const { symbolKind, displayParts, documentation, tags } = typeChecker.runWithCancellationToken(cancellationToken, typeChecker => + const { symbolKind, displayParts, documentation, links, tags } = typeChecker.runWithCancellationToken(cancellationToken, typeChecker => SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, getContainerNode(nodeForQuickInfo), nodeForQuickInfo) ); return { @@ -1611,6 +1624,7 @@ namespace ts { textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile), displayParts, documentation, + links, tags, }; } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index eb02533d5477e..20a4ff6ee051a 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -564,9 +564,10 @@ namespace ts.SignatureHelp { const parameters = typeParameters.map(t => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer)); const documentation = symbol.getDocumentationComment(checker); + const links = symbol.getJsDocLinks(checker); const tags = symbol.getJsDocTags(checker); const prefixDisplayParts = [...typeSymbolDisplay, punctuationPart(SyntaxKind.LessThanToken)]; - return { isVariadic: false, prefixDisplayParts, suffixDisplayParts: [punctuationPart(SyntaxKind.GreaterThanToken)], separatorDisplayParts, parameters, documentation, tags }; + return { isVariadic: false, prefixDisplayParts, suffixDisplayParts: [punctuationPart(SyntaxKind.GreaterThanToken)], separatorDisplayParts, parameters, documentation, links, tags }; } const separatorDisplayParts: SymbolDisplayPart[] = [punctuationPart(SyntaxKind.CommaToken), spacePart()]; @@ -577,8 +578,9 @@ namespace ts.SignatureHelp { const prefixDisplayParts = [...callTargetDisplayParts, ...prefix]; const suffixDisplayParts = [...suffix, ...returnTypeToDisplayParts(candidateSignature, enclosingDeclaration, checker)]; const documentation = candidateSignature.getDocumentationComment(checker); + const links = candidateSignature.getJsDocLinks(); const tags = candidateSignature.getJsDocTags(); - return { isVariadic, prefixDisplayParts, suffixDisplayParts, separatorDisplayParts, parameters, documentation, tags }; + return { isVariadic, prefixDisplayParts, suffixDisplayParts, separatorDisplayParts, parameters, documentation, links, tags }; }); } diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index 85f6c5c7cc63e..8eb0b0554a7b6 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -131,6 +131,7 @@ namespace ts.SymbolDisplay { interface SymbolDisplayPartsDocumentationAndSymbolKind { displayParts: SymbolDisplayPart[]; documentation: SymbolDisplayPart[]; + links: JSDocLinkInfo[] | undefined; symbolKind: ScriptElementKind; tags: JSDocTagInfo[] | undefined; } @@ -141,6 +142,7 @@ namespace ts.SymbolDisplay { const displayParts: SymbolDisplayPart[] = []; let documentation: SymbolDisplayPart[] = []; let tags: JSDocTagInfo[] = []; + let links: JSDocLinkInfo[] = []; const symbolFlags = getCombinedLocalAndExportSymbolFlags(symbol); let symbolKind = semanticMeaning & SemanticMeaning.Value ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : ScriptElementKind.unknown; let hasAddedSymbolInfo = false; @@ -152,7 +154,7 @@ namespace ts.SymbolDisplay { let hasMultipleSignatures = false; if (location.kind === SyntaxKind.ThisKeyword && !isThisExpression) { - return { displayParts: [keywordPart(SyntaxKind.ThisKeyword)], documentation: [], symbolKind: ScriptElementKind.primitiveType, tags: undefined }; + return { displayParts: [keywordPart(SyntaxKind.ThisKeyword)], documentation: [], symbolKind: ScriptElementKind.primitiveType, links: undefined, tags: undefined }; } // Class at constructor site need to be shown as constructor apart from property,method, vars @@ -531,6 +533,7 @@ namespace ts.SymbolDisplay { if (documentation.length === 0 && !hasMultipleSignatures) { documentation = symbol.getContextualDocumentationComment(enclosingDeclaration, typeChecker); + links = symbol.getJsDocLinks(typeChecker); } if (documentation.length === 0 && symbolFlags & SymbolFlags.Property) { @@ -549,6 +552,7 @@ namespace ts.SymbolDisplay { } documentation = rhsSymbol.getDocumentationComment(typeChecker); + links = rhsSymbol.getJsDocLinks(typeChecker); tags = rhsSymbol.getJsDocTags(typeChecker); if (documentation.length > 0) { break; @@ -569,7 +573,7 @@ namespace ts.SymbolDisplay { tags = tagsFromAlias; } - return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? undefined : tags }; + return { displayParts, documentation, links, symbolKind, tags: tags.length === 0 ? undefined : tags }; function getPrinter() { if (!printer) { @@ -652,6 +656,7 @@ namespace ts.SymbolDisplay { } documentation = signature.getDocumentationComment(typeChecker); tags = signature.getJsDocTags(); + links = signature.getJsDocLinks(); if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) { documentation = allSignatures[0].getDocumentationComment(typeChecker); diff --git a/src/services/types.ts b/src/services/types.ts index 8810c0b7304e9..7533d7e1a73bc 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -44,6 +44,7 @@ namespace ts { /* @internal */ getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; + getJsDocLinks(checker: TypeChecker): JSDocLinkInfo[]; } export interface Type { @@ -84,6 +85,7 @@ namespace ts { getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; + getJsDocLinks(): JSDocLinkInfo[]; getJsDocTags(): JSDocTagInfo[]; } @@ -1034,7 +1036,7 @@ namespace ts { export interface JSDocTagInfo { name: string; text?: string; - links?: readonly JSDocLinkInfo[]; + links?: JSDocLinkInfo[]; } export interface JSDocLinkInfo extends DocumentSpan { @@ -1048,6 +1050,7 @@ namespace ts { textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; + links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; } @@ -1100,6 +1103,7 @@ namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; + links: JSDocLinkInfo[]; tags: JSDocTagInfo[]; } @@ -1158,6 +1162,7 @@ namespace ts { kindModifiers: string; // see ScriptElementKindModifier, comma separated displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; + links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index 0770ef1e78301..1a23656984c30 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -64,6 +64,7 @@ namespace ts.projectSystem { displayPart("0", SymbolDisplayPartKind.stringLiteral), ], documentation: emptyArray, + links: [], kind: ScriptElementKind.constElement, kindModifiers: ScriptElementKindModifier.exportedModifier, name: "foo", diff --git a/src/testRunner/unittests/tsserver/dynamicFiles.ts b/src/testRunner/unittests/tsserver/dynamicFiles.ts index 95976bffa1f9f..a8b2e7d2f7884 100644 --- a/src/testRunner/unittests/tsserver/dynamicFiles.ts +++ b/src/testRunner/unittests/tsserver/dynamicFiles.ts @@ -160,6 +160,7 @@ var x = 10;` { text: "number", kind: "keyword" } ], documentation: [], + links: [], tags: undefined, }); }); diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index e0e5ccbb50fba..711da7ee70823 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -1,8 +1,6 @@ namespace ts.projectSystem { describe("unittests:: tsserver:: jsdoc @link ", () => { - it("should provide a target span for a working link", () => { - // TODO: (1) based on a dynamic file test - // (2) didn't work outside a tag + it("should provide a target span for a working link in a tag", () => { const file: File = { path: "someFile1.js", content: `class C { } @@ -36,6 +34,7 @@ var x = 1`); { text: "number", kind: "keyword" } ], documentation: [], + links: [], tags: [{ links: [{ fileName: "someFile1.js", @@ -59,8 +58,64 @@ var x = 1`); text: "{@link C}", }] }); + }); + it("should provide a target span for a working link in a comment", () => { + const file: File = { + path: "someFile1.js", + content: `class C { } +/** {@link C} */ +var x = 1` + }; + const host = createServerHost([libFile], { useCaseSensitiveFileNames: true }); + const projectService = createProjectService(host); + projectService.setCompilerOptionsForInferredProjects({ + module: ModuleKind.CommonJS, + allowJs: true, + allowSyntheticDefaultImports: true, + allowNonTsExtensions: true + }); + projectService.openClientFile(file.path, `class C { } +/** {@link C} */ +var x = 1`); - + const project = projectService.inferredProjects[0]; + const indexOfX = file.content.indexOf("x"); + assert.deepEqual(project.getLanguageService(/*ensureSynchronized*/ true).getQuickInfoAtPosition(file.path, indexOfX), { + kind: ScriptElementKind.variableElement, + kindModifiers: "", + textSpan: { start: indexOfX, length: 1 }, + displayParts: [ + { text: "var", kind: "keyword" }, + { text: " ", kind: "space" }, + { text: "x", kind: "localName" }, + { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, + { text: "number", kind: "keyword" } + ], + documentation: [{ + kind: "text", + text: "{@link C}" + }], + links: [{ + fileName: "someFile1.js", + name: { + length: 1, + start: 23, + }, + target: { + fileName: "someFile1.js", + textSpan: { + length: 11, + start: 0, + } + }, + textSpan: { + length: 9, + start: 16, + }, + }], + tags: undefined, + }); }); }); } diff --git a/src/testRunner/unittests/tsserver/webServer.ts b/src/testRunner/unittests/tsserver/webServer.ts index 5ea6f48a8a92b..4e3eefe219812 100644 --- a/src/testRunner/unittests/tsserver/webServer.ts +++ b/src/testRunner/unittests/tsserver/webServer.ts @@ -88,6 +88,7 @@ namespace ts.projectSystem { end: { line: start.line, offset: start.offset + "numberConst".length }, displayString: "const numberConst: 10", documentation: "", + links: [], tags: [] } }); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 06df59f72652f..9efd2c666467f 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -5302,6 +5302,7 @@ declare namespace ts { getDeclarations(): Declaration[] | undefined; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; + getJsDocLinks(checker: TypeChecker): JSDocLinkInfo[]; } interface Type { getFlags(): TypeFlags; @@ -5336,6 +5337,7 @@ declare namespace ts { getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; + getJsDocLinks(): JSDocLinkInfo[]; getJsDocTags(): JSDocTagInfo[]; } interface SourceFile { @@ -5996,7 +5998,7 @@ declare namespace ts { interface JSDocTagInfo { name: string; text?: string; - links?: readonly JSDocLinkInfo[]; + links?: JSDocLinkInfo[]; } interface JSDocLinkInfo extends DocumentSpan { name: TextSpan; @@ -6008,6 +6010,7 @@ declare namespace ts { textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; + links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; @@ -6055,6 +6058,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; + links: JSDocLinkInfo[]; tags: JSDocTagInfo[]; } /** @@ -6107,6 +6111,7 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; + links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; @@ -7956,6 +7961,10 @@ declare namespace ts.server.protocol { * Documentation associated with symbol. */ documentation: string; + /** + * JSDoc links associated with symbol. + */ + links: JSDocLinkInfo[]; /** * JSDoc tags associated with symbol. */ @@ -8228,6 +8237,10 @@ declare namespace ts.server.protocol { * Documentation strings for the symbol. */ documentation?: SymbolDisplayPart[]; + /** + * JSDoc links associated with symbol. + */ + links?: JSDocLinkInfo[]; /** * JSDoc tags for the symbol. */ @@ -8312,6 +8325,10 @@ declare namespace ts.server.protocol { * The signature's documentation */ documentation: SymbolDisplayPart[]; + /** + * JSDoc links associated with symbol. + */ + links: JSDocLinkInfo[]; /** * The signature's JSDoc tags */ @@ -10007,6 +10024,7 @@ declare namespace ts.server { private mapDefinitionInfoLocations; private getDefinitionAndBoundSpan; private getEmitOutput; + private mapJSDocLinkInfo; private mapJSDocTagInfo; private mapDefinitionInfo; private static mapToOriginalLocation; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 4ef259e3860ca..f2a0a0d191093 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -5302,6 +5302,7 @@ declare namespace ts { getDeclarations(): Declaration[] | undefined; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; + getJsDocLinks(checker: TypeChecker): JSDocLinkInfo[]; } interface Type { getFlags(): TypeFlags; @@ -5336,6 +5337,7 @@ declare namespace ts { getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; + getJsDocLinks(): JSDocLinkInfo[]; getJsDocTags(): JSDocTagInfo[]; } interface SourceFile { @@ -5996,7 +5998,7 @@ declare namespace ts { interface JSDocTagInfo { name: string; text?: string; - links?: readonly JSDocLinkInfo[]; + links?: JSDocLinkInfo[]; } interface JSDocLinkInfo extends DocumentSpan { name: TextSpan; @@ -6008,6 +6010,7 @@ declare namespace ts { textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; + links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; @@ -6055,6 +6058,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; + links: JSDocLinkInfo[]; tags: JSDocTagInfo[]; } /** @@ -6107,6 +6111,7 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; + links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; diff --git a/tests/baselines/reference/jsDocAliasQuickInfo.baseline b/tests/baselines/reference/jsDocAliasQuickInfo.baseline index 8fca65b97529b..e13a2cb997719 100644 --- a/tests/baselines/reference/jsDocAliasQuickInfo.baseline +++ b/tests/baselines/reference/jsDocAliasQuickInfo.baseline @@ -51,6 +51,7 @@ "kind": "text" } ], + "links": [], "tags": [ { "name": "type", @@ -111,6 +112,7 @@ "kind": "text" } ], + "links": [], "tags": [ { "name": "type", @@ -151,6 +153,7 @@ "kind": "text" } ], + "links": [], "tags": [ { "name": "type", diff --git a/tests/baselines/reference/jsDocTags.baseline b/tests/baselines/reference/jsDocTags.baseline index f316a9c42459d..9007d9f03b5db 100644 --- a/tests/baselines/reference/jsDocTags.baseline +++ b/tests/baselines/reference/jsDocTags.baseline @@ -67,6 +67,7 @@ "kind": "text" } ], + "links": [], "tags": [ { "name": "myjsdoctag", @@ -113,6 +114,7 @@ "kind": "text" } ], + "links": [], "tags": [ { "name": "mytag", @@ -189,6 +191,7 @@ "kind": "text" } ], + "links": [], "tags": [ { "name": "mytag", @@ -266,6 +269,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "mytag" @@ -342,6 +346,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "returns", @@ -435,6 +440,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "param", @@ -505,6 +511,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "mytag", @@ -568,6 +575,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "mytag1", @@ -649,6 +657,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "mytag" diff --git a/tests/baselines/reference/jsDocTypeTag1.js b/tests/baselines/reference/jsDocTypeTag1.js index 657ff5031a24e..c9674d5b1d0b7 100644 --- a/tests/baselines/reference/jsDocTypeTag1.js +++ b/tests/baselines/reference/jsDocTypeTag1.js @@ -38,6 +38,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -85,6 +86,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -132,6 +134,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -179,6 +182,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -226,6 +230,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -273,6 +278,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -328,6 +334,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -387,6 +394,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -434,6 +442,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -481,6 +490,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -528,6 +538,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -575,6 +586,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -638,6 +650,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", diff --git a/tests/baselines/reference/jsDocTypeTag2.js b/tests/baselines/reference/jsDocTypeTag2.js index 9933360b0091a..cecd5c558bbdb 100644 --- a/tests/baselines/reference/jsDocTypeTag2.js +++ b/tests/baselines/reference/jsDocTypeTag2.js @@ -38,6 +38,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -85,6 +86,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -132,6 +134,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -179,6 +182,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -226,6 +230,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -273,6 +278,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -328,6 +334,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -387,6 +394,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -434,6 +442,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -481,6 +490,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -564,6 +574,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", @@ -627,6 +638,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "type", diff --git a/tests/baselines/reference/jsDocTypedef1.js b/tests/baselines/reference/jsDocTypedef1.js index 4745ca9d22661..8149745ce1f47 100644 --- a/tests/baselines/reference/jsDocTypedef1.js +++ b/tests/baselines/reference/jsDocTypedef1.js @@ -46,6 +46,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "param", @@ -100,7 +101,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/jsdocLink1.baseline b/tests/baselines/reference/jsdocLink1.baseline index 597c1ce90e538..f3a75e519fccc 100644 --- a/tests/baselines/reference/jsdocLink1.baseline +++ b/tests/baselines/reference/jsdocLink1.baseline @@ -51,6 +51,26 @@ "kind": "text" } ], + "links": [ + { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 19, + "length": 9 + }, + "name": { + "start": 26, + "length": 1 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + } + ], "tags": [ { "name": "wat", diff --git a/tests/baselines/reference/jsdocLink2.baseline b/tests/baselines/reference/jsdocLink2.baseline index f3bdf1e0d0681..7b8ee8586aa54 100644 --- a/tests/baselines/reference/jsdocLink2.baseline +++ b/tests/baselines/reference/jsdocLink2.baseline @@ -51,6 +51,26 @@ "kind": "text" } ], + "links": [ + { + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 7, + "length": 9 + }, + "name": { + "start": 14, + "length": 1 + }, + "target": { + "fileName": "/tests/cases/fourslash/jsdocLink2.ts", + "textSpan": { + "start": 0, + "length": 11 + } + } + } + ], "tags": [ { "name": "wat", diff --git a/tests/baselines/reference/jsdocLink3.baseline b/tests/baselines/reference/jsdocLink3.baseline index 4614f9e4d57b5..04f8560c00872 100644 --- a/tests/baselines/reference/jsdocLink3.baseline +++ b/tests/baselines/reference/jsdocLink3.baseline @@ -51,6 +51,26 @@ "kind": "text" } ], + "links": [ + { + "fileName": "/module1.ts", + "textSpan": { + "start": 40, + "length": 9 + }, + "name": { + "start": 47, + "length": 1 + }, + "target": { + "fileName": "/jsdocLink3.ts", + "textSpan": { + "start": 0, + "length": 18 + } + } + } + ], "tags": [ { "name": "wat", diff --git a/tests/baselines/reference/quickInfoDisplayPartsArrowFunctionExpression.baseline b/tests/baselines/reference/quickInfoDisplayPartsArrowFunctionExpression.baseline index 7ee4e5b25cd93..d9572a85faccd 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsArrowFunctionExpression.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsArrowFunctionExpression.baseline @@ -73,7 +73,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -122,7 +123,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -223,7 +225,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -272,7 +275,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -321,7 +325,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -398,7 +403,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -447,7 +453,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -508,7 +515,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClass.baseline b/tests/baselines/reference/quickInfoDisplayPartsClass.baseline index 0b048b737a62e..ca9a31ed4a44c 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClass.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClass.baseline @@ -25,7 +25,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -66,7 +67,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -115,7 +117,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -164,7 +167,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -193,7 +197,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClassAccessors.baseline b/tests/baselines/reference/quickInfoDisplayPartsClassAccessors.baseline index b0c27fd9d288a..9c7eae17ff292 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClassAccessors.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClassAccessors.baseline @@ -53,7 +53,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -110,7 +111,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -167,7 +169,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -224,7 +227,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -281,7 +285,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -338,7 +343,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -395,7 +401,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -452,7 +459,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -509,7 +517,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -566,7 +575,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -623,7 +633,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -680,7 +691,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -737,7 +749,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -794,7 +807,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -851,7 +865,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -908,7 +923,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -965,7 +981,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1022,7 +1039,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1079,7 +1097,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1136,7 +1155,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1193,7 +1213,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1250,7 +1271,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1307,7 +1329,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1364,7 +1387,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1405,7 +1429,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1462,7 +1487,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1491,7 +1517,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1548,7 +1575,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1589,7 +1617,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1646,7 +1675,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1675,7 +1705,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1732,7 +1763,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClassConstructor.baseline b/tests/baselines/reference/quickInfoDisplayPartsClassConstructor.baseline index 76ca00a4048d4..c97d9b2332a59 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClassConstructor.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClassConstructor.baseline @@ -45,7 +45,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -86,7 +87,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -135,7 +137,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -184,7 +187,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -213,7 +217,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -306,7 +311,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -399,7 +405,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -492,7 +499,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -533,7 +541,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -626,7 +635,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -667,7 +677,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -760,7 +771,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -809,7 +821,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -838,7 +851,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -931,7 +945,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1024,7 +1039,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1117,7 +1133,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1210,7 +1227,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1251,7 +1269,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1344,7 +1363,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1385,7 +1405,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1478,7 +1499,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1519,7 +1541,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1612,7 +1635,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1661,7 +1685,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1690,7 +1715,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClassMethod.baseline b/tests/baselines/reference/quickInfoDisplayPartsClassMethod.baseline index d6f3f187d02cf..6de16be799548 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClassMethod.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClassMethod.baseline @@ -61,7 +61,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -126,7 +127,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -191,7 +193,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -256,7 +259,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -321,7 +325,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -386,7 +391,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -451,7 +457,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -516,7 +523,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -581,7 +589,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -646,7 +655,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -711,7 +721,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -776,7 +787,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -817,7 +829,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -882,7 +895,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -911,7 +925,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -976,7 +991,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClassProperty.baseline b/tests/baselines/reference/quickInfoDisplayPartsClassProperty.baseline index b49fb80c38a91..674286ef5a2b5 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClassProperty.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClassProperty.baseline @@ -53,7 +53,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -110,7 +111,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -167,7 +169,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -224,7 +227,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -281,7 +285,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -338,7 +343,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -395,7 +401,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -452,7 +459,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -509,7 +517,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -566,7 +575,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -623,7 +633,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -680,7 +691,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -721,7 +733,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -778,7 +791,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -807,7 +821,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -864,7 +879,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsConst.baseline b/tests/baselines/reference/quickInfoDisplayPartsConst.baseline index 7493d001bd394..aea2009e89ab8 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsConst.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsConst.baseline @@ -37,7 +37,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -78,7 +79,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -119,7 +121,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -160,7 +163,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -201,7 +205,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -250,7 +255,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -291,7 +297,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -352,7 +359,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -413,7 +421,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -474,7 +483,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -535,7 +545,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -680,7 +691,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -825,7 +837,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -970,7 +983,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1075,7 +1089,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1180,7 +1195,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsEnum1.baseline b/tests/baselines/reference/quickInfoDisplayPartsEnum1.baseline index 6dc27a4a5b33d..82e11a409eb26 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsEnum1.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsEnum1.baseline @@ -25,7 +25,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -86,7 +87,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -147,7 +149,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -208,7 +211,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -249,7 +253,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -278,7 +283,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -319,7 +325,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -348,7 +355,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -409,7 +417,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -450,7 +459,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -479,7 +489,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -540,7 +551,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -581,7 +593,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -610,7 +623,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -671,7 +685,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -708,7 +723,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -769,7 +785,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -830,7 +847,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -891,7 +909,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -932,7 +951,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -969,7 +989,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1010,7 +1031,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1047,7 +1069,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1108,7 +1131,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1149,7 +1173,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1186,7 +1211,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1247,7 +1273,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1288,7 +1315,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1325,7 +1353,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1386,7 +1415,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsEnum2.baseline b/tests/baselines/reference/quickInfoDisplayPartsEnum2.baseline index 43d0683faef80..8c814e57e0257 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsEnum2.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsEnum2.baseline @@ -25,7 +25,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -90,7 +91,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -155,7 +157,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -220,7 +223,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -261,7 +265,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -290,7 +295,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -331,7 +337,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -360,7 +367,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -425,7 +433,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -466,7 +475,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -495,7 +505,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -560,7 +571,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -601,7 +613,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -630,7 +643,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -695,7 +709,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -732,7 +747,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -797,7 +813,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -862,7 +879,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -927,7 +945,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -968,7 +987,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1005,7 +1025,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1046,7 +1067,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1083,7 +1105,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1148,7 +1171,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1189,7 +1213,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1226,7 +1251,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1291,7 +1317,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1332,7 +1359,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1369,7 +1397,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1434,7 +1463,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsEnum3.baseline b/tests/baselines/reference/quickInfoDisplayPartsEnum3.baseline index b9f6483f63ae5..20eaa28bca5b9 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsEnum3.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsEnum3.baseline @@ -25,7 +25,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -90,7 +91,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -155,7 +157,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -220,7 +223,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -261,7 +265,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -290,7 +295,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -331,7 +337,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -360,7 +367,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -425,7 +433,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -466,7 +475,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -495,7 +505,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -560,7 +571,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -601,7 +613,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -630,7 +643,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -695,7 +709,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -732,7 +747,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -797,7 +813,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -862,7 +879,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -927,7 +945,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -968,7 +987,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1005,7 +1025,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1046,7 +1067,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1083,7 +1105,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1148,7 +1171,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1189,7 +1213,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1226,7 +1251,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1291,7 +1317,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1332,7 +1359,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1369,7 +1397,8 @@ "kind": "enumName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1434,7 +1463,8 @@ "kind": "numericLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsExternalModuleAlias_file0.baseline b/tests/baselines/reference/quickInfoDisplayPartsExternalModuleAlias_file0.baseline index 78667e7c6e6f4..efcd4b5ef0141 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsExternalModuleAlias_file0.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsExternalModuleAlias_file0.baseline @@ -53,7 +53,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -82,7 +83,8 @@ "kind": "aliasName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -139,7 +141,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -196,7 +199,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -225,7 +229,8 @@ "kind": "aliasName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -282,7 +287,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsExternalModules.baseline b/tests/baselines/reference/quickInfoDisplayPartsExternalModules.baseline index fa548470a762b..b036b939713ad 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsExternalModules.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsExternalModules.baseline @@ -25,7 +25,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -66,7 +67,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -115,7 +117,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -164,7 +167,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -193,7 +197,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -242,7 +247,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -271,7 +277,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -300,7 +307,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -337,7 +345,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -378,7 +387,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -435,7 +445,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -492,7 +503,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -521,7 +533,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -558,7 +571,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -615,7 +629,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -644,7 +659,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -681,7 +697,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsFunction.baseline b/tests/baselines/reference/quickInfoDisplayPartsFunction.baseline index 6ac80589629e7..0cc3039d88ae2 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsFunction.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsFunction.baseline @@ -153,7 +153,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -246,7 +247,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -339,7 +341,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -432,7 +435,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -525,7 +529,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -618,7 +623,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -711,7 +717,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -804,7 +811,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -961,7 +969,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1054,7 +1063,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1147,7 +1157,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1240,7 +1251,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1333,7 +1345,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1426,7 +1439,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsFunctionExpression.baseline b/tests/baselines/reference/quickInfoDisplayPartsFunctionExpression.baseline index ec943e3ac7c28..7b32170a92613 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsFunctionExpression.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsFunctionExpression.baseline @@ -57,7 +57,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -114,7 +115,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -171,7 +173,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -232,7 +235,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -289,7 +293,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -346,7 +351,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsInterface.baseline b/tests/baselines/reference/quickInfoDisplayPartsInterface.baseline index 43b9faa9540a5..dbd6726d1508a 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsInterface.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsInterface.baseline @@ -25,7 +25,8 @@ "kind": "interfaceName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -66,7 +67,8 @@ "kind": "interfaceName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -95,7 +97,8 @@ "kind": "interfaceName" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsInterfaceMembers.baseline b/tests/baselines/reference/quickInfoDisplayPartsInterfaceMembers.baseline index 4a82bd41d3044..b5b47d91b4925 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsInterfaceMembers.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsInterfaceMembers.baseline @@ -53,7 +53,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -118,7 +119,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -159,7 +161,8 @@ "kind": "interfaceName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -216,7 +219,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -257,7 +261,8 @@ "kind": "interfaceName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -322,7 +327,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -391,7 +397,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -432,7 +439,8 @@ "kind": "interfaceName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -509,7 +517,8 @@ "kind": "interfaceName" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline b/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline index 447ba587e1c85..70e4cfe74bbf8 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline @@ -73,7 +73,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -150,7 +151,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -235,7 +237,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -320,7 +323,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -413,7 +417,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -506,7 +511,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -607,7 +613,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -708,7 +715,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsLet.baseline b/tests/baselines/reference/quickInfoDisplayPartsLet.baseline index 2153c0b132bab..8d936b82fed5e 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsLet.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsLet.baseline @@ -37,7 +37,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -78,7 +79,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -119,7 +121,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -160,7 +163,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -201,7 +205,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -250,7 +255,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -291,7 +297,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -352,7 +359,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -413,7 +421,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -474,7 +483,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -535,7 +545,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -680,7 +691,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -825,7 +837,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -970,7 +983,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1075,7 +1089,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1180,7 +1195,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsLiteralLikeNames01.baseline b/tests/baselines/reference/quickInfoDisplayPartsLiteralLikeNames01.baseline index 47e5239c605d6..ecafa06a68a18 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsLiteralLikeNames01.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsLiteralLikeNames01.baseline @@ -65,7 +65,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -130,7 +131,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -195,7 +197,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -264,7 +267,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -333,7 +337,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -402,7 +407,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -467,7 +473,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -532,7 +539,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -597,7 +605,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -666,7 +675,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsLocalFunction.baseline b/tests/baselines/reference/quickInfoDisplayPartsLocalFunction.baseline index 65c3dc88390cb..6b531ff5d412f 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsLocalFunction.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsLocalFunction.baseline @@ -45,7 +45,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -210,7 +211,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -311,7 +313,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -412,7 +415,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -513,7 +517,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -614,7 +619,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -715,7 +721,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -816,7 +823,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -917,7 +925,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1082,7 +1091,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1183,7 +1193,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1284,7 +1295,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1385,7 +1397,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1486,7 +1499,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1587,7 +1601,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1636,7 +1651,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsModules.baseline b/tests/baselines/reference/quickInfoDisplayPartsModules.baseline index e2f04ea75e84b..4daeab1f5f354 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsModules.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsModules.baseline @@ -25,7 +25,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -66,7 +67,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -115,7 +117,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -164,7 +167,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -193,7 +197,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -242,7 +247,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -271,7 +277,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -300,7 +307,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -337,7 +345,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -378,7 +387,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -435,7 +445,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -492,7 +503,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -521,7 +533,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -558,7 +571,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -615,7 +629,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -644,7 +659,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -681,7 +697,8 @@ "kind": "moduleName" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline index c9bb71314dee3..c11d1193e2b63 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline @@ -154,6 +154,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "return", @@ -208,7 +209,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -257,7 +259,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -306,7 +309,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -363,7 +367,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -412,7 +417,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -461,7 +467,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -510,7 +517,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -567,7 +575,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeAlias.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeAlias.baseline index 49a97ac677374..bf329ef84aa80 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeAlias.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeAlias.baseline @@ -25,7 +25,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -70,7 +71,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -99,7 +101,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -140,7 +143,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -185,7 +189,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -234,7 +239,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline index 48bd280a1b505..77fe2c8e22605 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline @@ -37,7 +37,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -102,7 +103,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -191,7 +193,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -240,7 +243,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -305,7 +309,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -434,7 +439,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -579,7 +585,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -628,7 +635,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -773,7 +781,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -822,7 +831,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -887,7 +897,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -936,7 +947,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -989,7 +1001,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1078,7 +1091,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1127,7 +1141,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1168,7 +1183,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1221,7 +1237,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1350,7 +1367,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1419,7 +1437,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1512,7 +1531,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1553,7 +1573,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1670,7 +1691,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1747,7 +1769,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1840,7 +1863,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2025,7 +2049,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2226,7 +2251,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2267,7 +2293,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2344,7 +2371,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2545,7 +2573,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2622,7 +2651,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2715,7 +2745,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2792,7 +2823,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2857,7 +2889,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2982,7 +3015,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3035,7 +3069,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3084,7 +3119,8 @@ "kind": "className" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3153,7 +3189,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3218,7 +3255,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3407,7 +3445,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3460,7 +3499,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3513,7 +3553,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunction.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunction.baseline index 278e9396fb69c..04c382b94da8a 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunction.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunction.baseline @@ -73,7 +73,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -174,7 +175,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -223,7 +225,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -324,7 +327,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -373,7 +377,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -450,7 +455,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -543,7 +549,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -660,7 +667,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -725,7 +733,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -842,7 +851,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -907,7 +917,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -984,7 +995,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunctionLikeInTypeAlias.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunctionLikeInTypeAlias.baseline index 50f0ac16a1cf0..ac77618566bda 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunctionLikeInTypeAlias.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunctionLikeInTypeAlias.baseline @@ -69,7 +69,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -142,7 +143,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -215,7 +217,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline index 715811f9918a1..67a125bac8bf6 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline @@ -37,7 +37,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -102,7 +103,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -231,7 +233,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -280,7 +283,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -409,7 +413,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -458,7 +463,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -523,7 +529,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -652,7 +659,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -773,7 +781,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -822,7 +831,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -943,7 +953,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -992,7 +1003,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1057,7 +1069,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1178,7 +1191,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1307,7 +1321,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1452,7 +1467,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1501,7 +1517,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1646,7 +1663,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1695,7 +1713,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1760,7 +1779,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1905,7 +1925,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1958,7 +1979,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1999,7 +2021,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2128,7 +2151,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2249,7 +2273,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2302,7 +2327,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2431,7 +2457,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2500,7 +2527,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2593,7 +2621,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2634,7 +2663,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2791,7 +2821,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2832,7 +2863,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -2909,7 +2941,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3066,7 +3099,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3143,7 +3177,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3236,7 +3271,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3393,7 +3429,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3542,7 +3579,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3583,7 +3621,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3660,7 +3699,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3809,7 +3849,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3886,7 +3927,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -3979,7 +4021,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -4128,7 +4171,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -4313,7 +4357,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -4514,7 +4559,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -4555,7 +4601,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -4632,7 +4679,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -4833,7 +4881,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -4910,7 +4959,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5003,7 +5053,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5204,7 +5255,8 @@ "kind": "typeParameterName" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5269,7 +5321,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5338,7 +5391,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5379,7 +5433,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5556,7 +5611,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5609,7 +5665,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5662,7 +5719,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5831,7 +5889,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5884,7 +5943,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -5937,7 +5997,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -6002,7 +6063,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -6191,7 +6253,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -6244,7 +6307,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -6297,7 +6361,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInTypeAlias.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInTypeAlias.baseline index e6f1d4512889b..060fcb3278ffd 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInTypeAlias.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInTypeAlias.baseline @@ -61,7 +61,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -134,7 +135,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -207,7 +209,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -288,7 +291,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -377,7 +381,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -466,7 +471,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVar.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.baseline index b56e1b315425a..2fd7ef79ccf26 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsVar.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsVar.baseline @@ -37,7 +37,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -86,7 +87,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -127,7 +129,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -168,7 +171,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -217,7 +221,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -278,7 +283,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -339,7 +345,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -400,7 +407,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -461,7 +469,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -606,7 +615,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -751,7 +761,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -896,7 +907,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1001,7 +1013,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1106,7 +1119,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline index dfe65565790aa..0cc4b6119cb68 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline @@ -37,7 +37,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -86,7 +87,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -127,7 +129,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -168,7 +171,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -217,7 +221,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -278,7 +283,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -339,7 +345,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -400,7 +407,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -461,7 +469,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -606,7 +615,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -751,7 +761,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -896,7 +907,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1001,7 +1013,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1106,7 +1119,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline index 249772f416ece..a80beebaaa3fa 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline @@ -37,7 +37,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -86,7 +87,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -127,7 +129,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -168,7 +171,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -217,7 +221,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -278,7 +283,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -339,7 +345,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -400,7 +407,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -461,7 +469,8 @@ "kind": "keyword" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -606,7 +615,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -751,7 +761,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -896,7 +907,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1001,7 +1013,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -1106,7 +1119,8 @@ "kind": "punctuation" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVarWithStringTypes01.baseline b/tests/baselines/reference/quickInfoDisplayPartsVarWithStringTypes01.baseline index 3c46a6ba6bd8b..075eea440c211 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsVarWithStringTypes01.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsVarWithStringTypes01.baseline @@ -37,7 +37,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -78,7 +79,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } }, { @@ -135,7 +137,8 @@ "kind": "stringLiteral" } ], - "documentation": [] + "documentation": [], + "links": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoForJSDocCodefence.baseline b/tests/baselines/reference/quickInfoForJSDocCodefence.baseline index a88755fefc947..231a33fae311b 100644 --- a/tests/baselines/reference/quickInfoForJSDocCodefence.baseline +++ b/tests/baselines/reference/quickInfoForJSDocCodefence.baseline @@ -46,6 +46,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "example", @@ -101,6 +102,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "example", diff --git a/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline b/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline index 25b2f8fe9c0fa..8a669bc31edb3 100644 --- a/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline +++ b/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline @@ -46,6 +46,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "example", @@ -101,6 +102,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "example", @@ -156,6 +158,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "example", @@ -211,6 +214,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "func" @@ -269,6 +273,7 @@ } ], "documentation": [], + "links": [], "tags": [ { "name": "func" diff --git a/tests/baselines/reference/quickInfoJsDocTags.baseline b/tests/baselines/reference/quickInfoJsDocTags.baseline index 5717757a38294..b293725502ccc 100644 --- a/tests/baselines/reference/quickInfoJsDocTags.baseline +++ b/tests/baselines/reference/quickInfoJsDocTags.baseline @@ -67,6 +67,7 @@ "kind": "text" } ], + "links": [], "tags": [ { "name": "author", diff --git a/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline b/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline index b03ca277801b2..cd9e402001d19 100644 --- a/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline +++ b/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline @@ -54,7 +54,8 @@ "text": "A language id, like `typescript`.", "kind": "text" } - ] + ], + "links": [] } } ] \ No newline at end of file diff --git a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts index a9ea76c1f97b8..a29064b6ca849 100644 --- a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts +++ b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts @@ -14,7 +14,13 @@ //// import a = require("./a"); //// a.fo/*2*/ -const entry = (text: string): FourSlashInterface.ExpectedCompletionEntry => ({ name: "foo", text, documentation: "Modify the parameter", tags: [{ name: "param", text: "p1", links: undefined }] }); +const entry = (text: string): FourSlashInterface.ExpectedCompletionEntry => ({ + name: "foo", + text, + documentation: "Modify the parameter", + links: [], + tags: [{ name: "param", text: "p1", links: [] }] +}); verify.completions( { marker: "1", includes: entry("var foo: (p1: string) => void") }, { marker: "2", exact: entry("(alias) var foo: (p1: string) => void\nimport a.foo") }, diff --git a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts index afec3b60e8c7f..22900942a9271 100644 --- a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts +++ b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts @@ -15,6 +15,18 @@ //// a.fo/*2*/ verify.completions( - { marker: "1", includes: { name: "foo", text: "var foo: (p1: string) => void", documentation: "Modify the parameter", tags: [{ name: "param", text: "p1", links: undefined }] } }, - { marker: "2", exact: { name: "foo", text: "(alias) var foo: (p1: string) => void\nimport a.foo", documentation: "Modify the parameter", tags: [{ name: "param", text: "p1", links: undefined }] } }, + { marker: "1", includes: { + name: "foo", + text: "var foo: (p1: string) => void", + documentation: "Modify the parameter", + links: [], + tags: [{ name: "param", text: "p1", links: [] }] + } }, + { marker: "2", exact: { + name: "foo", + text: "(alias) var foo: (p1: string) => void\nimport a.foo", + documentation: "Modify the parameter", + links: [], + tags: [{ name: "param", text: "p1", links: [] }] + } }, ); From 36b1224d6f3ee02a6d0ef43255712d6e89cf37c1 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 15 Dec 2020 11:40:46 -0800 Subject: [PATCH 25/44] add string back to comment type in node constructors --- src/compiler/factory/nodeFactory.ts | 54 ++++---- src/compiler/types.ts | 84 ++++++------ .../reference/api/tsserverlibrary.d.ts | 122 +++++++++--------- tests/baselines/reference/api/typescript.d.ts | 122 +++++++++--------- 4 files changed, 191 insertions(+), 191 deletions(-) diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 2875d68e77ed3..64fbad7551e77 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -4204,15 +4204,15 @@ namespace ts { } // @api - function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: JSDocCommentText | undefined) { + function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: string | JSDocCommentText | undefined) { const node = createBaseNode(kind); node.tagName = tagName; - node.comment = comment; + node.comment = typeof comment === "string" ? createJSDocCommentText(comment) : comment; return node; } // @api - function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText): JSDocTemplateTag { + function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText): JSDocTemplateTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTemplateTag, tagName ?? createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); @@ -4220,7 +4220,7 @@ namespace ts { } // @api - function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocCommentText | undefined): JSDocTemplateTag { + function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | JSDocCommentText | undefined): JSDocTemplateTag { return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters @@ -4230,7 +4230,7 @@ namespace ts { } // @api - function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocTypedefTag { + function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocTypedefTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTypedefTag, tagName ?? createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4239,7 +4239,7 @@ namespace ts { } // @api - function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocTypedefTag { + function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocTypedefTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4249,7 +4249,7 @@ namespace ts { } // @api - function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocParameterTag { + function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocParameterTag { const node = createBaseJSDocTag(SyntaxKind.JSDocParameterTag, tagName ?? createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4259,7 +4259,7 @@ namespace ts { } // @api - function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocParameterTag { + function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocParameterTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4271,7 +4271,7 @@ namespace ts { } // @api - function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocPropertyTag { + function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocPropertyTag { const node = createBaseJSDocTag(SyntaxKind.JSDocPropertyTag, tagName ?? createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4281,7 +4281,7 @@ namespace ts { } // @api - function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocPropertyTag { + function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocPropertyTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4293,7 +4293,7 @@ namespace ts { } // @api - function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocCallbackTag { + function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocCallbackTag { const node = createBaseJSDocTag(SyntaxKind.JSDocCallbackTag, tagName ?? createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4302,7 +4302,7 @@ namespace ts { } // @api - function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocCallbackTag { + function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocCallbackTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4312,14 +4312,14 @@ namespace ts { } // @api - function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocCommentText): JSDocAugmentsTag { + function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | JSDocCommentText): JSDocAugmentsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocAugmentsTag, tagName ?? createIdentifier("augments"), comment); node.class = className; return node; } // @api - function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: JSDocCommentText | undefined): JSDocAugmentsTag { + function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: string | JSDocCommentText | undefined): JSDocAugmentsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4328,21 +4328,21 @@ namespace ts { } // @api - function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocCommentText): JSDocImplementsTag { + function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | JSDocCommentText): JSDocImplementsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocImplementsTag, tagName ?? createIdentifier("implements"), comment); node.class = className; return node; } // @api - function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag { + function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag { const node = createBaseJSDocTag(SyntaxKind.JSDocSeeTag, tagName ?? createIdentifier("see"), comment); node.name = name; return node; } // @api - function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag { + function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag { return node.tagName !== tagName || node.name !== name || node.comment !== comment @@ -4379,7 +4379,7 @@ namespace ts { } // @api - function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: JSDocCommentText | undefined): JSDocImplementsTag { + function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: string | JSDocCommentText | undefined): JSDocImplementsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4395,7 +4395,7 @@ namespace ts { // createJSDocProtectedTag // createJSDocReadonlyTag // createJSDocDeprecatedTag - function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: JSDocCommentText) { + function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: string | JSDocCommentText) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); return node; } @@ -4408,7 +4408,7 @@ namespace ts { // updateJSDocProtectedTag // updateJSDocReadonlyTag // updateJSDocDeprecatedTag - function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: JSDocCommentText | undefined) { + function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: string | JSDocCommentText | undefined) { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) : @@ -4420,7 +4420,7 @@ namespace ts { // createJSDocReturnTag // createJSDocThisTag // createJSDocEnumTag - function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText) { + function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | JSDocCommentText) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); node.typeExpression = typeExpression; return node; @@ -4431,7 +4431,7 @@ namespace ts { // updateJSDocReturnTag // updateJSDocThisTag // updateJSDocEnumTag - function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined) { + function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined) { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment @@ -4440,13 +4440,13 @@ namespace ts { } // @api - function createJSDocUnknownTag(tagName: Identifier, comment?: JSDocCommentText): JSDocUnknownTag { + function createJSDocUnknownTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocUnknownTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTag, tagName, comment); return node; } // @api - function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocCommentText | undefined): JSDocUnknownTag { + function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | JSDocCommentText | undefined): JSDocUnknownTag { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocUnknownTag(tagName, comment), node) @@ -4470,15 +4470,15 @@ namespace ts { } // @api - function createJSDocComment(comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) { + function createJSDocComment(comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) { const node = createBaseNode(SyntaxKind.JSDocComment); - node.comment = comment; + node.comment = typeof comment === "string" ? createJSDocCommentText(comment) : comment; node.tags = asNodeArray(tags); return node; } // @api - function updateJSDocComment(node: JSDoc, comment: JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined) { + function updateJSDocComment(node: JSDoc, comment: string | JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined) { return node.comment !== comment || node.tags !== tags ? update(createJSDocComment(comment, tags), node) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 3e6b02d6d845d..d641a65ec7650 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7151,50 +7151,50 @@ namespace ts { updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocCommentText | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocCommentText): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocCommentText | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocCommentText): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocCommentText | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: JSDocCommentText): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocCommentText | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | JSDocCommentText | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | JSDocCommentText): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | JSDocCommentText | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | JSDocCommentText): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | JSDocCommentText | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | JSDocCommentText | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText; updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText; - createJSDocComment(comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocComment(comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: string | JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; // // JSX diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 9efd2c666467f..91c015afe54b9 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3468,50 +3468,50 @@ declare namespace ts { updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocCommentText | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocCommentText): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocCommentText | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocCommentText): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocCommentText | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: JSDocCommentText): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocCommentText | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | JSDocCommentText | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | JSDocCommentText): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | JSDocCommentText | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | JSDocCommentText): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | JSDocCommentText | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | JSDocCommentText | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText; updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText; - createJSDocComment(comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocComment(comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: string | JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -10612,51 +10612,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: JSDocCommentText | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | JSDocCommentText | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocCommentText | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | JSDocCommentText | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: JSDocCommentText | undefined) => JSDocAugmentsTag; + }, comment?: string | JSDocCommentText | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocCommentText | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | JSDocCommentText | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocCommentText | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | JSDocCommentText | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocCommentText | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: JSDocCommentText | undefined) => JSDocImplementsTag; + }, comment?: string | JSDocCommentText | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: JSDocCommentText | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: string | JSDocCommentText | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index f2a0a0d191093..ac0fc4285062f 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3468,50 +3468,50 @@ declare namespace ts { updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: JSDocCommentText | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: JSDocCommentText): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: JSDocCommentText | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: JSDocCommentText): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: JSDocCommentText | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: JSDocCommentText | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: JSDocCommentText): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: JSDocCommentText | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: JSDocCommentText): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: JSDocCommentText | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: JSDocCommentText): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: JSDocCommentText | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: JSDocCommentText): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: JSDocCommentText | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: JSDocCommentText): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: JSDocCommentText | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: JSDocCommentText): JSDocDeprecatedTag; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | JSDocCommentText | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | JSDocCommentText): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | JSDocCommentText | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | JSDocCommentText): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | JSDocCommentText | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | JSDocCommentText | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText; updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText; - createJSDocComment(comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocComment(comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: string | JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -6929,51 +6929,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: JSDocCommentText | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | JSDocCommentText | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocCommentText | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | JSDocCommentText | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: JSDocCommentText | undefined) => JSDocAugmentsTag; + }, comment?: string | JSDocCommentText | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: JSDocCommentText | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: JSDocCommentText | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocCommentText | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | JSDocCommentText | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: JSDocCommentText | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | JSDocCommentText | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: JSDocCommentText | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: JSDocCommentText | undefined) => JSDocImplementsTag; + }, comment?: string | JSDocCommentText | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: JSDocCommentText | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: JSDocCommentText | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: string | JSDocCommentText | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ From bfefd33e46d8da2c5bcc73e71c8cedb7adf03e2f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:22:21 -0800 Subject: [PATCH 26/44] Full parse of link tags and jsdoc comment text - Doesn't pass fourslash yet, I'm going to switch to baselines for failures there. - Still needs some work on the protocol to convert file+offset to file+line+offset. --- src/compiler/checker.ts | 4 +- src/compiler/emitter.ts | 12 +- src/compiler/factory/nodeFactory.ts | 87 ++- src/compiler/parser.ts | 118 ++-- src/compiler/types.ts | 104 ++-- src/compiler/utilitiesPublic.ts | 8 +- src/deprecatedCompat/deprecations.ts | 2 +- src/harness/client.ts | 42 +- src/server/protocol.ts | 108 +++- src/server/session.ts | 85 +-- src/services/codefixes/inferFromUsage.ts | 4 +- src/services/completions.ts | 8 +- src/services/jsDoc.ts | 70 +-- src/services/services.ts | 24 +- src/services/signatureHelp.ts | 6 +- src/services/symbolDisplay.ts | 9 +- src/services/types.ts | 24 +- src/services/utilities.ts | 19 + src/testRunner/unittests/publicApi.ts | 4 +- .../unittests/tsserver/completions.ts | 3 +- .../unittests/tsserver/dynamicFiles.ts | 1 - src/testRunner/unittests/tsserver/jsdocTag.ts | 61 ++- ...Correctly.@@ does not start a new tag.json | 15 +- ...ocComments.parsesCorrectly.@link tags.json | 505 ++++++++++-------- ...ly.Initial email address is not a tag.json | 15 +- ...esCorrectly.Initial star is not a tag.json | 15 +- ...ectly.Initial star space is not a tag.json | 15 +- ...ts.parsesCorrectly.Nested @param tags.json | 30 +- ...parsesCorrectly.argSynonymForParamTag.json | 15 +- ...sCorrectly.argumentSynonymForParamTag.json | 15 +- ...parsesCorrectly.asteriskAfterPreamble.json | 15 +- ...DocComments.parsesCorrectly.authorTag.json | 325 ++++++++--- ...sCorrectly.consecutive newline tokens.json | 15 +- ...less-than and greater-than characters.json | 15 +- ...ly.no space before @ is not a new tag.json | 45 +- ...DocComments.parsesCorrectly.paramTag1.json | 15 +- ...arsesCorrectly.paramTagBracketedName1.json | 15 +- ...arsesCorrectly.paramTagBracketedName2.json | 15 +- ...parsesCorrectly.paramTagNameThenType2.json | 15 +- ...ocComments.parsesCorrectly.returnTag2.json | 15 +- ...Comments.parsesCorrectly.templateTag6.json | 15 +- ...mments.parsesCorrectly.threeAsterisks.json | 15 +- .../reference/api/tsserverlibrary.d.ts | 264 +++++---- tests/baselines/reference/api/typescript.d.ts | 167 +++--- .../reference/jsDocAliasQuickInfo.baseline | 24 +- tests/baselines/reference/jsDocTags.baseline | 80 ++- tests/baselines/reference/jsDocTypeTag1.js | 104 +++- tests/baselines/reference/jsDocTypeTag2.js | 96 +++- tests/baselines/reference/jsDocTypedef1.js | 11 +- tests/baselines/reference/jsdocLink1.baseline | 79 +-- tests/baselines/reference/jsdocLink2.baseline | 79 +-- tests/baselines/reference/jsdocLink3.baseline | 79 +-- ...splayPartsArrowFunctionExpression.baseline | 24 +- .../quickInfoDisplayPartsClass.baseline | 15 +- ...ickInfoDisplayPartsClassAccessors.baseline | 96 ++-- ...kInfoDisplayPartsClassConstructor.baseline | 78 +-- .../quickInfoDisplayPartsClassMethod.baseline | 48 +- ...uickInfoDisplayPartsClassProperty.baseline | 48 +- .../quickInfoDisplayPartsConst.baseline | 48 +- .../quickInfoDisplayPartsEnum1.baseline | 90 ++-- .../quickInfoDisplayPartsEnum2.baseline | 90 ++-- .../quickInfoDisplayPartsEnum3.baseline | 90 ++-- ...layPartsExternalModuleAlias_file0.baseline | 18 +- ...ckInfoDisplayPartsExternalModules.baseline | 51 +- .../quickInfoDisplayPartsFunction.baseline | 42 +- ...nfoDisplayPartsFunctionExpression.baseline | 18 +- .../quickInfoDisplayPartsInterface.baseline | 9 +- ...kInfoDisplayPartsInterfaceMembers.baseline | 27 +- ...foDisplayPartsInternalModuleAlias.baseline | 24 +- .../quickInfoDisplayPartsLet.baseline | 48 +- ...nfoDisplayPartsLiteralLikeNames01.baseline | 30 +- ...uickInfoDisplayPartsLocalFunction.baseline | 48 +- .../quickInfoDisplayPartsModules.baseline | 51 +- .../quickInfoDisplayPartsParameters.baseline | 32 +- .../quickInfoDisplayPartsTypeAlias.baseline | 18 +- ...oDisplayPartsTypeParameterInClass.baseline | 123 ++--- ...splayPartsTypeParameterInFunction.baseline | 36 +- ...arameterInFunctionLikeInTypeAlias.baseline | 9 +- ...playPartsTypeParameterInInterface.baseline | 195 +++---- ...playPartsTypeParameterInTypeAlias.baseline | 18 +- .../quickInfoDisplayPartsVar.baseline | 42 +- ...quickInfoDisplayPartsVar.shims-pp.baseline | 42 +- .../quickInfoDisplayPartsVar.shims.baseline | 42 +- ...oDisplayPartsVarWithStringTypes01.baseline | 9 +- .../quickInfoForJSDocCodefence.baseline | 16 +- .../quickInfoForJSDocUnknownTag.baseline | 40 +- .../reference/quickInfoJsDocTags1.baseline | 104 +++- .../reference/quickInfoJsDocTags3.baseline | 60 ++- .../reference/quickInfoJsDocTags4.baseline | 60 ++- .../reference/quickInfoJsDocTags5.js | 60 ++- .../reference/quickInfoJsDocTags6.js | 60 ++- ...rtiesWithIdenticalJSDocComments01.baseline | 3 +- 92 files changed, 2701 insertions(+), 2192 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e49d2a7f3c3b4..d91ee3b311093 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5146,7 +5146,7 @@ namespace ts { function preserveCommentsOn(node: T) { if (some(propertySymbol.declarations, d => d.kind === SyntaxKind.JSDocPropertyTag)) { const d = find(propertySymbol.declarations, d => d.kind === SyntaxKind.JSDocPropertyTag)! as JSDocPropertyTag; - const commentText = d.comment?.text; + const commentText = getTextOfJSDocComment(d.comment) if (commentText) { setSyntheticLeadingComments(node, [{ kind: SyntaxKind.MultiLineCommentTrivia, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); } @@ -6659,7 +6659,7 @@ namespace ts { const typeParams = getSymbolLinks(symbol).typeParameters; const typeParamDecls = map(typeParams, p => typeParameterToDeclaration(p, context)); const jsdocAliasDecl = find(symbol.declarations, isJSDocTypeAlias); - const commentText = jsdocAliasDecl ? jsdocAliasDecl.comment?.text || jsdocAliasDecl.parent.comment?.text : undefined; + const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : undefined); const oldFlags = context.flags; context.flags |= NodeBuilderFlags.InTypeAlias; const oldEnclosingDecl = context.enclosingDeclaration; diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 776c64bc87b24..93faf94ecd054 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3578,8 +3578,9 @@ namespace ts { // function emitJSDoc(node: JSDoc) { write("/**"); - if (node.comment?.text) { - const lines = node.comment.text.split(/\r\n?|\n/g); + const text = getTextOfJSDocComment(node.comment) + if (text) { + const lines = text.split(/\r\n?|\n/g); for (const line of lines) { writeLine(); writeSpace(); @@ -3718,10 +3719,11 @@ namespace ts { emit(tagName); } - function emitJSDocComment(comment: JSDocCommentText | undefined) { - if (comment?.text) { + function emitJSDocComment(comment: NodeArray | undefined) { + const text = getTextOfJSDocComment(comment) + if (text) { writeSpace(); - write(comment.text); + write(text); } } diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 9cb12b3158327..c41c9a69bb1f1 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -34,10 +34,10 @@ namespace ts { const getJSDocPrimaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => () => createJSDocPrimaryTypeWorker(kind)); const getJSDocUnaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => (type: T["type"]) => createJSDocUnaryTypeWorker(kind, type)); const getJSDocUnaryTypeUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, type: T["type"]) => updateJSDocUnaryTypeWorker(kind, node, type)); - const getJSDocSimpleTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, comment?: JSDocCommentText) => createJSDocSimpleTagWorker(kind, tagName, comment)); - const getJSDocSimpleTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, comment?: JSDocCommentText) => updateJSDocSimpleTagWorker(kind, node, tagName, comment)); - const getJSDocTypeLikeTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText) => createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment)); - const getJSDocTypeLikeTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: JSDocCommentText) => updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment)); + const getJSDocSimpleTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, comment?: NodeArray) => createJSDocSimpleTagWorker(kind, tagName, comment)); + const getJSDocSimpleTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, comment?: NodeArray) => updateJSDocSimpleTagWorker(kind, node, tagName, comment)); + const getJSDocTypeLikeTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: NodeArray) => createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment)); + const getJSDocTypeLikeTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: NodeArray) => updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment)); const factory: NodeFactory = { get parenthesizer() { return parenthesizerRules(); }, @@ -345,8 +345,8 @@ namespace ts { updateJSDocSeeTag, createJSDocNameReference, updateJSDocNameReference, - createJSDocLinkNode, - updateJSDocLinkNode, + createJSDocLink, + updateJSDocLink, // lazily load factory members for JSDoc tags with similar structure get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(SyntaxKind.JSDocTypeTag); }, get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(SyntaxKind.JSDocTypeTag); }, @@ -372,8 +372,8 @@ namespace ts { get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocDeprecatedTag); }, createJSDocUnknownTag, updateJSDocUnknownTag, - createJSDocCommentText, - updateJSDocCommentText, + createJSDocText, + updateJSDocText, createJSDocComment, updateJSDocComment, createJsxElement, @@ -4238,15 +4238,15 @@ namespace ts { } // @api - function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: string | JSDocCommentText | undefined) { + function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: string | NodeArray | undefined) { const node = createBaseNode(kind); node.tagName = tagName; - node.comment = typeof comment === "string" ? createJSDocCommentText(comment) : comment; + node.comment = typeof comment === "string" ? createNodeArray([createJSDocText(comment)]) : comment; return node; } // @api - function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText): JSDocTemplateTag { + function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTemplateTag, tagName ?? createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); @@ -4254,7 +4254,7 @@ namespace ts { } // @api - function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | JSDocCommentText | undefined): JSDocTemplateTag { + function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag { return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters @@ -4264,7 +4264,7 @@ namespace ts { } // @api - function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocTypedefTag { + function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTypedefTag, tagName ?? createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4273,7 +4273,7 @@ namespace ts { } // @api - function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocTypedefTag { + function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4283,7 +4283,7 @@ namespace ts { } // @api - function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocParameterTag { + function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag { const node = createBaseJSDocTag(SyntaxKind.JSDocParameterTag, tagName ?? createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4293,7 +4293,7 @@ namespace ts { } // @api - function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocParameterTag { + function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4305,7 +4305,7 @@ namespace ts { } // @api - function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocPropertyTag { + function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag { const node = createBaseJSDocTag(SyntaxKind.JSDocPropertyTag, tagName ?? createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4315,7 +4315,7 @@ namespace ts { } // @api - function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocPropertyTag { + function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4327,7 +4327,7 @@ namespace ts { } // @api - function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocCallbackTag { + function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag { const node = createBaseJSDocTag(SyntaxKind.JSDocCallbackTag, tagName ?? createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4336,7 +4336,7 @@ namespace ts { } // @api - function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocCallbackTag { + function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4346,14 +4346,14 @@ namespace ts { } // @api - function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | JSDocCommentText): JSDocAugmentsTag { + function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocAugmentsTag, tagName ?? createIdentifier("augments"), comment); node.class = className; return node; } // @api - function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: string | JSDocCommentText | undefined): JSDocAugmentsTag { + function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4362,21 +4362,21 @@ namespace ts { } // @api - function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | JSDocCommentText): JSDocImplementsTag { + function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocImplementsTag, tagName ?? createIdentifier("implements"), comment); node.class = className; return node; } // @api - function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag { + function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag { const node = createBaseJSDocTag(SyntaxKind.JSDocSeeTag, tagName ?? createIdentifier("see"), comment); node.name = name; return node; } // @api - function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag { + function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag { return node.tagName !== tagName || node.name !== name || node.comment !== comment @@ -4399,21 +4399,22 @@ namespace ts { } // @api - function createJSDocLinkNode(name: EntityName): JSDocLink { + function createJSDocLink(name: EntityName | undefined, text: string): JSDocLink { const node = createBaseNode(SyntaxKind.JSDocLink); node.name = name; + node.text = text; return node; } // @api - function updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink { + function updateJSDocLink(node: JSDocLink, name: EntityName | undefined, text: string): JSDocLink { return node.name !== name - ? update(createJSDocLinkNode(name), node) + ? update(createJSDocLink(name, text), node) : node; } // @api - function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: string | JSDocCommentText | undefined): JSDocImplementsTag { + function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4429,7 +4430,7 @@ namespace ts { // createJSDocProtectedTag // createJSDocReadonlyTag // createJSDocDeprecatedTag - function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: string | JSDocCommentText) { + function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: string | NodeArray) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); return node; } @@ -4442,7 +4443,7 @@ namespace ts { // updateJSDocProtectedTag // updateJSDocReadonlyTag // updateJSDocDeprecatedTag - function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: string | JSDocCommentText | undefined) { + function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: string | NodeArray | undefined) { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) : @@ -4454,7 +4455,7 @@ namespace ts { // createJSDocReturnTag // createJSDocThisTag // createJSDocEnumTag - function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | JSDocCommentText) { + function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); node.typeExpression = typeExpression; return node; @@ -4465,7 +4466,7 @@ namespace ts { // updateJSDocReturnTag // updateJSDocThisTag // updateJSDocEnumTag - function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined) { + function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined) { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment @@ -4474,13 +4475,13 @@ namespace ts { } // @api - function createJSDocUnknownTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocUnknownTag { + function createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTag, tagName, comment); return node; } // @api - function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | JSDocCommentText | undefined): JSDocUnknownTag { + function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocUnknownTag(tagName, comment), node) @@ -4488,31 +4489,29 @@ namespace ts { } // @api - function createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText { - const node = createBaseNode(SyntaxKind.JSDocCommentText); + function createJSDocText(text: string): JSDocText { + const node = createBaseNode(SyntaxKind.JSDocText); node.text = text; - node.links = asNodeArray(links); return node; } // @api - function updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText { + function updateJSDocText(node: JSDocText, text: string): JSDocText { return node.text !== text - || node.links !== links - ? update(createJSDocCommentText(text, links), node) + ? update(createJSDocText(text), node) : node; } // @api - function createJSDocComment(comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) { + function createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined) { const node = createBaseNode(SyntaxKind.JSDocComment); - node.comment = typeof comment === "string" ? createJSDocCommentText(comment) : comment; + node.comment = typeof comment === "string" ? createNodeArray([createJSDocText(comment)]) : comment; node.tags = asNodeArray(tags); return node; } // @api - function updateJSDocComment(node: JSDoc, comment: string | JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined) { + function updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined) { return node.comment !== comment || node.tags !== tags ? update(createJSDocComment(comment, tags), node) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 651726c0ac084..58edb4d851c21 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -481,14 +481,12 @@ namespace ts { return visitNodes(cbNode, cbNodes, (node).parameters) || visitNode(cbNode, (node).type); case SyntaxKind.JSDocComment: - return visitNode(cbNode, (node as JSDoc).comment) - || visitNodes(cbNode, cbNodes, (node).tags); - case SyntaxKind.JSDocCommentText: - return visitNodes(cbNode, cbNodes, (node as JSDocCommentText).links); + return visitNodes(cbNode, cbNodes, (node as JSDoc).comment) + || visitNodes(cbNode, cbNodes, (node as JSDoc).tags); case SyntaxKind.JSDocSeeTag: return visitNode(cbNode, (node as JSDocSeeTag).tagName) || visitNode(cbNode, (node as JSDocSeeTag).name) || - visitNode(cbNode, (node as JSDocTag).comment); + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment); case SyntaxKind.JSDocNameReference: return visitNode(cbNode, (node as JSDocNameReference).name); case SyntaxKind.JSDocParameterTag: @@ -497,47 +495,47 @@ namespace ts { ((node as JSDocPropertyLikeTag).isNameFirst ? visitNode(cbNode, (node).name) || visitNode(cbNode, (node).typeExpression) || - visitNode(cbNode, (node as JSDocTag).comment) + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment) : visitNode(cbNode, (node).typeExpression) || visitNode(cbNode, (node).name)) || - visitNode(cbNode, (node as JSDocTag).comment); + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment); case SyntaxKind.JSDocAuthorTag: return visitNode(cbNode, (node as JSDocTag).tagName); case SyntaxKind.JSDocImplementsTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node).class) || - visitNode(cbNode, (node as JSDocTag).comment); + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment); case SyntaxKind.JSDocAugmentsTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node).class) || - visitNode(cbNode, (node as JSDocTag).comment); + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment); case SyntaxKind.JSDocTemplateTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node).constraint) || visitNodes(cbNode, cbNodes, (node).typeParameters) || - visitNode(cbNode, (node as JSDocTag).comment); + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment); case SyntaxKind.JSDocTypedefTag: return visitNode(cbNode, (node as JSDocTag).tagName) || ((node as JSDocTypedefTag).typeExpression && (node as JSDocTypedefTag).typeExpression!.kind === SyntaxKind.JSDocTypeExpression ? visitNode(cbNode, (node).typeExpression) || visitNode(cbNode, (node).fullName) || - visitNode(cbNode, (node as JSDocTag).comment) + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment) : visitNode(cbNode, (node).fullName) || visitNode(cbNode, (node).typeExpression)) || - visitNode(cbNode, (node as JSDocTag).comment); + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment); case SyntaxKind.JSDocCallbackTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocCallbackTag).fullName) || visitNode(cbNode, (node as JSDocCallbackTag).typeExpression) || - visitNode(cbNode, (node as JSDocTag).comment); + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment); case SyntaxKind.JSDocReturnTag: case SyntaxKind.JSDocTypeTag: case SyntaxKind.JSDocThisTag: case SyntaxKind.JSDocEnumTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocReturnTag | JSDocTypeTag | JSDocThisTag | JSDocEnumTag).typeExpression) || - visitNode(cbNode, (node as JSDocTag).comment); + visitNodes(cbNode, cbNodes, (node as JSDocTag).comment); case SyntaxKind.JSDocSignature: return forEach((node).typeParameters, cbNode) || forEach((node).parameters, cbNode) || @@ -553,7 +551,7 @@ namespace ts { case SyntaxKind.JSDocProtectedTag: case SyntaxKind.JSDocReadonlyTag: return visitNode(cbNode, (node as JSDocTag).tagName) - || visitNode(cbNode, (node as JSDocTag).comment); + || visitNodes(cbNode, cbNodes, (node as JSDocTag).comment); case SyntaxKind.PartiallyEmittedExpression: return visitNode(cbNode, (node).expression); } @@ -7313,11 +7311,10 @@ namespace ts { let tags: JSDocTag[]; let tagsPos: number; let tagsEnd: number; - let linksPos: number; - let linksEnd: number; + let linkEnd: number; let commentsPos: number | undefined; - const comments: string[] = []; - const links: JSDocLink[] = []; + let comments: string[] = []; + const parts: (JSDocLink | JSDocText)[] = []; // + 3 for leading /**, - 5 in total for /** */ return scanner.scanRange(start + 3, length - 5, () => { @@ -7392,13 +7389,17 @@ namespace ts { break loop; case SyntaxKind.OpenBraceToken: state = JSDocState.SavingComments; + const commentEnd = scanner.getStartPos(); const linkStart = scanner.getTextPos() - 1; const link = parseLink(linkStart); if (link) { - links.push(link); - if (!linksPos) linksPos = linkStart; - linksEnd = scanner.getTextPos(); - pushComment(scanner.getText().slice(link.pos, link.end)); + if (!linkEnd) { + removeLeadingNewlines(comments) + } + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? start, commentEnd)) + parts.push(link); + comments = [] + linkEnd = scanner.getTextPos(); break; } // fallthrough if it's not a {@link sequence @@ -7412,9 +7413,13 @@ namespace ts { } nextTokenJSDoc(); } - removeLeadingNewlines(comments); removeTrailingWhitespace(comments); - return createJSDocComment(); + if (comments.length) { + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? start, commentsPos)) + } + if (parts.length && tags) Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set"); + const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); + return finishNode(factory.createJSDocComment(parts.length ? createNodeArray(parts, start, commentsPos) : undefined, tagsArray), start, end); }); function removeLeadingNewlines(comments: string[]) { @@ -7429,16 +7434,6 @@ namespace ts { } } - function createJSDocComment(): JSDoc { - const linksArray = links.length ? createNodeArray(links, linksPos, linksEnd) : undefined; - if (comments.length && tags) Debug.assertIsDefined(commentsPos); - const comment = comments.length - ? finishNode(factory.createJSDocCommentText(comments.join(""), linksArray), start, commentsPos) - : undefined; - const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); - return finishNode(factory.createJSDocComment(comment, tagsArray), start, end); - } - function isNextNonwhitespaceTokenEndOfFile(): boolean { // We must use infinite lookahead, as there could be any number of newlines :( while (true) { @@ -7572,12 +7567,11 @@ namespace ts { return parseTagComments(margin, indentText.slice(margin)); } - function parseTagComments(indent: number, initialMargin?: string): JSDocCommentText | undefined { + function parseTagComments(indent: number, initialMargin?: string): NodeArray | undefined { const commentsPos = getNodePos(); - const comments: string[] = []; - let linksPos; - let linksEnd; - const links: JSDocLink[] = []; + let comments: string[] = []; + const parts: (JSDocLink | JSDocText)[] = []; + let linkEnd; let state = JSDocState.BeginningOfLine; let previousWhitespace = true; let margin: number | undefined; @@ -7585,7 +7579,7 @@ namespace ts { if (!margin) { margin = indent; } - comments.push(text); + comments.push(text); // TODO: finishNode??? indent += text.length; } if (initialMargin !== undefined) { @@ -7630,13 +7624,14 @@ namespace ts { break; case SyntaxKind.OpenBraceToken: state = JSDocState.SavingComments; + const commentEnd = scanner.getStartPos(); const linkStart = scanner.getTextPos() - 1; const link = parseLink(linkStart); if (link) { - if (!linksPos) linksPos = linkStart; - links.push(link); - linksEnd = scanner.getTextPos(); - pushComment(scanner.getText().slice(link.pos, link.end)); + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? commentsPos, commentEnd)) + parts.push(link); + comments = [] + linkEnd = scanner.getTextPos(); } else { pushComment(scanner.getTokenText()); @@ -7674,8 +7669,10 @@ namespace ts { removeLeadingNewlines(comments); removeTrailingWhitespace(comments); if (comments.length) { - const comment = factory.createJSDocCommentText(comments.join(""), links.length ? createNodeArray(links, linksPos ?? indent, linksEnd) : undefined); - return finishNode(comment, commentsPos, scanner.getTextPos()); + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? commentsPos)) + } + if (parts.length) { + return createNodeArray(parts, commentsPos, scanner.getTextPos()); } } @@ -7688,11 +7685,13 @@ namespace ts { // parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error const name = tokenIsIdentifierOrKeyword(token()) ? parseEntityName(/*allowReservedWords*/ true) - : createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ false); + : undefined; + const text = []; while (token() !== SyntaxKind.CloseBraceToken && token() !== SyntaxKind.NewLineTrivia) { + text.push(scanner.getTokenText()) nextTokenJSDoc(); } - return finishNode(factory.createJSDocLinkNode(name), start, scanner.getTextPos()); + return finishNode(factory.createJSDocLink(name, text.join("")), start, scanner.getTextPos()); } function parseUnknownTag(start: number, tagName: Identifier, indent: number, indentText: string) { @@ -7824,18 +7823,17 @@ namespace ts { function parseAuthorTag(start: number, tagName: Identifier, indent: number, indentText: string): JSDocAuthorTag { const commentStart = getNodePos(); - let text = parseAuthorNameAndEmail(); - let links; - const tagComments = parseTrailingTagComments(start, end, indent, indentText); - if (tagComments) { - text += tagComments.text; - links = tagComments.links; + const textOnly = parseAuthorNameAndEmail(); + let commentEnd = scanner.getStartPos() + const comments = parseTrailingTagComments(start, commentEnd, indent, indentText); + if (!comments) { + commentEnd = scanner.getStartPos() } - const comment = text || links ? finishNode(factory.createJSDocCommentText(text, links), commentStart) : undefined; - return finishNode(factory.createJSDocAuthorTag(tagName, comment), start); + const allParts = concatenate([finishNode(textOnly, commentStart, commentEnd)], comments) as Array // cast away readonly + return finishNode(factory.createJSDocAuthorTag(tagName, createNodeArray(allParts, commentStart)), start); } - function parseAuthorNameAndEmail(): string { + function parseAuthorNameAndEmail(): JSDocText { const comments: string[] = []; let inEmail = false; let token = scanner.getToken(); @@ -7855,7 +7853,7 @@ namespace ts { token = nextTokenJSDoc(); } - return comments.join(""); + return factory.createJSDocText(comments.join("")) } function parseImplementsTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocImplementsTag { @@ -7891,7 +7889,7 @@ namespace ts { return node; } - function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: JSDocCommentText) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { + function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: NodeArray) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { return finishNode(createTag(tagName, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 95a1198f25d32..110c10ab9d62c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -373,7 +373,7 @@ namespace ts { // https://jsdoc.app/about-namepaths.html JSDocNamepathType, JSDocComment, - JSDocCommentText, + JSDocText, JSDocTypeLiteral, JSDocSignature, JSDocLink, @@ -3141,24 +3141,24 @@ namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: JSDocCommentText; + readonly comment?: NodeArray; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: JSDocCommentText; + readonly comment?: NodeArray; } export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; + text: string; } - export interface JSDocCommentText extends Node { - readonly kind: SyntaxKind.JSDocCommentText; + export interface JSDocText extends Node { + readonly kind: SyntaxKind.JSDocText; text: string; - links?: NodeArray; } export interface JSDocUnknownTag extends JSDocTag { @@ -7153,56 +7153,56 @@ namespace ts { updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName): JSDocNameReference; updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference; - createJSDocLinkNode(name: EntityName): JSDocLink; - updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink; + createJSDocLink(name: EntityName | undefined, text: string): JSDocLink; + updateJSDocLink(node: JSDocLink, name: EntityName | undefined, text: string): JSDocLink; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | JSDocCommentText | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | JSDocCommentText): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | JSDocCommentText | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | JSDocCommentText): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | JSDocCommentText | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | JSDocCommentText | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; - createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText; - updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText; - createJSDocComment(comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: string | JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + createJSDocText(text: string): JSDocText; + updateJSDocText(node: JSDocText, text: string): JSDocText; + createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; // // JSX diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 04e9b61317edf..9cc309d9c9229 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -894,6 +894,12 @@ namespace ts { return getJSDocTags(node).filter(doc => doc.kind === kind); } + /** Gets the text of a jsdoc comment, flattening links to their text. */ + export function getTextOfJSDocComment(comment?: NodeArray) { + // TODO: Stringify c.name correctly + return comment?.map(c => c.kind === SyntaxKind.JSDocText ? c.text : `{@link ${c.name}${c.text}}`).join("") + } + /** * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. @@ -1850,8 +1856,8 @@ 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 - || node.kind === SyntaxKind.JSDocCommentText || node.kind === SyntaxKind.JSDocNamepathType + || node.kind === SyntaxKind.JSDocText || node.kind === SyntaxKind.JSDocLink || isJSDocTag(node) || isJSDocTypeLiteral(node) diff --git a/src/deprecatedCompat/deprecations.ts b/src/deprecatedCompat/deprecations.ts index f4304ddaaf2b0..ca6cb24a0d630 100644 --- a/src/deprecatedCompat/deprecations.ts +++ b/src/deprecatedCompat/deprecations.ts @@ -1229,7 +1229,7 @@ namespace ts { /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ export const createJSDocParamTag = Debug.deprecate(function createJSDocParamTag(name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, comment?: string): JSDocParameterTag { - return factory.createJSDocParameterTag(/*tagName*/ undefined, name, isBracketed, typeExpression, /*isNameFirst*/ false, comment ? factory.createJSDocCommentText(comment) : undefined); + return factory.createJSDocParameterTag(/*tagName*/ undefined, name, isBracketed, typeExpression, /*isNameFirst*/ false, comment ? factory.createNodeArray([factory.createJSDocText(comment)]) : undefined); }, factoryDeprecation); /** @deprecated Use `factory.createComma` or the factory supplied by your transformation context instead. */ diff --git a/src/harness/client.ts b/src/harness/client.ts index 262402406b98d..38988808a5a52 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -175,9 +175,8 @@ namespace ts.server { kindModifiers: body.kindModifiers, textSpan: this.decodeSpan(body, fileName), displayParts: [{ kind: "text", text: body.displayString }], - documentation: [{ kind: "text", text: body.documentation }], - links: this.decodeLinks(body.links), - tags: this.decodeLinkTags(body.tags) + documentation: typeof body.documentation === "string" ? [{ kind: "text", text: body.documentation }] : body.documentation, + tags: this.decodeLinkDisplayParts(body.tags) }; } @@ -224,9 +223,8 @@ namespace ts.server { const response = this.processResponse(request); Debug.assert(response.body!.length === 1, "Unexpected length of completion details response body."); const convertedCodeActions = map(response.body![0].codeActions, ({ description, changes }) => ({ description, changes: this.convertChanges(changes, fileName) })); - const tags = response.body![0].tags ? this.decodeLinkTags(response.body![0].tags) : undefined; - const links = response.body![0].links ? this.decodeLinks(response.body![0].links) : undefined; - return { ...response.body![0], links, tags, codeActions: convertedCodeActions }; + const tags = response.body![0].tags ? this.decodeLinkDisplayParts(response.body![0].tags) : undefined; + return { ...response.body![0], tags, codeActions: convertedCodeActions }; } getCompletionEntrySymbol(_fileName: string, _position: number, _entryName: string): Symbol { @@ -537,22 +535,22 @@ namespace ts.server { this.lineOffsetToPosition(fileName, span.end, lineMap)); } - private decodeLinks(links: protocol.JSDocLinkInfo[]): JSDocLinkInfo[] { - return links.map(link => ({ - ...link, - name: link.name as unknown as TextSpan, - target: { - // TODO: The JSDocLinkInfo tag data mismatches the type!! (probably wasn't correctly encoded in the first place?) - textSpan: link.target as unknown as TextSpan, - fileName: link.target.file, - } - })); - } - private decodeLinkTags(tags: protocol.JSDocTagInfo[]): JSDocTagInfo[] { - return tags.map(tag => ({ + // private decodeLinks(links: protocol.JSDocLinkInfo[]): JSDocLinkInfo[] { + // return links.map(link => ({ + // ...link, + // name: link.name as unknown as TextSpan, + // target: { + // // TODO: The JSDocLinkInfo tag data mismatches the type!! (probably wasn't correctly encoded in the first place?) + // textSpan: link.target as unknown as TextSpan, + // fileName: link.target.file, + // } + // })); + // } + private decodeLinkDisplayParts(tags: Array): JSDocTagInfo[] { + return tags.map(tag => typeof tag.text === "string" ? { ...tag, - links: tag.links ? this.decodeLinks(tag.links) : undefined - })); + text: [textPart(tag.text)] + } : (tag as JSDocTagInfo)); } getNameOrDottedNameSpan(_fileName: string, _startPos: number, _endPos: number): TextSpan { @@ -577,7 +575,7 @@ namespace ts.server { // TODO: Same here, it doesn't actually seem to be encoded const applicableSpan = encodedApplicableSpan as unknown as TextSpan; - const items = encodedItems.map(item => ({ ...item, links: this.decodeLinks(item.links), tags: this.decodeLinkTags(item.tags) })); + const items = (encodedItems as Array).map(item => ({ ...item, tags: this.decodeLinkDisplayParts(item.tags) })); return { items, applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; } diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 4f4ef64b8a248..fd1a0d7936320 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -972,12 +972,6 @@ namespace ts.server.protocol { export interface JSDocTagInfo { name: string; text?: string; - links?: JSDocLinkInfo[]; - } - - export interface JSDocLinkInfo extends DocumentSpan { - name: FileSpan; - target: FileSpan; } export interface TextSpanWithContext extends TextSpan { @@ -1942,6 +1936,8 @@ namespace ts.server.protocol { */ export interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; + /** if true - return response as with documentation as display parts instead of string */ + richResponse?: boolean; } /** @@ -1979,21 +1975,56 @@ namespace ts.server.protocol { documentation: string; /** - * JSDoc links associated with symbol. + * JSDoc tags associated with symbol. */ - links: JSDocLinkInfo[]; + tags: JSDocTagInfo[]; + } + + /** + * RICH Body of QuickInfoResponse. + */ + export interface RichQuickInfoResponseBody { + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: ScriptElementKind; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + + /** + * Starting file location of symbol. + */ + start: Location; + + /** + * One past last character of symbol. + */ + end: Location; + + /** + * Type and kind of symbol. + */ + displayString: string; + + /** + * Documentation associated with symbol. + */ + documentation: SymbolDisplayPart[]; /** * JSDoc tags associated with symbol. */ - tags: JSDocTagInfo[]; + tags: ts.JSDocTagInfo[]; } /** * Quickinfo response message. */ export interface QuickInfoResponse extends Response { - body?: QuickInfoResponseBody; + body?: QuickInfoResponseBody | RichQuickInfoResponseBody; } /** @@ -2186,6 +2217,8 @@ namespace ts.server.protocol { export interface CompletionDetailsRequest extends FileLocationRequest { command: CommandTypes.CompletionDetails; arguments: CompletionDetailsRequestArgs; + /** if true - return response as with documentation as display parts instead of string */ + richResponse?: boolean; } /** @@ -2290,14 +2323,52 @@ namespace ts.server.protocol { documentation?: SymbolDisplayPart[]; /** - * JSDoc links associated with symbol. + * JSDoc tags for the symbol. + */ + tags?: JSDocTagInfo[]; + + /** + * The associated code actions for this entry */ - links?: JSDocLinkInfo[]; + codeActions?: CodeAction[]; + + /** + * Human-readable description of the `source` from the CompletionEntry. + */ + source?: SymbolDisplayPart[]; + } + + /** + * RICH Additional completion entry details, available on demand + * (It's just ts.JSDocTagInfo to get displayparts) + */ + export interface RichCompletionEntryDetails { + /** + * The symbol's name. + */ + name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: ScriptElementKind; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + /** + * Display parts of the symbol (similar to quick info). + */ + displayParts: SymbolDisplayPart[]; + + /** + * Documentation strings for the symbol. + */ + documentation?: SymbolDisplayPart[]; /** * JSDoc tags for the symbol. */ - tags?: JSDocTagInfo[]; + tags?: ts.JSDocTagInfo[]; /** * The associated code actions for this entry @@ -2333,7 +2404,7 @@ namespace ts.server.protocol { } export interface CompletionDetailsResponse extends Response { - body?: CompletionEntryDetails[]; + body?: CompletionEntryDetails[] | RichCompletionEntryDetails[]; } /** @@ -2397,11 +2468,6 @@ namespace ts.server.protocol { */ documentation: SymbolDisplayPart[]; - /** - * JSDoc links associated with symbol. - */ - links: JSDocLinkInfo[]; - /** * The signature's JSDoc tags */ @@ -2501,13 +2567,15 @@ namespace ts.server.protocol { export interface SignatureHelpRequest extends FileLocationRequest { command: CommandTypes.SignatureHelp; arguments: SignatureHelpRequestArgs; + /** if true - return response as with documentation as display parts instead of string */ + richResponse?: boolean; } /** * Response object for a SignatureHelpRequest. */ export interface SignatureHelpResponse extends Response { - body?: SignatureHelpItems; + body?: SignatureHelpItems | ts.SignatureHelpItems; } /** diff --git a/src/server/session.ts b/src/server/session.ts index 9b81083875922..48c6e94021dd2 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1274,19 +1274,20 @@ namespace ts.server { result; } - private mapJSDocLinkInfo(links: JSDocLinkInfo[] | undefined, project: Project): protocol.JSDocLinkInfo[] { - if (links === undefined) { - return []; - } - return links.map(link => ({ - ...link, - name: this.toFileSpan(link.fileName, link.name, project), - target: this.toFileSpan(link.target.fileName, link.target.textSpan, project), - })); - } - - private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project): protocol.JSDocTagInfo[] { - return tags ? tags.map(tag => ({ ...tag, links: this.mapJSDocLinkInfo(tag.links, project) })) : []; + // private mapJSDocLinkPart(parts: ts.SymbolDisplayPart[] | undefined, project: Project): protocol.SymbolDisplayPart[] { + // if (parts === undefined) { + // return []; + // } + // return parts.map(part => part.kind !== "link" ? part.text : { + // ...part, + // name: this.toFileSpan((part as JSDocLinkPart).name.fileName, (part as JSDocLinkPart).name.textSpan, project), + // target: this.toFileSpan((part as JSDocLinkPart).target.fileName, (part as JSDocLinkPart).target.textSpan, project), + // }); + // } + + // TODO: If rich version, then don't map (except...maybe the symbol links' spans need mapping??) + private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined): protocol.JSDocTagInfo[] { + return tags ? tags.map(tag => ({ ...tag, text: tag.text && tag.text.map(part => part.text).join("") })) : []; } private mapDefinitionInfo(definitions: readonly DefinitionInfo[], project: Project): readonly protocol.FileSpanWithContext[] { @@ -1692,7 +1693,7 @@ namespace ts.server { return languageService.isValidBraceCompletionAtPosition(file, position, args.openingBrace.charCodeAt(0)); } - private getQuickInfoWorker(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.QuickInfoResponseBody | QuickInfo | undefined { + private getQuickInfoWorker(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean, partlyUnsimplifiedResult?: boolean): protocol.QuickInfoResponseBody | protocol.RichQuickInfoResponseBody | QuickInfo | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo)); @@ -1702,18 +1703,30 @@ namespace ts.server { if (simplifiedResult) { const displayString = displayPartsToString(quickInfo.displayParts); - const docString = displayPartsToString(quickInfo.documentation); + if (partlyUnsimplifiedResult) { + return { + kind: quickInfo.kind, + kindModifiers: quickInfo.kindModifiers, + start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), + end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), + displayString, + documentation: quickInfo.documentation || [], + tags: quickInfo.tags || [] + }; - return { - kind: quickInfo.kind, - kindModifiers: quickInfo.kindModifiers, - start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), - end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), - displayString, - documentation: docString, - links: this.mapJSDocLinkInfo(quickInfo.links, project), - tags: this.mapJSDocTagInfo(quickInfo.tags, project) - }; + } + else { + const documentation = displayPartsToString(quickInfo.documentation); + return { + kind: quickInfo.kind, + kindModifiers: quickInfo.kindModifiers, + start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), + end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), + displayString, + documentation, + tags: this.mapJSDocTagInfo(quickInfo.tags) + }; + } } else { return quickInfo; @@ -1846,7 +1859,7 @@ namespace ts.server { return res; } - private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, fullResult: boolean): readonly protocol.CompletionEntryDetails[] | readonly CompletionEntryDetails[] { + private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, fullResult: boolean, partlyUnsimplifiedResult?: boolean): readonly protocol.CompletionEntryDetails[] | readonly protocol.RichCompletionEntryDetails[] | readonly CompletionEntryDetails[] { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); @@ -1856,13 +1869,15 @@ namespace ts.server { const { name, source } = typeof entryName === "string" ? { name: entryName, source: undefined } : entryName; return project.getLanguageService().getCompletionEntryDetails(file, position, name, formattingOptions, source, this.getPreferences(file)); }); - return fullResult - ? result + return fullResult ? result + : partlyUnsimplifiedResult ? result.map(details => ({ + ...details, + codeActions: map(details.codeActions, action => this.mapCodeAction(action)), + })) : result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)), - links: this.mapJSDocLinkInfo(details.links, project), - tags: this.mapJSDocTagInfo(details.tags, project) + tags: this.mapJSDocTagInfo(details.tags) })); } @@ -1918,7 +1933,7 @@ namespace ts.server { !emitSkipped; } - private getSignatureHelpItems(args: protocol.SignatureHelpRequestArgs, simplifiedResult: boolean): protocol.SignatureHelpItems | SignatureHelpItems | undefined { + private getSignatureHelpItems(args: protocol.SignatureHelpRequestArgs, simplifiedResult: boolean, partlyUnsimplifiedResult?: boolean): protocol.SignatureHelpItems | SignatureHelpItems | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); @@ -1927,7 +1942,7 @@ namespace ts.server { return undefined; } - if (simplifiedResult) { + if (simplifiedResult && !partlyUnsimplifiedResult) { const span = helpItems.applicableSpan; return { items: helpItems.items, @@ -2655,7 +2670,7 @@ namespace ts.server { return this.notRequired(); }, [CommandNames.Quickinfo]: (request: protocol.QuickInfoRequest) => { - return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ true)); + return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ true, request.richResponse)); }, [CommandNames.QuickinfoFull]: (request: protocol.QuickInfoRequest) => { return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ false)); @@ -2718,7 +2733,7 @@ namespace ts.server { return this.requiredResponse(this.getCompletions(request.arguments, CommandNames.CompletionsFull)); }, [CommandNames.CompletionDetails]: (request: protocol.CompletionDetailsRequest) => { - return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ false)); + return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ false, request.richResponse)); }, [CommandNames.CompletionDetailsFull]: (request: protocol.CompletionDetailsRequest) => { return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ true)); @@ -2730,7 +2745,7 @@ namespace ts.server { return this.requiredResponse(this.emitFile(request.arguments)); }, [CommandNames.SignatureHelp]: (request: protocol.SignatureHelpRequest) => { - return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ true)); + return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ true, request.richResponse)); }, [CommandNames.SignatureHelpFull]: (request: protocol.SignatureHelpRequest) => { return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ false)); diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index 748d0806a838f..86fb258144f7f 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -382,14 +382,14 @@ namespace ts.codefix { } export function addJSDocTags(changes: textChanges.ChangeTracker, sourceFile: SourceFile, parent: HasJSDoc, newTags: readonly JSDocTag[]): void { - const comments = mapDefined(parent.jsDoc, j => j.comment?.text); + const comments = flatMap(parent.jsDoc, j => j.comment); const oldTags = flatMapToMutable(parent.jsDoc, j => j.tags); const unmergedNewTags = newTags.filter(newTag => !oldTags || !oldTags.some((tag, i) => { const merged = tryMergeJsdocTags(tag, newTag); if (merged) oldTags[i] = merged; return !!merged; })); - const tag = factory.createJSDocComment(factory.createJSDocCommentText(comments.join("\n")), factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); + const tag = factory.createJSDocComment(factory.createNodeArray(comments), factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); const jsDocNode = parent.kind === SyntaxKind.ArrowFunction ? getJsDocNodeForArrowFunction(parent) : parent; jsDocNode.jsDoc = parent.jsDoc; jsDocNode.jsDocCache = parent.jsDocCache; diff --git a/src/services/completions.ts b/src/services/completions.ts index 69dc5315c8c48..5cc1a12674cde 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -729,15 +729,15 @@ namespace ts.Completions { } export function createCompletionDetailsForSymbol(symbol: Symbol, checker: TypeChecker, sourceFile: SourceFile, location: Node, cancellationToken: CancellationToken, codeActions?: CodeAction[], sourceDisplay?: SymbolDisplayPart[]): CompletionEntryDetails { - const { displayParts, documentation, links, symbolKind, tags } = + const { displayParts, documentation, symbolKind, tags } = checker.runWithCancellationToken(cancellationToken, checker => SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, sourceFile, location, location, SemanticMeaning.All) ); - return createCompletionDetails(symbol.name, SymbolDisplay.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, links, tags, codeActions, sourceDisplay); + return createCompletionDetails(symbol.name, SymbolDisplay.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay); } - export function createCompletionDetails(name: string, kindModifiers: string, kind: ScriptElementKind, displayParts: SymbolDisplayPart[], documentation?: SymbolDisplayPart[], links?: JSDocLinkInfo[], tags?: JSDocTagInfo[], codeActions?: CodeAction[], source?: SymbolDisplayPart[]): CompletionEntryDetails { - return { name, kindModifiers, kind, displayParts, documentation, links, tags, codeActions, source }; + export function createCompletionDetails(name: string, kindModifiers: string, kind: ScriptElementKind, displayParts: SymbolDisplayPart[], documentation?: SymbolDisplayPart[], tags?: JSDocTagInfo[], codeActions?: CodeAction[], source?: SymbolDisplayPart[]): CompletionEntryDetails { + return { name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source }; } interface CodeActionsAndSourceDisplay { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index f6e04b8c3facf..8d17bc6aa185b 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -82,21 +82,25 @@ namespace ts.JsDoc { let jsDocTagNameCompletionEntries: CompletionEntry[]; let jsDocTagCompletionEntries: CompletionEntry[]; - export function getJsDocCommentsFromDeclarations(declarations: readonly Declaration[]): SymbolDisplayPart[] { + export function getJsDocCommentsFromDeclarations(declarations: readonly Declaration[], checker?: TypeChecker): SymbolDisplayPart[] { // Only collect doc comments from duplicate declarations once: // In case of a union property there might be same declaration multiple times // which only varies in type parameter // Eg. const a: Array | Array; a.length // The property length will have two declarations of property length coming // from Array - Array and Array - const documentationComment: string[] = []; + const parts: SymbolDisplayPart[] = []; forEachUnique(declarations, declaration => { for (const { comment } of getCommentHavingNodes(declaration)) { if (comment === undefined) continue; - pushIfUnique(documentationComment, comment.text); + for (const part of getDisplayPartsFromComment(comment, checker)) { + if (!contains(parts, part, (part1,part2) => part1.kind === part2.kind && part1.text === part2.text)) { + parts.push(part); + } + } } }); - return intersperse(map(documentationComment, textPart), lineBreakPart()); + return intersperse(parts, lineBreakPart()); } function getCommentHavingNodes(declaration: Declaration): readonly (JSDoc | JSDocTag)[] { @@ -117,53 +121,17 @@ namespace ts.JsDoc { const tags: JSDocTagInfo[] = []; forEachUnique(declarations, declaration => { for (const tag of getJSDocTags(declaration)) { - tags.push({ name: tag.tagName.text, text: getCommentText(tag), links: checker ? getLinks(tag, checker) : undefined }); + tags.push({ name: tag.tagName.text, text: getCommentDisplayParts(tag, checker) }); } }); return tags; } - export function getJsDocLinksFromDeclarations(declarations?: Declaration[], checker?: TypeChecker): JSDocLinkInfo[] { - // Only collect doc comments from duplicate declarations once. - const links: JSDocLinkInfo[] = []; - if (!declarations || !checker) { - return links; - } - forEachUnique(declarations, declaration => { - for (const comment of getJSDocCommentsAndTags(declaration)) { - if (isJSDoc(comment)) { - const newLinks = getLinks(comment, checker); - if (newLinks) { - links.push(...newLinks); - } - } - } - }); - return links; - - } - - function getLinks(tag: JSDoc | JSDocTag, checker: TypeChecker): JSDocLinkInfo[] | undefined { - const links = tag.comment?.links; - if (links) { - return mapDefined(links, link => { - if (!link.name) return; - const symbol = checker.getSymbolAtLocation(link.name); - if (!symbol || !symbol.valueDeclaration) return; - return { - fileName: getSourceFileOfNode(link).fileName, - textSpan: createTextSpanFromNode(link), - name: createTextSpanFromNode(link.name), - target: { - fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, - textSpan: createTextSpanFromNode(symbol.valueDeclaration) - } - }; - }); - } + function getDisplayPartsFromComment(comment: ReadonlyArray, checker: TypeChecker | undefined) { + return comment.map(node => node.kind === SyntaxKind.JSDocText ? textPart(node.text) : linkPart(node, checker)) } - function getCommentText(tag: JSDocTag): string | undefined { + function getCommentDisplayParts(tag: JSDocTag, checker?: TypeChecker): SymbolDisplayPart[] | undefined { const { comment } = tag; switch (tag.kind) { case SyntaxKind.JSDocImplementsTag: @@ -171,7 +139,7 @@ namespace ts.JsDoc { case SyntaxKind.JSDocAugmentsTag: return withNode((tag as JSDocAugmentsTag).class); case SyntaxKind.JSDocTemplateTag: - return withList((tag as JSDocTemplateTag).typeParameters); + return addComment((tag as JSDocTemplateTag).typeParameters.map(tp => tp.getText()).join(", ")); case SyntaxKind.JSDocTypeTag: return withNode((tag as JSDocTypeTag).typeExpression); case SyntaxKind.JSDocTypedefTag: @@ -180,21 +148,17 @@ namespace ts.JsDoc { case SyntaxKind.JSDocParameterTag: case SyntaxKind.JSDocSeeTag: const { name } = tag as JSDocTypedefTag | JSDocPropertyTag | JSDocParameterTag | JSDocSeeTag; - return name ? withNode(name) : comment?.text; + return name ? withNode(name) : comment && getDisplayPartsFromComment(comment, checker); default: - return comment?.text; + return comment && getDisplayPartsFromComment(comment, checker); } function withNode(node: Node) { return addComment(node.getText()); } - function withList(list: NodeArray): string { - return addComment(list.map(x => x.getText()).join(", ")); - } - function addComment(s: string) { - return comment === undefined ? s : `${s} ${comment.text}`; + return comment ? [textPart(s), spacePart(), ...getDisplayPartsFromComment(comment, checker)] : [textPart(s)] } } @@ -229,7 +193,6 @@ namespace ts.JsDoc { kindModifiers: "", displayParts: [textPart(name)], documentation: emptyArray, - links: undefined, tags: undefined, codeActions: undefined, }; @@ -264,7 +227,6 @@ namespace ts.JsDoc { kindModifiers: "", displayParts: [textPart(name)], documentation: emptyArray, - links: undefined, tags: undefined, codeActions: undefined, }; diff --git a/src/services/services.ts b/src/services/services.ts index 2fc0719d0d4b5..70b858ab8357f 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -293,7 +293,6 @@ namespace ts { // symbol has no doc comment, then the empty array will be returned. documentationComment?: SymbolDisplayPart[]; tags?: JSDocTagInfo[]; // same - links?: JSDocLinkInfo[]; // same contextualGetAccessorDocumentationComment?: SymbolDisplayPart[]; contextualSetAccessorDocumentationComment?: SymbolDisplayPart[]; @@ -357,14 +356,6 @@ namespace ts { } } - getJsDocLinks(checker: TypeChecker): JSDocLinkInfo[] { - if (this.links === undefined) { - this.links = JsDoc.getJsDocLinksFromDeclarations(this.declarations, checker); - } - - return this.links; - } - getJsDocTags(checker?: TypeChecker): JSDocTagInfo[] { if (this.tags === undefined) { this.tags = JsDoc.getJsDocTagsFromDeclarations(this.declarations, checker); @@ -528,7 +519,6 @@ namespace ts { // symbol has no doc comment, then the empty array will be returned. documentationComment?: SymbolDisplayPart[]; jsDocTags?: JSDocTagInfo[]; // same - jsDocLinks?: JSDocLinkInfo[]; // same constructor(checker: TypeChecker, flags: SignatureFlags) { this.checker = checker; @@ -552,14 +542,6 @@ namespace ts { return this.documentationComment || (this.documentationComment = getDocumentationComment(singleElementArray(this.declaration), this.checker)); } - getJsDocLinks(): JSDocLinkInfo[] { - if (this.jsDocLinks === undefined) { - this.jsDocLinks = this.declaration ? JsDoc.getJsDocLinksFromDeclarations([this.declaration], this.checker) : []; - } - - return this.jsDocLinks; - } - getJsDocTags(): JSDocTagInfo[] { if (this.jsDocTags === undefined) { this.jsDocTags = this.declaration ? getJsDocTags([this.declaration], this.checker) : []; @@ -593,7 +575,7 @@ namespace ts { function getDocumentationComment(declarations: readonly Declaration[] | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { if (!declarations) return emptyArray; - let doc = JsDoc.getJsDocCommentsFromDeclarations(declarations); + let doc = JsDoc.getJsDocCommentsFromDeclarations(declarations, checker); if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) { forEachUnique(declarations, declaration => { const inheritedDocs = findBaseOfDeclaration(checker, declaration, symbol => symbol.getDocumentationComment(checker)); @@ -1612,12 +1594,11 @@ namespace ts { textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile), displayParts: typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(nodeForQuickInfo))), documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : undefined, - links: type.symbol ? type.symbol.getJsDocLinks(typeChecker): undefined, tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : undefined }; } - const { symbolKind, displayParts, documentation, links, tags } = typeChecker.runWithCancellationToken(cancellationToken, typeChecker => + const { symbolKind, displayParts, documentation, tags } = typeChecker.runWithCancellationToken(cancellationToken, typeChecker => SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, getContainerNode(nodeForQuickInfo), nodeForQuickInfo) ); return { @@ -1626,7 +1607,6 @@ namespace ts { textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile), displayParts, documentation, - links, tags, }; } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 534dec064e780..8ab4fa39ba0b9 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -574,10 +574,9 @@ namespace ts.SignatureHelp { const parameters = typeParameters.map(t => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer)); const documentation = symbol.getDocumentationComment(checker); - const links = symbol.getJsDocLinks(checker); const tags = symbol.getJsDocTags(checker); const prefixDisplayParts = [...typeSymbolDisplay, punctuationPart(SyntaxKind.LessThanToken)]; - return { isVariadic: false, prefixDisplayParts, suffixDisplayParts: [punctuationPart(SyntaxKind.GreaterThanToken)], separatorDisplayParts, parameters, documentation, links, tags }; + return { isVariadic: false, prefixDisplayParts, suffixDisplayParts: [punctuationPart(SyntaxKind.GreaterThanToken)], separatorDisplayParts, parameters, documentation, tags }; } const separatorDisplayParts: SymbolDisplayPart[] = [punctuationPart(SyntaxKind.CommaToken), spacePart()]; @@ -588,9 +587,8 @@ namespace ts.SignatureHelp { const prefixDisplayParts = [...callTargetDisplayParts, ...prefix]; const suffixDisplayParts = [...suffix, ...returnTypeToDisplayParts(candidateSignature, enclosingDeclaration, checker)]; const documentation = candidateSignature.getDocumentationComment(checker); - const links = candidateSignature.getJsDocLinks(); const tags = candidateSignature.getJsDocTags(); - return { isVariadic, prefixDisplayParts, suffixDisplayParts, separatorDisplayParts, parameters, documentation, links, tags }; + return { isVariadic, prefixDisplayParts, suffixDisplayParts, separatorDisplayParts, parameters, documentation, tags }; }); } diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index b0cd3cd7c70ce..4a93045d35014 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -142,7 +142,6 @@ namespace ts.SymbolDisplay { interface SymbolDisplayPartsDocumentationAndSymbolKind { displayParts: SymbolDisplayPart[]; documentation: SymbolDisplayPart[]; - links: JSDocLinkInfo[] | undefined; symbolKind: ScriptElementKind; tags: JSDocTagInfo[] | undefined; } @@ -153,7 +152,6 @@ namespace ts.SymbolDisplay { const displayParts: SymbolDisplayPart[] = []; let documentation: SymbolDisplayPart[] = []; let tags: JSDocTagInfo[] = []; - let links: JSDocLinkInfo[] = []; const symbolFlags = getCombinedLocalAndExportSymbolFlags(symbol); let symbolKind = semanticMeaning & SemanticMeaning.Value ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : ScriptElementKind.unknown; let hasAddedSymbolInfo = false; @@ -165,7 +163,7 @@ namespace ts.SymbolDisplay { let hasMultipleSignatures = false; if (location.kind === SyntaxKind.ThisKeyword && !isThisExpression) { - return { displayParts: [keywordPart(SyntaxKind.ThisKeyword)], documentation: [], symbolKind: ScriptElementKind.primitiveType, links: undefined, tags: undefined }; + return { displayParts: [keywordPart(SyntaxKind.ThisKeyword)], documentation: [], symbolKind: ScriptElementKind.primitiveType, tags: undefined }; } // Class at constructor site need to be shown as constructor apart from property,method, vars @@ -552,7 +550,6 @@ namespace ts.SymbolDisplay { if (documentation.length === 0 && !hasMultipleSignatures) { documentation = symbol.getContextualDocumentationComment(enclosingDeclaration, typeChecker); - links = symbol.getJsDocLinks(typeChecker); } if (documentation.length === 0 && symbolFlags & SymbolFlags.Property) { @@ -571,7 +568,6 @@ namespace ts.SymbolDisplay { } documentation = rhsSymbol.getDocumentationComment(typeChecker); - links = rhsSymbol.getJsDocLinks(typeChecker); tags = rhsSymbol.getJsDocTags(typeChecker); if (documentation.length > 0) { break; @@ -592,7 +588,7 @@ namespace ts.SymbolDisplay { tags = tagsFromAlias; } - return { displayParts, documentation, links, symbolKind, tags: tags.length === 0 ? undefined : tags }; + return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? undefined : tags }; function getPrinter() { if (!printer) { @@ -675,7 +671,6 @@ namespace ts.SymbolDisplay { } documentation = signature.getDocumentationComment(typeChecker); tags = signature.getJsDocTags(); - links = signature.getJsDocLinks(); if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) { documentation = allSignatures[0].getDocumentationComment(typeChecker); diff --git a/src/services/types.ts b/src/services/types.ts index c85479fc799ff..7183837b03c4f 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -44,7 +44,6 @@ namespace ts { /* @internal */ getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; - getJsDocLinks(checker: TypeChecker): JSDocLinkInfo[]; } export interface Type { @@ -85,7 +84,6 @@ namespace ts { getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; - getJsDocLinks(): JSDocLinkInfo[]; getJsDocTags(): JSDocTagInfo[]; } @@ -1031,6 +1029,7 @@ namespace ts { enumMemberName, functionName, regularExpressionLiteral, + link, } export interface SymbolDisplayPart { @@ -1038,15 +1037,14 @@ namespace ts { kind: string; } - export interface JSDocTagInfo { - name: string; - text?: string; - links?: JSDocLinkInfo[]; + export interface JSDocLinkPart extends SymbolDisplayPart { + name: TextSpan; // TODO: Might need to be relative to comment start (or, easier, filename+line+offset) + target: DocumentSpan; // TODO: Protocol needs to convert these to the protocol line+offset version } - export interface JSDocLinkInfo extends DocumentSpan { - name: TextSpan; - target: DocumentSpan; + export interface JSDocTagInfo { + name: string; + text?: Array; } export interface QuickInfo { @@ -1054,8 +1052,7 @@ namespace ts { kindModifiers: string; textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; - documentation?: SymbolDisplayPart[]; - links?: JSDocLinkInfo[]; + documentation?: Array; tags?: JSDocTagInfo[]; } @@ -1113,7 +1110,6 @@ namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; - links: JSDocLinkInfo[]; tags: JSDocTagInfo[]; } @@ -1172,7 +1168,6 @@ namespace ts { kindModifiers: string; // see ScriptElementKindModifier, comma separated displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; @@ -1376,6 +1371,9 @@ namespace ts { /** String literal */ string = "string", + + /** Jsdoc {@link entityname} */ + link = "link", } export const enum ScriptElementKindModifier { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 4736faaf89c86..d6b85948b4b08 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -2175,6 +2175,25 @@ namespace ts { return displayPart(text, SymbolDisplayPartKind.text); } + /** return type subtype reduction elimination! */ + export function linkPart(link: JSDocLink, checker?: TypeChecker): SymbolDisplayPart { + if (!link.name) + return textPart(`{@link ${link.text}}`) + const text = `{@link ${getTextOfNode(link.name)}${link.text}}`; + const symbol = checker?.getSymbolAtLocation(link.name); + if (!symbol) + return textPart(text) + return { + text, + kind: SymbolDisplayPartKind[SymbolDisplayPartKind.link], + name: createTextSpanFromNode(link.name), + target: { + fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, + textSpan: createTextSpanFromNode(symbol.valueDeclaration), + }, + } as JSDocLinkPart + } + const carriageReturnLineFeed = "\r\n"; /** * The default is CRLF. diff --git a/src/testRunner/unittests/publicApi.ts b/src/testRunner/unittests/publicApi.ts index 7ae7f0f8a7abb..8245a6d340854 100644 --- a/src/testRunner/unittests/publicApi.ts +++ b/src/testRunner/unittests/publicApi.ts @@ -67,7 +67,9 @@ function test() {}`; const funcDec = testSourceFile.statements.find(ts.isFunctionDeclaration)!; const tags = ts.getJSDocTags(funcDec); assert.isDefined(tags[0].comment); - assert.equal(tags[0].comment!.text, "Some\n text\r\n with newlines."); + assert.isDefined(tags[0].comment![0]); + assert.equal(tags[0].comment![0].kind, ts.SyntaxKind.JSDocText); + assert.equal(tags[0].comment![0].text, "Some\n text\r\n with newlines."); }); }); diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index 1a23656984c30..d7aa949854aaf 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -64,13 +64,12 @@ namespace ts.projectSystem { displayPart("0", SymbolDisplayPartKind.stringLiteral), ], documentation: emptyArray, - links: [], kind: ScriptElementKind.constElement, kindModifiers: ScriptElementKindModifier.exportedModifier, name: "foo", source: [{ text: "./a", kind: "text" }], }; - assert.deepEqual(detailsResponse, [ + assert.deepEqual(detailsResponse, [ { codeActions: [ { diff --git a/src/testRunner/unittests/tsserver/dynamicFiles.ts b/src/testRunner/unittests/tsserver/dynamicFiles.ts index a8b2e7d2f7884..95976bffa1f9f 100644 --- a/src/testRunner/unittests/tsserver/dynamicFiles.ts +++ b/src/testRunner/unittests/tsserver/dynamicFiles.ts @@ -160,7 +160,6 @@ var x = 10;` { text: "number", kind: "keyword" } ], documentation: [], - links: [], tags: undefined, }); }); diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 711da7ee70823..8635fed242435 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -34,10 +34,18 @@ var x = 1`); { text: "number", kind: "keyword" } ], documentation: [], - links: [], tags: [{ - links: [{ - fileName: "someFile1.js", + name: "wat", + text: [{ + "kind": "text", + "text": "", + }, { + kind: "link", + // textSpan: { + // length: 9, + // start: 21, + // }, + // fileName: "someFile1.js", name: { length: 1, start: 28, @@ -49,13 +57,8 @@ var x = 1`); start: 0, } }, - textSpan: { - length: 9, - start: 21, - }, + text: "{@link C}", }], - name: "wat", - text: "{@link C}", }] }); }); @@ -93,26 +96,30 @@ var x = 1`); { text: "number", kind: "keyword" } ], documentation: [{ - kind: "text", - text: "{@link C}" - }], - links: [{ + "kind": "text", + "text": "", + }, { + "kind": "lineBreak", + "text": "\n", + }, { + kind: "link", + name: { + length: 1, + start: 23, + }, + target: { fileName: "someFile1.js", - name: { - length: 1, - start: 23, - }, - target: { - fileName: "someFile1.js", - textSpan: { - length: 11, - start: 0, - } - }, textSpan: { - length: 9, - start: 16, - }, + length: 11, + start: 0, + } + }, + text: "{@link C}" + // fileName: "someFile1.js", + // textSpan: { + // length: 9, + // start: 16, + // }, }], tags: undefined, }); diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json index 1779218ee8cab..0899772ccaa49 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json @@ -21,12 +21,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 19, + "end": 52, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "is (@@fine@@and) is one comment" + }, + "length": 1, "pos": 19, "end": 52, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "is (@@fine@@and) is one comment" + "hasTrailingComma": false, + "transformFlags": 0 }, "name": { "kind": "Identifier", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index cd61d62dee754..d031b6e257728 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -6,49 +6,67 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "kind": "JSDocCommentText", - "pos": 0, - "end": 59, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "{@link first }\nInside {@link link text} thing", - "links": { - "0": { - "kind": "JSDocLink", - "pos": 7, - "end": 21, + "0": { + "kind": "JSDocText", + "pos": 0, + "end": 7, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "" + }, + "1": { + "kind": "JSDocLink", + "pos": 7, + "end": 21, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 14, + "end": 19, "modifierFlagsCache": 0, "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 14, - "end": 19, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "first" - } + "escapedText": "first" }, - "1": { - "kind": "JSDocLink", - "pos": 32, - "end": 49, + "text": "" + }, + "2": { + "kind": "JSDocText", + "pos": 21, + "end": 32, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "\nInside " + }, + "3": { + "kind": "JSDocLink", + "pos": 32, + "end": 49, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 39, + "end": 43, "modifierFlagsCache": 0, "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 39, - "end": 43, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "link" - } + "escapedText": "link" }, - "length": 2, - "pos": 7, - "end": 49, - "hasTrailingComma": false, - "transformFlags": 0 - } + "text": "text" + }, + "4": { + "kind": "JSDocText", + "pos": 49, + "end": 59, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " thing" + }, + "length": 5, + "pos": 0, + "end": 59, + "hasTrailingComma": false, + "transformFlags": 0 }, "tags": { "0": { @@ -66,49 +84,50 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", - "pos": 70, - "end": 102, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "See also {@link A.Reference}", - "links": { - "0": { - "kind": "JSDocLink", - "pos": 79, - "end": 98, + "0": { + "kind": "JSDocText", + "pos": 70, + "end": 79, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "See also " + }, + "1": { + "kind": "JSDocLink", + "pos": 79, + "end": 98, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "FirstNode", + "pos": 86, + "end": 97, "modifierFlagsCache": 0, "transformFlags": 0, - "name": { - "kind": "FirstNode", + "left": { + "kind": "Identifier", "pos": 86, + "end": 87, + "modifierFlagsCache": 0, + "transformFlags": 0, + "escapedText": "A" + }, + "right": { + "kind": "Identifier", + "pos": 88, "end": 97, "modifierFlagsCache": 0, "transformFlags": 0, - "left": { - "kind": "Identifier", - "pos": 86, - "end": 87, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "A" - }, - "right": { - "kind": "Identifier", - "pos": 88, - "end": 97, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "Reference" - } + "escapedText": "Reference" } }, - "length": 1, - "pos": 79, - "end": 98, - "hasTrailingComma": false, - "transformFlags": 0 - } + "text": "" + }, + "length": 2, + "pos": 70, + "end": 102, + "hasTrailingComma": false, + "transformFlags": 0 }, "name": { "kind": "Identifier", @@ -136,154 +155,201 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", - "pos": 113, - "end": 589, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Or see {@link http://www.zombocom.com }\n{@link Standalone.Complex }\nThis empty one: {@link} is OK.\nThis double-space one: {@link doubled } is OK too.\nThis should work, despite being badly formatted: {@link\noh.no\n}\nForgot to close this one {@link https://typescriptlang.org\n * But it's still OK.\nAlthough it skips the newline so parses the asterisks in the wrong state.\nThis shouldn't work: {@link\n * nope\n * }, because of the intermediate asterisks.", - "links": { - "0": { - "kind": "JSDocLink", - "pos": 120, - "end": 152, + "0": { + "kind": "JSDocText", + "pos": 113, + "end": 120, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Or see " + }, + "1": { + "kind": "JSDocLink", + "pos": 120, + "end": 152, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 127, + "end": 131, "modifierFlagsCache": 0, "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 127, - "end": 131, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "http" - } + "escapedText": "http" }, - "1": { - "kind": "JSDocLink", - "pos": 156, - "end": 183, + "text": "://www.zombocom.com " + }, + "2": { + "kind": "JSDocText", + "pos": 152, + "end": 156, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "\n" + }, + "3": { + "kind": "JSDocLink", + "pos": 156, + "end": 183, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "FirstNode", + "pos": 163, + "end": 181, "modifierFlagsCache": 0, "transformFlags": 0, - "name": { - "kind": "FirstNode", + "left": { + "kind": "Identifier", "pos": 163, - "end": 181, + "end": 173, "modifierFlagsCache": 0, "transformFlags": 0, - "left": { - "kind": "Identifier", - "pos": 163, - "end": 173, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "Standalone" - }, - "right": { - "kind": "Identifier", - "pos": 174, - "end": 181, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "Complex" - } - } - }, - "2": { - "kind": "JSDocLink", - "pos": 203, - "end": 210, - "modifierFlagsCache": 0, - "transformFlags": 0, - "name": { + "escapedText": "Standalone" + }, + "right": { "kind": "Identifier", - "pos": 209, - "end": 209, + "pos": 174, + "end": 181, "modifierFlagsCache": 0, "transformFlags": 0, - "escapedText": "" + "escapedText": "Complex" } }, - "3": { - "kind": "JSDocLink", - "pos": 244, - "end": 262, + "text": "" + }, + "4": { + "kind": "JSDocText", + "pos": 183, + "end": 203, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "\nThis empty one: " + }, + "5": { + "kind": "JSDocLink", + "pos": 203, + "end": 210, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "" + }, + "6": { + "kind": "JSDocText", + "pos": 210, + "end": 244, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " is OK.\nThis double-space one: " + }, + "7": { + "kind": "JSDocLink", + "pos": 244, + "end": 262, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 252, + "end": 259, "modifierFlagsCache": 0, "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 252, - "end": 259, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "doubled" - } + "escapedText": "doubled" }, - "4": { - "kind": "JSDocLink", - "pos": 326, - "end": 340, + "text": "" + }, + "8": { + "kind": "JSDocText", + "pos": 262, + "end": 326, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " is OK too.\nThis should work, despite being badly formatted: " + }, + "9": { + "kind": "JSDocLink", + "pos": 326, + "end": 340, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "FirstNode", + "pos": 333, + "end": 338, "modifierFlagsCache": 0, "transformFlags": 0, - "name": { - "kind": "FirstNode", + "left": { + "kind": "Identifier", "pos": 333, - "end": 338, + "end": 335, "modifierFlagsCache": 0, "transformFlags": 0, - "left": { - "kind": "Identifier", - "pos": 333, - "end": 335, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "oh" - }, - "right": { - "kind": "Identifier", - "pos": 336, - "end": 338, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "no" - } - } - }, - "5": { - "kind": "JSDocLink", - "pos": 369, - "end": 403, - "modifierFlagsCache": 0, - "transformFlags": 0, - "name": { + "escapedText": "oh" + }, + "right": { "kind": "Identifier", - "pos": 376, - "end": 381, + "pos": 336, + "end": 338, "modifierFlagsCache": 0, "transformFlags": 0, - "escapedText": "https" + "escapedText": "no" } }, - "6": { - "kind": "JSDocLink", - "pos": 526, - "end": 541, + "text": "" + }, + "10": { + "kind": "JSDocText", + "pos": 340, + "end": 369, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "\nForgot to close this one " + }, + "11": { + "kind": "JSDocLink", + "pos": 369, + "end": 403, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 376, + "end": 381, "modifierFlagsCache": 0, "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 534, - "end": 534, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "" - } + "escapedText": "https" }, - "length": 7, - "pos": 120, + "text": "://typescriptlang.org" + }, + "12": { + "kind": "JSDocText", + "pos": 403, + "end": 526, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " * But it's still OK.\nAlthough it skips the newline so parses the asterisks in the wrong state.\nThis shouldn't work: " + }, + "13": { + "kind": "JSDocLink", + "pos": 526, "end": 541, - "hasTrailingComma": false, - "transformFlags": 0 - } + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "* nope" + }, + "14": { + "kind": "JSDocText", + "pos": 541, + "end": 589, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " * }, because of the intermediate asterisks." + }, + "length": 15, + "pos": 113, + "end": 589, + "hasTrailingComma": false, + "transformFlags": 0 }, "name": { "kind": "Identifier", @@ -311,34 +377,43 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", - "pos": 597, - "end": 672, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Alfa Romero See my home page: {@link https://example.com}", - "links": { - "0": { - "kind": "JSDocLink", - "pos": 643, - "end": 670, + "0": { + "kind": "JSDocText", + "pos": 597, + "end": 624, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Alfa Romero " + }, + "1": { + "kind": "JSDocText", + "pos": 624, + "end": 643, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " See my home page: " + }, + "2": { + "kind": "JSDocLink", + "pos": 643, + "end": 670, + "modifierFlagsCache": 0, + "transformFlags": 0, + "name": { + "kind": "Identifier", + "pos": 650, + "end": 655, "modifierFlagsCache": 0, "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 650, - "end": 655, - "modifierFlagsCache": 0, - "transformFlags": 0, - "escapedText": "https" - } + "escapedText": "https" }, - "length": 1, - "pos": 643, - "end": 670, - "hasTrailingComma": false, - "transformFlags": 0 - } + "text": "://example.com" + }, + "length": 3, + "pos": 597, + "end": 672, + "hasTrailingComma": false, + "transformFlags": 0 } }, "length": 3, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json index 538fbe91bcd49..4ab0c5fe99362 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json @@ -6,11 +6,18 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 0, + "end": 19, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "bill@example.com" + }, + "length": 1, "pos": 0, "end": 19, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "bill@example.com" + "hasTrailingComma": false, + "transformFlags": 0 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json index 354c499a7e871..4a3f9c993ce46 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json @@ -6,11 +6,18 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 0, + "end": 6, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "*@a" + }, + "length": 1, "pos": 0, "end": 6, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "*@a" + "hasTrailingComma": false, + "transformFlags": 0 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json index d9ea533bf89a9..a8c8f6ed1f5fd 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json @@ -6,11 +6,18 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 0, + "end": 7, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "* @a" + }, + "length": 1, "pos": 0, "end": 7, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "* @a" + "hasTrailingComma": false, + "transformFlags": 0 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json index 7b5e597a00aad..14180aa132c60 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -21,12 +21,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 24, + "end": 34, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Doc doc" + }, + "length": 1, "pos": 24, "end": 34, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Doc doc" + "hasTrailingComma": false, + "transformFlags": 0 }, "typeExpression": { "kind": "JSDocTypeExpression", @@ -56,12 +63,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 54, + "end": 64, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Doc for f" + }, + "length": 1, "pos": 54, "end": 64, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Doc for f" + "hasTrailingComma": false, + "transformFlags": 0 }, "typeExpression": { "kind": "JSDocTypeExpression", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index 3bc35e984c160..fd3e10119d7fc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -21,12 +21,19 @@ "escapedText": "arg" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 28, + "end": 42, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Description" + }, + "length": 1, "pos": 28, "end": 42, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Description" + "hasTrailingComma": false, + "transformFlags": 0 }, "typeExpression": { "kind": "JSDocTypeExpression", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index d6cfc231ee42f..6d890214e21ea 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -21,12 +21,19 @@ "escapedText": "argument" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 33, + "end": 47, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Description" + }, + "length": 1, "pos": 33, "end": 47, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Description" + "hasTrailingComma": false, + "transformFlags": 0 }, "typeExpression": { "kind": "JSDocTypeExpression", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json index 5be4dbc03aa2c..8a850a5a8d185 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json @@ -6,11 +6,18 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 0, + "end": 21, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "* @type {number}" + }, + "length": 1, "pos": 0, "end": 21, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "* @type {number}" + "hasTrailingComma": false, + "transformFlags": 0 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index df4e7eb91c400..27350cfa2f0a1 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -21,12 +21,19 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 15, + "end": 50, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "John Doe " + }, + "length": 1, "pos": 15, "end": 50, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "John Doe " + "hasTrailingComma": false, + "transformFlags": 0 } }, "1": { @@ -44,12 +51,27 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 58, + "end": 89, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "John Doe " + }, + "1": { + "kind": "JSDocText", + "pos": 89, + "end": 112, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " unexpected comment" + }, + "length": 2, "pos": 58, "end": 112, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "John Doe unexpected comment" + "hasTrailingComma": false, + "transformFlags": 0 } }, "2": { @@ -67,12 +89,27 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 120, + "end": 146, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "108 <108@actionbutton.net>" + }, + "1": { + "kind": "JSDocText", + "pos": 146, + "end": 170, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " Video Games Forever" + }, + "length": 2, "pos": 120, "end": 170, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "108 <108@actionbutton.net> Video Games Forever" + "hasTrailingComma": false, + "transformFlags": 0 } }, "3": { @@ -90,12 +127,19 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 178, + "end": 227, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Multiple Ats " + }, + "length": 1, "pos": 178, "end": 227, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Multiple Ats " + "hasTrailingComma": false, + "transformFlags": 0 } }, "4": { @@ -113,12 +157,19 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 235, + "end": 272, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Multiple Open Carets " + }, + "length": 1, "pos": 235, "end": 272, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Multiple Open Carets " + "hasTrailingComma": false, + "transformFlags": 0 } }, "5": { @@ -136,12 +187,27 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 280, + "end": 312, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Multiple Close Carets " + }, + "1": { + "kind": "JSDocText", + "pos": 312, + "end": 338, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "invalid>but>who>cares>" + }, + "length": 2, "pos": 280, "end": 338, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Multiple Close Carets invalid>but>who>cares>" + "hasTrailingComma": false, + "transformFlags": 0 } }, "6": { @@ -159,12 +225,19 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 346, + "end": 381, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Unclosed Carets " + }, + "length": 1, "pos": 406, "end": 429, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "On One " + "hasTrailingComma": false, + "transformFlags": 0 } }, "9": { @@ -228,12 +315,19 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 437, + "end": 445, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Line" + }, + "length": 1, "pos": 437, "end": 445, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Line" + "hasTrailingComma": false, + "transformFlags": 0 } }, "10": { @@ -249,6 +343,21 @@ "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" + }, + "comment": { + "0": { + "kind": "JSDocText", + "pos": 453, + "end": 453, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "" + }, + "length": 1, + "pos": 453, + "end": 453, + "hasTrailingComma": false, + "transformFlags": 0 } }, "11": { @@ -264,6 +373,21 @@ "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" + }, + "comment": { + "0": { + "kind": "JSDocText", + "pos": 461, + "end": 461, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "" + }, + "length": 1, + "pos": 461, + "end": 461, + "hasTrailingComma": false, + "transformFlags": 0 } }, "12": { @@ -281,12 +405,19 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 469, + "end": 486, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Empty authors" + }, + "length": 1, "pos": 469, "end": 486, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Empty authors" + "hasTrailingComma": false, + "transformFlags": 0 } }, "13": { @@ -302,6 +433,21 @@ "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" + }, + "comment": { + "0": { + "kind": "JSDocText", + "pos": 497, + "end": 497, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "" + }, + "length": 1, + "pos": 497, + "end": 497, + "hasTrailingComma": false, + "transformFlags": 0 } }, "14": { @@ -319,12 +465,19 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 510, + "end": 522, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Comments" + }, + "length": 1, "pos": 510, "end": 522, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Comments" + "hasTrailingComma": false, + "transformFlags": 0 } }, "15": { @@ -342,12 +495,19 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 530, + "end": 559, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Early Close Caret > " + }, + "length": 1, "pos": 530, "end": 559, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Early Close Caret > " + "hasTrailingComma": false, + "transformFlags": 0 } }, "16": { @@ -365,12 +525,27 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 567, + "end": 582, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "No Line Breaks:" + }, + "1": { + "kind": "JSDocText", + "pos": 582, + "end": 599, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " must be on the same line to parse" + }, + "length": 1, "pos": 607, "end": 646, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "> must be on the same line to parse" + "hasTrailingComma": false, + "transformFlags": 0 } }, "18": { @@ -411,12 +593,27 @@ "escapedText": "author" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 654, + "end": 685, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Long Comment " + }, + "1": { + "kind": "JSDocText", + "pos": 685, + "end": 737, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": " I\nwant to keep commenting down here, I dunno." + }, + "length": 2, "pos": 654, "end": 737, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Long Comment I\nwant to keep commenting down here, I dunno." + "hasTrailingComma": false, + "transformFlags": 0 } }, "length": 19, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json index 1cad64c9cecdc..7605107ceae3c 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json @@ -21,12 +21,19 @@ "escapedText": "example" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 19, + "end": 53, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Some\n\ntext\r\nwith newlines." + }, + "length": 1, "pos": 19, "end": 53, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Some\n\ntext\r\nwith newlines." + "hasTrailingComma": false, + "transformFlags": 0 } }, "length": 1, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index 84dda35bc39c1..f8e11d16268ee 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -21,12 +21,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 16, + "end": 59, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "hi\n< > still part of the previous comment" + }, + "length": 1, "pos": 16, "end": 59, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "hi\n< > still part of the previous comment" + "hasTrailingComma": false, + "transformFlags": 0 }, "name": { "kind": "Identifier", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json index 0756f0cdd12f3..930c408f2d7ef 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json @@ -21,12 +21,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 19, + "end": 29, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "(@is@)" + }, + "length": 1, "pos": 19, "end": 29, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "(@is@)" + "hasTrailingComma": false, + "transformFlags": 0 }, "name": { "kind": "Identifier", @@ -55,12 +62,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 41, + "end": 50, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "its@fine" + }, + "length": 1, "pos": 41, "end": 50, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "its@fine" + "hasTrailingComma": false, + "transformFlags": 0 }, "name": { "kind": "Identifier", @@ -103,12 +117,19 @@ "escapedText": "singlestar" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 75, + "end": 89, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "*@doublestar" + }, + "length": 1, "pos": 75, "end": 89, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "*@doublestar" + "hasTrailingComma": false, + "transformFlags": 0 } }, "length": 4, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index eff8ac668e69f..08b25593b6f80 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -21,12 +21,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 30, + "end": 57, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Description text follows" + }, + "length": 1, "pos": 30, "end": 57, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Description text follows" + "hasTrailingComma": false, + "transformFlags": 0 }, "typeExpression": { "kind": "JSDocTypeExpression", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index 00ad77b4ef0f3..900f64cfa3dce 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -21,12 +21,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 31, + "end": 59, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Description text follows" + }, + "length": 1, "pos": 31, "end": 59, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Description text follows" + "hasTrailingComma": false, + "transformFlags": 0 }, "typeExpression": { "kind": "JSDocTypeExpression", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index 314c356528484..bae0654efb8e7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -21,12 +21,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 36, + "end": 64, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Description text follows" + }, + "length": 1, "pos": 36, "end": 64, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Description text follows" + "hasTrailingComma": false, + "transformFlags": 0 }, "typeExpression": { "kind": "JSDocTypeExpression", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index d4c2a7b95445b..60f217f27b69e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -21,12 +21,19 @@ "escapedText": "param" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 29, + "end": 44, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Description" + }, + "length": 1, "pos": 29, "end": 44, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Description" + "hasTrailingComma": false, + "transformFlags": 0 }, "typeExpression": { "kind": "JSDocTypeExpression", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json index 0ca532259d2f7..ca5d495760bdf 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json @@ -22,12 +22,19 @@ "escapedText": "return" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 24, + "end": 52, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Description text follows" + }, + "length": 1, "pos": 24, "end": 52, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Description text follows" + "hasTrailingComma": false, + "transformFlags": 0 }, "typeExpression": { "kind": "JSDocTypeExpression", diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json index 5105f08165d55..d8018ccefdc78 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json @@ -21,12 +21,19 @@ "escapedText": "template" }, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 24, + "end": 58, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "Description of type parameters." + }, + "length": 1, "pos": 24, "end": 58, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "Description of type parameters." + "hasTrailingComma": false, + "transformFlags": 0 }, "typeParameters": { "0": { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json index 06921f3216130..8aca030cd1436 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json @@ -6,11 +6,18 @@ "modifierFlagsCache": 0, "transformFlags": 0, "comment": { - "kind": "JSDocCommentText", + "0": { + "kind": "JSDocText", + "pos": 0, + "end": 5, + "modifierFlagsCache": 0, + "transformFlags": 0, + "text": "*" + }, + "length": 1, "pos": 0, "end": 5, - "modifierFlagsCache": 0, - "transformFlags": 0, - "text": "*" + "hasTrailingComma": false, + "transformFlags": 0 } } \ No newline at end of file diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 7ea73feb58b19..39b076ca986a2 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -416,7 +416,7 @@ declare namespace ts { JSDocVariadicType = 309, JSDocNamepathType = 310, JSDocComment = 311, - JSDocCommentText = 312, + JSDocText = 312, JSDocTypeLiteral = 313, JSDocSignature = 314, JSDocLink = 315, @@ -1744,21 +1744,21 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: JSDocCommentText; + readonly comment?: NodeArray; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: JSDocCommentText; + readonly comment?: NodeArray; } export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; + text: string; } - export interface JSDocCommentText extends Node { - readonly kind: SyntaxKind.JSDocCommentText; + export interface JSDocText extends Node { + readonly kind: SyntaxKind.JSDocText; text: string; - links?: NodeArray; } export interface JSDocUnknownTag extends JSDocTag { readonly kind: SyntaxKind.JSDocTag; @@ -3468,56 +3468,56 @@ declare namespace ts { updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName): JSDocNameReference; updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference; - createJSDocLinkNode(name: EntityName): JSDocLink; - updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink; + createJSDocLink(name: EntityName | undefined, text: string): JSDocLink; + updateJSDocLink(node: JSDocLink, name: EntityName | undefined, text: string): JSDocLink; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | JSDocCommentText | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | JSDocCommentText): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | JSDocCommentText | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | JSDocCommentText): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | JSDocCommentText | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | JSDocCommentText | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; - createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText; - updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText; - createJSDocComment(comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: string | JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + createJSDocText(text: string): JSDocText; + updateJSDocText(node: JSDocText, text: string): JSDocText; + createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -4200,6 +4200,8 @@ declare namespace ts { function getAllJSDocTags(node: Node, predicate: (tag: JSDocTag) => tag is T): readonly T[]; /** Gets all JSDoc tags of a specified kind */ function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): readonly JSDocTag[]; + /** Gets the text of a jsdoc comment, flattening links to their text. */ + function getTextOfJSDocComment(comment?: NodeArray): string | undefined; /** * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. @@ -5310,7 +5312,6 @@ declare namespace ts { getDeclarations(): Declaration[] | undefined; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; - getJsDocLinks(checker: TypeChecker): JSDocLinkInfo[]; } interface Type { getFlags(): TypeFlags; @@ -5345,7 +5346,6 @@ declare namespace ts { getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; - getJsDocLinks(): JSDocLinkInfo[]; getJsDocTags(): JSDocTagInfo[]; } interface SourceFile { @@ -6001,28 +6001,27 @@ declare namespace ts { typeParameterName = 18, enumMemberName = 19, functionName = 20, - regularExpressionLiteral = 21 + regularExpressionLiteral = 21, + link = 22 } interface SymbolDisplayPart { text: string; kind: string; } - interface JSDocTagInfo { - name: string; - text?: string; - links?: JSDocLinkInfo[]; - } - interface JSDocLinkInfo extends DocumentSpan { + interface JSDocLinkPart extends SymbolDisplayPart { name: TextSpan; target: DocumentSpan; } + interface JSDocTagInfo { + name: string; + text?: SymbolDisplayPart[]; + } interface QuickInfo { kind: ScriptElementKind; kindModifiers: string; textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; @@ -6074,7 +6073,6 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; - links: JSDocLinkInfo[]; tags: JSDocTagInfo[]; } /** @@ -6127,7 +6125,6 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; @@ -6284,7 +6281,9 @@ declare namespace ts { */ jsxAttribute = "JSX attribute", /** String literal */ - string = "string" + string = "string", + /** Jsdoc {@link entityname} */ + link = "link" } enum ScriptElementKindModifier { none = "", @@ -7236,11 +7235,6 @@ declare namespace ts.server.protocol { interface JSDocTagInfo { name: string; text?: string; - links?: JSDocLinkInfo[]; - } - interface JSDocLinkInfo extends DocumentSpan { - name: FileSpan; - target: FileSpan; } interface TextSpanWithContext extends TextSpan { contextStart?: Location; @@ -7953,6 +7947,8 @@ declare namespace ts.server.protocol { */ interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; + /** if true - return response as with documentation as display parts instead of string */ + richResponse?: boolean; } /** * Body of QuickInfoResponse. @@ -7983,19 +7979,48 @@ declare namespace ts.server.protocol { */ documentation: string; /** - * JSDoc links associated with symbol. + * JSDoc tags associated with symbol. + */ + tags: JSDocTagInfo[]; + } + /** + * RICH Body of QuickInfoResponse. + */ + interface RichQuickInfoResponseBody { + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). */ - links: JSDocLinkInfo[]; + kind: ScriptElementKind; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + /** + * Starting file location of symbol. + */ + start: Location; + /** + * One past last character of symbol. + */ + end: Location; + /** + * Type and kind of symbol. + */ + displayString: string; + /** + * Documentation associated with symbol. + */ + documentation: SymbolDisplayPart[]; /** * JSDoc tags associated with symbol. */ - tags: JSDocTagInfo[]; + tags: ts.JSDocTagInfo[]; } /** * Quickinfo response message. */ interface QuickInfoResponse extends Response { - body?: QuickInfoResponseBody; + body?: QuickInfoResponseBody | RichQuickInfoResponseBody; } /** * Arguments for format messages. @@ -8161,6 +8186,8 @@ declare namespace ts.server.protocol { interface CompletionDetailsRequest extends FileLocationRequest { command: CommandTypes.CompletionDetails; arguments: CompletionDetailsRequestArgs; + /** if true - return response as with documentation as display parts instead of string */ + richResponse?: boolean; } /** * Part of a symbol description. @@ -8259,13 +8286,47 @@ declare namespace ts.server.protocol { */ documentation?: SymbolDisplayPart[]; /** - * JSDoc links associated with symbol. + * JSDoc tags for the symbol. + */ + tags?: JSDocTagInfo[]; + /** + * The associated code actions for this entry + */ + codeActions?: CodeAction[]; + /** + * Human-readable description of the `source` from the CompletionEntry. + */ + source?: SymbolDisplayPart[]; + } + /** + * RICH Additional completion entry details, available on demand + * (It's just ts.JSDocTagInfo to get displayparts) + */ + interface RichCompletionEntryDetails { + /** + * The symbol's name. */ - links?: JSDocLinkInfo[]; + name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: ScriptElementKind; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + /** + * Display parts of the symbol (similar to quick info). + */ + displayParts: SymbolDisplayPart[]; + /** + * Documentation strings for the symbol. + */ + documentation?: SymbolDisplayPart[]; /** * JSDoc tags for the symbol. */ - tags?: JSDocTagInfo[]; + tags?: ts.JSDocTagInfo[]; /** * The associated code actions for this entry */ @@ -8295,7 +8356,7 @@ declare namespace ts.server.protocol { readonly entries: readonly CompletionEntry[]; } interface CompletionDetailsResponse extends Response { - body?: CompletionEntryDetails[]; + body?: CompletionEntryDetails[] | RichCompletionEntryDetails[]; } /** * Signature help information for a single parameter @@ -8346,10 +8407,6 @@ declare namespace ts.server.protocol { * The signature's documentation */ documentation: SymbolDisplayPart[]; - /** - * JSDoc links associated with symbol. - */ - links: JSDocLinkInfo[]; /** * The signature's JSDoc tags */ @@ -8433,12 +8490,14 @@ declare namespace ts.server.protocol { interface SignatureHelpRequest extends FileLocationRequest { command: CommandTypes.SignatureHelp; arguments: SignatureHelpRequestArgs; + /** if true - return response as with documentation as display parts instead of string */ + richResponse?: boolean; } /** * Response object for a SignatureHelpRequest. */ interface SignatureHelpResponse extends Response { - body?: SignatureHelpItems; + body?: SignatureHelpItems | ts.SignatureHelpItems; } /** * Synchronous request for semantic diagnostics of one file. @@ -10045,7 +10104,6 @@ declare namespace ts.server { private mapDefinitionInfoLocations; private getDefinitionAndBoundSpan; private getEmitOutput; - private mapJSDocLinkInfo; private mapJSDocTagInfo; private mapDefinitionInfo; private static mapToOriginalLocation; @@ -10633,51 +10691,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | JSDocCommentText | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | NodeArray | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | JSDocCommentText | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | JSDocCommentText | undefined) => JSDocAugmentsTag; + }, comment?: string | NodeArray | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | JSDocCommentText | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | JSDocCommentText | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | JSDocCommentText | undefined) => JSDocImplementsTag; + }, comment?: string | NodeArray | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: string | JSDocCommentText | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: string | NodeArray | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 2f9d046b71f43..254c501886575 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -416,7 +416,7 @@ declare namespace ts { JSDocVariadicType = 309, JSDocNamepathType = 310, JSDocComment = 311, - JSDocCommentText = 312, + JSDocText = 312, JSDocTypeLiteral = 313, JSDocSignature = 314, JSDocLink = 315, @@ -1744,21 +1744,21 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: JSDocCommentText; + readonly comment?: NodeArray; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: JSDocCommentText; + readonly comment?: NodeArray; } export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName; + text: string; } - export interface JSDocCommentText extends Node { - readonly kind: SyntaxKind.JSDocCommentText; + export interface JSDocText extends Node { + readonly kind: SyntaxKind.JSDocText; text: string; - links?: NodeArray; } export interface JSDocUnknownTag extends JSDocTag { readonly kind: SyntaxKind.JSDocTag; @@ -3468,56 +3468,56 @@ declare namespace ts { updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName): JSDocNameReference; updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference; - createJSDocLinkNode(name: EntityName): JSDocLink; - updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink; + createJSDocLink(name: EntityName | undefined, text: string): JSDocLink; + updateJSDocLink(node: JSDocLink, name: EntityName | undefined, text: string): JSDocLink; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | JSDocCommentText | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | JSDocCommentText): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | JSDocCommentText | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | JSDocCommentText): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | JSDocCommentText | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | JSDocCommentText | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | JSDocCommentText): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | JSDocCommentText | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | JSDocCommentText): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | JSDocCommentText | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | JSDocCommentText): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | JSDocCommentText | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | JSDocCommentText): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | JSDocCommentText | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | JSDocCommentText | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | JSDocCommentText): JSDocDeprecatedTag; - createJSDocCommentText(text: string, links?: readonly JSDocLink[]): JSDocCommentText; - updateJSDocCommentText(node: JSDocCommentText, text: string, links?: readonly JSDocLink[]): JSDocCommentText; - createJSDocComment(comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: string | JSDocCommentText | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + createJSDocText(text: string): JSDocText; + updateJSDocText(node: JSDocText, text: string): JSDocText; + createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -4200,6 +4200,8 @@ declare namespace ts { function getAllJSDocTags(node: Node, predicate: (tag: JSDocTag) => tag is T): readonly T[]; /** Gets all JSDoc tags of a specified kind */ function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): readonly JSDocTag[]; + /** Gets the text of a jsdoc comment, flattening links to their text. */ + function getTextOfJSDocComment(comment?: NodeArray): string | undefined; /** * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. @@ -5310,7 +5312,6 @@ declare namespace ts { getDeclarations(): Declaration[] | undefined; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; - getJsDocLinks(checker: TypeChecker): JSDocLinkInfo[]; } interface Type { getFlags(): TypeFlags; @@ -5345,7 +5346,6 @@ declare namespace ts { getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; - getJsDocLinks(): JSDocLinkInfo[]; getJsDocTags(): JSDocTagInfo[]; } interface SourceFile { @@ -6001,28 +6001,27 @@ declare namespace ts { typeParameterName = 18, enumMemberName = 19, functionName = 20, - regularExpressionLiteral = 21 + regularExpressionLiteral = 21, + link = 22 } interface SymbolDisplayPart { text: string; kind: string; } - interface JSDocTagInfo { - name: string; - text?: string; - links?: JSDocLinkInfo[]; - } - interface JSDocLinkInfo extends DocumentSpan { + interface JSDocLinkPart extends SymbolDisplayPart { name: TextSpan; target: DocumentSpan; } + interface JSDocTagInfo { + name: string; + text?: SymbolDisplayPart[]; + } interface QuickInfo { kind: ScriptElementKind; kindModifiers: string; textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; @@ -6074,7 +6073,6 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; - links: JSDocLinkInfo[]; tags: JSDocTagInfo[]; } /** @@ -6127,7 +6125,6 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; - links?: JSDocLinkInfo[]; tags?: JSDocTagInfo[]; codeActions?: CodeAction[]; source?: SymbolDisplayPart[]; @@ -6284,7 +6281,9 @@ declare namespace ts { */ jsxAttribute = "JSX attribute", /** String literal */ - string = "string" + string = "string", + /** Jsdoc {@link entityname} */ + link = "link" } enum ScriptElementKindModifier { none = "", @@ -6945,51 +6944,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | JSDocCommentText | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | NodeArray | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: string | JSDocCommentText | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | JSDocCommentText | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | JSDocCommentText | undefined) => JSDocAugmentsTag; + }, comment?: string | NodeArray | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | JSDocCommentText | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | JSDocCommentText | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | JSDocCommentText | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | JSDocCommentText | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | JSDocCommentText | undefined) => JSDocImplementsTag; + }, comment?: string | NodeArray | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | JSDocCommentText | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: string | JSDocCommentText | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: string | NodeArray | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/jsDocAliasQuickInfo.baseline b/tests/baselines/reference/jsDocAliasQuickInfo.baseline index e13a2cb997719..6b7edcf24e1e1 100644 --- a/tests/baselines/reference/jsDocAliasQuickInfo.baseline +++ b/tests/baselines/reference/jsDocAliasQuickInfo.baseline @@ -51,11 +51,15 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "type", - "text": "{number}" + "text": [ + { + "text": "{number}", + "kind": "text" + } + ] } ] } @@ -112,11 +116,15 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "type", - "text": "{number}" + "text": [ + { + "text": "{number}", + "kind": "text" + } + ] } ] } @@ -153,11 +161,15 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "type", - "text": "{number}" + "text": [ + { + "text": "{number}", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/jsDocTags.baseline b/tests/baselines/reference/jsDocTags.baseline index 9007d9f03b5db..35b3cca0331a4 100644 --- a/tests/baselines/reference/jsDocTags.baseline +++ b/tests/baselines/reference/jsDocTags.baseline @@ -67,11 +67,15 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "myjsdoctag", - "text": "this is a comment" + "text": [ + { + "text": "this is a comment", + "kind": "text" + } + ] } ] } @@ -114,11 +118,15 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": [ + { + "text": "comment1 comment2", + "kind": "text" + } + ] } ] } @@ -191,11 +199,15 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": [ + { + "text": "comment1 comment2", + "kind": "text" + } + ] } ] } @@ -269,7 +281,6 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "mytag" @@ -346,11 +357,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "returns", - "text": "a value" + "text": [ + { + "text": "a value", + "kind": "text" + } + ] } ] } @@ -440,15 +455,32 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "param", - "text": "foo A value." + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value.", + "kind": "text" + } + ] }, { "name": "returns", - "text": "Another value" + "text": [ + { + "text": "Another value", + "kind": "text" + } + ] }, { "name": "mytag" @@ -511,11 +543,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": [ + { + "text": "comment1 comment2", + "kind": "text" + } + ] } ] } @@ -575,15 +611,24 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "mytag1", - "text": "some comments\nsome more comments about mytag1" + "text": [ + { + "text": "some comments\nsome more comments about mytag1", + "kind": "text" + } + ] }, { "name": "mytag2", - "text": "here all the comments are on a new line" + "text": [ + { + "text": "here all the comments are on a new line", + "kind": "text" + } + ] }, { "name": "mytag3" @@ -657,7 +702,6 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "mytag" diff --git a/tests/baselines/reference/jsDocTypeTag1.js b/tests/baselines/reference/jsDocTypeTag1.js index c9674d5b1d0b7..9cbb0b49e34b1 100644 --- a/tests/baselines/reference/jsDocTypeTag1.js +++ b/tests/baselines/reference/jsDocTypeTag1.js @@ -38,11 +38,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{String}" + "text": [ + { + "text": "{String}", + "kind": "text" + } + ] } ] } @@ -86,11 +90,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{Number}" + "text": [ + { + "text": "{Number}", + "kind": "text" + } + ] } ] } @@ -134,11 +142,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{Boolean}" + "text": [ + { + "text": "{Boolean}", + "kind": "text" + } + ] } ] } @@ -182,11 +194,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{Void}" + "text": [ + { + "text": "{Void}", + "kind": "text" + } + ] } ] } @@ -230,11 +246,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{Undefined}" + "text": [ + { + "text": "{Undefined}", + "kind": "text" + } + ] } ] } @@ -278,11 +298,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{Null}" + "text": [ + { + "text": "{Null}", + "kind": "text" + } + ] } ] } @@ -334,11 +358,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{Array}" + "text": [ + { + "text": "{Array}", + "kind": "text" + } + ] } ] } @@ -394,11 +422,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{Promise}" + "text": [ + { + "text": "{Promise}", + "kind": "text" + } + ] } ] } @@ -442,11 +474,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{Object}" + "text": [ + { + "text": "{Object}", + "kind": "text" + } + ] } ] } @@ -490,11 +526,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{Function}" + "text": [ + { + "text": "{Function}", + "kind": "text" + } + ] } ] } @@ -538,11 +578,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{*}" + "text": [ + { + "text": "{*}", + "kind": "text" + } + ] } ] } @@ -586,11 +630,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{?}" + "text": [ + { + "text": "{?}", + "kind": "text" + } + ] } ] } @@ -650,11 +698,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{String|Number}" + "text": [ + { + "text": "{String|Number}", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/jsDocTypeTag2.js b/tests/baselines/reference/jsDocTypeTag2.js index cecd5c558bbdb..9f4a6fce1d09d 100644 --- a/tests/baselines/reference/jsDocTypeTag2.js +++ b/tests/baselines/reference/jsDocTypeTag2.js @@ -38,11 +38,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{string}" + "text": [ + { + "text": "{string}", + "kind": "text" + } + ] } ] } @@ -86,11 +90,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{number}" + "text": [ + { + "text": "{number}", + "kind": "text" + } + ] } ] } @@ -134,11 +142,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{boolean}" + "text": [ + { + "text": "{boolean}", + "kind": "text" + } + ] } ] } @@ -182,11 +194,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{void}" + "text": [ + { + "text": "{void}", + "kind": "text" + } + ] } ] } @@ -230,11 +246,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{undefined}" + "text": [ + { + "text": "{undefined}", + "kind": "text" + } + ] } ] } @@ -278,11 +298,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{null}" + "text": [ + { + "text": "{null}", + "kind": "text" + } + ] } ] } @@ -334,11 +358,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{array}" + "text": [ + { + "text": "{array}", + "kind": "text" + } + ] } ] } @@ -394,11 +422,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{promise}" + "text": [ + { + "text": "{promise}", + "kind": "text" + } + ] } ] } @@ -442,11 +474,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{?number}" + "text": [ + { + "text": "{?number}", + "kind": "text" + } + ] } ] } @@ -490,11 +526,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{function}" + "text": [ + { + "text": "{function}", + "kind": "text" + } + ] } ] } @@ -574,11 +614,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{function (number): number}" + "text": [ + { + "text": "{function (number): number}", + "kind": "text" + } + ] } ] } @@ -638,11 +682,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "type", - "text": "{string | number}" + "text": [ + { + "text": "{string | number}", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/jsDocTypedef1.js b/tests/baselines/reference/jsDocTypedef1.js index 8149745ce1f47..0bc00965e94da 100644 --- a/tests/baselines/reference/jsDocTypedef1.js +++ b/tests/baselines/reference/jsDocTypedef1.js @@ -46,11 +46,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "param", - "text": "opts" + "text": [ + { + "text": "opts", + "kind": "text" + } + ] } ] } @@ -101,8 +105,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/jsdocLink1.baseline b/tests/baselines/reference/jsdocLink1.baseline index f3a75e519fccc..1d38938436c19 100644 --- a/tests/baselines/reference/jsdocLink1.baseline +++ b/tests/baselines/reference/jsdocLink1.baseline @@ -47,17 +47,16 @@ ], "documentation": [ { - "text": "{@link C}", + "text": "", "kind": "text" - } - ], - "links": [ + }, { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 19, - "length": 9 - }, + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "{@link C}", + "kind": "link", "name": { "start": 26, "length": 1 @@ -74,14 +73,14 @@ "tags": [ { "name": "wat", - "text": "Makes a {@link C}. A default one.\n{@link C()}\n{@link C|postfix text}\n{@link unformatted postfix text}", - "links": [ + "text": [ { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 45, - "length": 9 - }, + "text": "Makes a ", + "kind": "text" + }, + { + "text": "{@link C}", + "kind": "link", "name": { "start": 52, "length": 1 @@ -95,11 +94,12 @@ } }, { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 74, - "length": 11 - }, + "text": ". A default one.\n", + "kind": "text" + }, + { + "text": "{@link C()}", + "kind": "link", "name": { "start": 81, "length": 1 @@ -113,11 +113,12 @@ } }, { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 89, - "length": 22 - }, + "text": "\n", + "kind": "text" + }, + { + "text": "{@link C|postfix text}", + "kind": "link", "name": { "start": 96, "length": 1 @@ -129,19 +130,27 @@ "length": 11 } } + }, + { + "text": "\n", + "kind": "text" + }, + { + "text": "{@link unformattedpostfix text}", + "kind": "text" } ] }, { "name": "see", - "text": "{@link C} its great", - "links": [ + "text": [ { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 156, - "length": 9 - }, + "text": "", + "kind": "text" + }, + { + "text": "{@link C}", + "kind": "link", "name": { "start": 163, "length": 1 @@ -153,6 +162,10 @@ "length": 11 } } + }, + { + "text": " its great", + "kind": "text" } ] } diff --git a/tests/baselines/reference/jsdocLink2.baseline b/tests/baselines/reference/jsdocLink2.baseline index 7b8ee8586aa54..4daa6c0193ff2 100644 --- a/tests/baselines/reference/jsdocLink2.baseline +++ b/tests/baselines/reference/jsdocLink2.baseline @@ -47,17 +47,16 @@ ], "documentation": [ { - "text": "{@link C}", + "text": "", "kind": "text" - } - ], - "links": [ + }, { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 7, - "length": 9 - }, + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "{@link C}", + "kind": "link", "name": { "start": 14, "length": 1 @@ -74,14 +73,14 @@ "tags": [ { "name": "wat", - "text": "Makes a {@link C}. A default one.\n{@link C()}\n{@link C|postfix text}\n{@link unformatted postfix text}", - "links": [ + "text": [ { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 33, - "length": 9 - }, + "text": "Makes a ", + "kind": "text" + }, + { + "text": "{@link C}", + "kind": "link", "name": { "start": 40, "length": 1 @@ -95,11 +94,12 @@ } }, { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 62, - "length": 11 - }, + "text": ". A default one.\n", + "kind": "text" + }, + { + "text": "{@link C()}", + "kind": "link", "name": { "start": 69, "length": 1 @@ -113,11 +113,12 @@ } }, { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 77, - "length": 22 - }, + "text": "\n", + "kind": "text" + }, + { + "text": "{@link C|postfix text}", + "kind": "link", "name": { "start": 84, "length": 1 @@ -129,19 +130,27 @@ "length": 11 } } + }, + { + "text": "\n", + "kind": "text" + }, + { + "text": "{@link unformattedpostfix text}", + "kind": "text" } ] }, { "name": "see", - "text": "{@link C} its great", - "links": [ + "text": [ { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 144, - "length": 9 - }, + "text": "", + "kind": "text" + }, + { + "text": "{@link C}", + "kind": "link", "name": { "start": 151, "length": 1 @@ -153,6 +162,10 @@ "length": 11 } } + }, + { + "text": " its great", + "kind": "text" } ] } diff --git a/tests/baselines/reference/jsdocLink3.baseline b/tests/baselines/reference/jsdocLink3.baseline index 04f8560c00872..9e5cb97475587 100644 --- a/tests/baselines/reference/jsdocLink3.baseline +++ b/tests/baselines/reference/jsdocLink3.baseline @@ -47,17 +47,16 @@ ], "documentation": [ { - "text": "{@link C}", + "text": "", "kind": "text" - } - ], - "links": [ + }, { - "fileName": "/module1.ts", - "textSpan": { - "start": 40, - "length": 9 - }, + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "{@link C}", + "kind": "link", "name": { "start": 47, "length": 1 @@ -74,14 +73,14 @@ "tags": [ { "name": "wat", - "text": "Makes a {@link C}. A default one.\n{@link C()}\n{@link C|postfix text}\n{@link unformatted postfix text}", - "links": [ + "text": [ { - "fileName": "/module1.ts", - "textSpan": { - "start": 66, - "length": 9 - }, + "text": "Makes a ", + "kind": "text" + }, + { + "text": "{@link C}", + "kind": "link", "name": { "start": 73, "length": 1 @@ -95,11 +94,12 @@ } }, { - "fileName": "/module1.ts", - "textSpan": { - "start": 95, - "length": 11 - }, + "text": ". A default one.\n", + "kind": "text" + }, + { + "text": "{@link C()}", + "kind": "link", "name": { "start": 102, "length": 1 @@ -113,11 +113,12 @@ } }, { - "fileName": "/module1.ts", - "textSpan": { - "start": 110, - "length": 22 - }, + "text": "\n", + "kind": "text" + }, + { + "text": "{@link C|postfix text}", + "kind": "link", "name": { "start": 117, "length": 1 @@ -129,19 +130,27 @@ "length": 18 } } + }, + { + "text": "\n", + "kind": "text" + }, + { + "text": "{@link unformattedpostfix text}", + "kind": "text" } ] }, { "name": "see", - "text": "{@link C} its great", - "links": [ + "text": [ { - "fileName": "/module1.ts", - "textSpan": { - "start": 177, - "length": 9 - }, + "text": "", + "kind": "text" + }, + { + "text": "{@link C}", + "kind": "link", "name": { "start": 184, "length": 1 @@ -153,6 +162,10 @@ "length": 18 } } + }, + { + "text": " its great", + "kind": "text" } ] } diff --git a/tests/baselines/reference/quickInfoDisplayPartsArrowFunctionExpression.baseline b/tests/baselines/reference/quickInfoDisplayPartsArrowFunctionExpression.baseline index d9572a85faccd..7ee4e5b25cd93 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsArrowFunctionExpression.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsArrowFunctionExpression.baseline @@ -73,8 +73,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -123,8 +122,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -225,8 +223,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -275,8 +272,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -325,8 +321,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -403,8 +398,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -453,8 +447,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -515,8 +508,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClass.baseline b/tests/baselines/reference/quickInfoDisplayPartsClass.baseline index ca9a31ed4a44c..0b048b737a62e 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClass.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClass.baseline @@ -25,8 +25,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -67,8 +66,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -117,8 +115,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -167,8 +164,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -197,8 +193,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClassAccessors.baseline b/tests/baselines/reference/quickInfoDisplayPartsClassAccessors.baseline index 9c7eae17ff292..b0c27fd9d288a 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClassAccessors.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClassAccessors.baseline @@ -53,8 +53,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -111,8 +110,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -169,8 +167,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -227,8 +224,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -285,8 +281,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -343,8 +338,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -401,8 +395,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -459,8 +452,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -517,8 +509,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -575,8 +566,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -633,8 +623,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -691,8 +680,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -749,8 +737,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -807,8 +794,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -865,8 +851,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -923,8 +908,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -981,8 +965,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1039,8 +1022,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1097,8 +1079,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1155,8 +1136,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1213,8 +1193,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1271,8 +1250,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1329,8 +1307,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1387,8 +1364,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1429,8 +1405,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1487,8 +1462,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1517,8 +1491,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1575,8 +1548,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1617,8 +1589,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1675,8 +1646,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1705,8 +1675,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1763,8 +1732,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClassConstructor.baseline b/tests/baselines/reference/quickInfoDisplayPartsClassConstructor.baseline index c97d9b2332a59..76ca00a4048d4 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClassConstructor.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClassConstructor.baseline @@ -45,8 +45,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -87,8 +86,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -137,8 +135,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -187,8 +184,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -217,8 +213,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -311,8 +306,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -405,8 +399,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -499,8 +492,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -541,8 +533,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -635,8 +626,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -677,8 +667,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -771,8 +760,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -821,8 +809,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -851,8 +838,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -945,8 +931,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1039,8 +1024,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1133,8 +1117,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1227,8 +1210,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1269,8 +1251,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1363,8 +1344,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1405,8 +1385,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1499,8 +1478,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1541,8 +1519,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1635,8 +1612,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1685,8 +1661,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1715,8 +1690,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClassMethod.baseline b/tests/baselines/reference/quickInfoDisplayPartsClassMethod.baseline index 6de16be799548..d6f3f187d02cf 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClassMethod.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClassMethod.baseline @@ -61,8 +61,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -127,8 +126,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -193,8 +191,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -259,8 +256,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -325,8 +321,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -391,8 +386,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -457,8 +451,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -523,8 +516,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -589,8 +581,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -655,8 +646,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -721,8 +711,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -787,8 +776,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -829,8 +817,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -895,8 +882,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -925,8 +911,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -991,8 +976,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsClassProperty.baseline b/tests/baselines/reference/quickInfoDisplayPartsClassProperty.baseline index 674286ef5a2b5..b49fb80c38a91 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsClassProperty.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsClassProperty.baseline @@ -53,8 +53,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -111,8 +110,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -169,8 +167,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -227,8 +224,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -285,8 +281,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -343,8 +338,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -401,8 +395,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -459,8 +452,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -517,8 +509,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -575,8 +566,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -633,8 +623,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -691,8 +680,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -733,8 +721,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -791,8 +778,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -821,8 +807,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -879,8 +864,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsConst.baseline b/tests/baselines/reference/quickInfoDisplayPartsConst.baseline index aea2009e89ab8..7493d001bd394 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsConst.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsConst.baseline @@ -37,8 +37,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -79,8 +78,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -121,8 +119,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -163,8 +160,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -205,8 +201,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -255,8 +250,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -297,8 +291,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -359,8 +352,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -421,8 +413,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -483,8 +474,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -545,8 +535,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -691,8 +680,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -837,8 +825,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -983,8 +970,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1089,8 +1075,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1195,8 +1180,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsEnum1.baseline b/tests/baselines/reference/quickInfoDisplayPartsEnum1.baseline index 82e11a409eb26..6dc27a4a5b33d 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsEnum1.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsEnum1.baseline @@ -25,8 +25,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -87,8 +86,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -149,8 +147,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -211,8 +208,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -253,8 +249,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -283,8 +278,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -325,8 +319,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -355,8 +348,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -417,8 +409,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -459,8 +450,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -489,8 +479,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -551,8 +540,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -593,8 +581,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -623,8 +610,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -685,8 +671,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -723,8 +708,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -785,8 +769,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -847,8 +830,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -909,8 +891,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -951,8 +932,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -989,8 +969,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1031,8 +1010,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1069,8 +1047,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1131,8 +1108,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1173,8 +1149,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1211,8 +1186,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1273,8 +1247,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1315,8 +1288,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1353,8 +1325,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1415,8 +1386,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsEnum2.baseline b/tests/baselines/reference/quickInfoDisplayPartsEnum2.baseline index 8c814e57e0257..43d0683faef80 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsEnum2.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsEnum2.baseline @@ -25,8 +25,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -91,8 +90,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -157,8 +155,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -223,8 +220,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -265,8 +261,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -295,8 +290,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -337,8 +331,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -367,8 +360,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -433,8 +425,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -475,8 +466,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -505,8 +495,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -571,8 +560,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -613,8 +601,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -643,8 +630,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -709,8 +695,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -747,8 +732,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -813,8 +797,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -879,8 +862,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -945,8 +927,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -987,8 +968,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1025,8 +1005,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1067,8 +1046,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1105,8 +1083,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1171,8 +1148,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1213,8 +1189,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1251,8 +1226,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1317,8 +1291,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1359,8 +1332,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1397,8 +1369,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1463,8 +1434,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsEnum3.baseline b/tests/baselines/reference/quickInfoDisplayPartsEnum3.baseline index 20eaa28bca5b9..b9f6483f63ae5 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsEnum3.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsEnum3.baseline @@ -25,8 +25,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -91,8 +90,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -157,8 +155,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -223,8 +220,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -265,8 +261,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -295,8 +290,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -337,8 +331,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -367,8 +360,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -433,8 +425,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -475,8 +466,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -505,8 +495,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -571,8 +560,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -613,8 +601,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -643,8 +630,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -709,8 +695,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -747,8 +732,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -813,8 +797,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -879,8 +862,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -945,8 +927,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -987,8 +968,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1025,8 +1005,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1067,8 +1046,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1105,8 +1083,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1171,8 +1148,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1213,8 +1189,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1251,8 +1226,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1317,8 +1291,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1359,8 +1332,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1397,8 +1369,7 @@ "kind": "enumName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1463,8 +1434,7 @@ "kind": "numericLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsExternalModuleAlias_file0.baseline b/tests/baselines/reference/quickInfoDisplayPartsExternalModuleAlias_file0.baseline index efcd4b5ef0141..78667e7c6e6f4 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsExternalModuleAlias_file0.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsExternalModuleAlias_file0.baseline @@ -53,8 +53,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -83,8 +82,7 @@ "kind": "aliasName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -141,8 +139,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -199,8 +196,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -229,8 +225,7 @@ "kind": "aliasName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -287,8 +282,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsExternalModules.baseline b/tests/baselines/reference/quickInfoDisplayPartsExternalModules.baseline index b036b939713ad..fa548470a762b 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsExternalModules.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsExternalModules.baseline @@ -25,8 +25,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -67,8 +66,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -117,8 +115,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -167,8 +164,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -197,8 +193,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -247,8 +242,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -277,8 +271,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -307,8 +300,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -345,8 +337,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -387,8 +378,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -445,8 +435,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -503,8 +492,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -533,8 +521,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -571,8 +558,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -629,8 +615,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -659,8 +644,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -697,8 +681,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsFunction.baseline b/tests/baselines/reference/quickInfoDisplayPartsFunction.baseline index 0cc3039d88ae2..6ac80589629e7 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsFunction.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsFunction.baseline @@ -153,8 +153,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -247,8 +246,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -341,8 +339,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -435,8 +432,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -529,8 +525,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -623,8 +618,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -717,8 +711,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -811,8 +804,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -969,8 +961,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1063,8 +1054,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1157,8 +1147,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1251,8 +1240,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1345,8 +1333,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1439,8 +1426,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsFunctionExpression.baseline b/tests/baselines/reference/quickInfoDisplayPartsFunctionExpression.baseline index 7b32170a92613..ec943e3ac7c28 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsFunctionExpression.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsFunctionExpression.baseline @@ -57,8 +57,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -115,8 +114,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -173,8 +171,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -235,8 +232,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -293,8 +289,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -351,8 +346,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsInterface.baseline b/tests/baselines/reference/quickInfoDisplayPartsInterface.baseline index dbd6726d1508a..43b9faa9540a5 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsInterface.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsInterface.baseline @@ -25,8 +25,7 @@ "kind": "interfaceName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -67,8 +66,7 @@ "kind": "interfaceName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -97,8 +95,7 @@ "kind": "interfaceName" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsInterfaceMembers.baseline b/tests/baselines/reference/quickInfoDisplayPartsInterfaceMembers.baseline index b5b47d91b4925..4a82bd41d3044 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsInterfaceMembers.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsInterfaceMembers.baseline @@ -53,8 +53,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -119,8 +118,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -161,8 +159,7 @@ "kind": "interfaceName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -219,8 +216,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -261,8 +257,7 @@ "kind": "interfaceName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -327,8 +322,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -397,8 +391,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -439,8 +432,7 @@ "kind": "interfaceName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -517,8 +509,7 @@ "kind": "interfaceName" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline b/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline index 70e4cfe74bbf8..447ba587e1c85 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline @@ -73,8 +73,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -151,8 +150,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -237,8 +235,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -323,8 +320,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -417,8 +413,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -511,8 +506,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -613,8 +607,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -715,8 +708,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsLet.baseline b/tests/baselines/reference/quickInfoDisplayPartsLet.baseline index 8d936b82fed5e..2153c0b132bab 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsLet.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsLet.baseline @@ -37,8 +37,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -79,8 +78,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -121,8 +119,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -163,8 +160,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -205,8 +201,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -255,8 +250,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -297,8 +291,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -359,8 +352,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -421,8 +413,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -483,8 +474,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -545,8 +535,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -691,8 +680,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -837,8 +825,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -983,8 +970,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1089,8 +1075,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1195,8 +1180,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsLiteralLikeNames01.baseline b/tests/baselines/reference/quickInfoDisplayPartsLiteralLikeNames01.baseline index ecafa06a68a18..47e5239c605d6 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsLiteralLikeNames01.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsLiteralLikeNames01.baseline @@ -65,8 +65,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -131,8 +130,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -197,8 +195,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -267,8 +264,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -337,8 +333,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -407,8 +402,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -473,8 +467,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -539,8 +532,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -605,8 +597,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -675,8 +666,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsLocalFunction.baseline b/tests/baselines/reference/quickInfoDisplayPartsLocalFunction.baseline index 6b531ff5d412f..65c3dc88390cb 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsLocalFunction.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsLocalFunction.baseline @@ -45,8 +45,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -211,8 +210,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -313,8 +311,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -415,8 +412,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -517,8 +513,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -619,8 +614,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -721,8 +715,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -823,8 +816,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -925,8 +917,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1091,8 +1082,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1193,8 +1183,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1295,8 +1284,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1397,8 +1385,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1499,8 +1486,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1601,8 +1587,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1651,8 +1636,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsModules.baseline b/tests/baselines/reference/quickInfoDisplayPartsModules.baseline index 4daeab1f5f354..e2f04ea75e84b 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsModules.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsModules.baseline @@ -25,8 +25,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -67,8 +66,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -117,8 +115,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -167,8 +164,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -197,8 +193,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -247,8 +242,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -277,8 +271,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -307,8 +300,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -345,8 +337,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -387,8 +378,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -445,8 +435,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -503,8 +492,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -533,8 +521,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -571,8 +558,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -629,8 +615,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -659,8 +644,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -697,8 +681,7 @@ "kind": "moduleName" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline index c11d1193e2b63..b71b006ab6dd3 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline @@ -154,11 +154,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "return", - "text": "*crunch*" + "text": [ + { + "text": "*crunch*", + "kind": "text" + } + ] } ] } @@ -209,8 +213,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -259,8 +262,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -309,8 +311,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -367,8 +368,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -417,8 +417,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -467,8 +466,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -517,8 +515,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -575,8 +572,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeAlias.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeAlias.baseline index bf329ef84aa80..49a97ac677374 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeAlias.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeAlias.baseline @@ -25,8 +25,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -71,8 +70,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -101,8 +99,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -143,8 +140,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -189,8 +185,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -239,8 +234,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline index 77fe2c8e22605..48bd280a1b505 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline @@ -37,8 +37,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -103,8 +102,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -193,8 +191,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -243,8 +240,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -309,8 +305,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -439,8 +434,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -585,8 +579,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -635,8 +628,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -781,8 +773,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -831,8 +822,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -897,8 +887,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -947,8 +936,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1001,8 +989,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1091,8 +1078,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1141,8 +1127,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1183,8 +1168,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1237,8 +1221,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1367,8 +1350,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1437,8 +1419,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1531,8 +1512,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1573,8 +1553,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1691,8 +1670,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1769,8 +1747,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1863,8 +1840,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2049,8 +2025,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2251,8 +2226,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2293,8 +2267,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2371,8 +2344,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2573,8 +2545,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2651,8 +2622,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2745,8 +2715,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2823,8 +2792,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2889,8 +2857,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3015,8 +2982,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3069,8 +3035,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3119,8 +3084,7 @@ "kind": "className" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3189,8 +3153,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3255,8 +3218,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3445,8 +3407,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3499,8 +3460,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3553,8 +3513,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunction.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunction.baseline index 04c382b94da8a..278e9396fb69c 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunction.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunction.baseline @@ -73,8 +73,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -175,8 +174,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -225,8 +223,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -327,8 +324,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -377,8 +373,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -455,8 +450,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -549,8 +543,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -667,8 +660,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -733,8 +725,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -851,8 +842,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -917,8 +907,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -995,8 +984,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunctionLikeInTypeAlias.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunctionLikeInTypeAlias.baseline index ac77618566bda..50f0ac16a1cf0 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunctionLikeInTypeAlias.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInFunctionLikeInTypeAlias.baseline @@ -69,8 +69,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -143,8 +142,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -217,8 +215,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline index 67a125bac8bf6..715811f9918a1 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline @@ -37,8 +37,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -103,8 +102,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -233,8 +231,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -283,8 +280,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -413,8 +409,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -463,8 +458,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -529,8 +523,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -659,8 +652,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -781,8 +773,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -831,8 +822,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -953,8 +943,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1003,8 +992,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1069,8 +1057,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1191,8 +1178,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1321,8 +1307,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1467,8 +1452,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1517,8 +1501,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1663,8 +1646,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1713,8 +1695,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1779,8 +1760,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1925,8 +1905,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1979,8 +1958,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2021,8 +1999,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2151,8 +2128,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2273,8 +2249,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2327,8 +2302,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2457,8 +2431,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2527,8 +2500,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2621,8 +2593,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2663,8 +2634,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2821,8 +2791,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2863,8 +2832,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -2941,8 +2909,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3099,8 +3066,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3177,8 +3143,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3271,8 +3236,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3429,8 +3393,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3579,8 +3542,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3621,8 +3583,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3699,8 +3660,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3849,8 +3809,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -3927,8 +3886,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -4021,8 +3979,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -4171,8 +4128,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -4357,8 +4313,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -4559,8 +4514,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -4601,8 +4555,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -4679,8 +4632,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -4881,8 +4833,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -4959,8 +4910,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5053,8 +5003,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5255,8 +5204,7 @@ "kind": "typeParameterName" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5321,8 +5269,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5391,8 +5338,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5433,8 +5379,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5611,8 +5556,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5665,8 +5609,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5719,8 +5662,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5889,8 +5831,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5943,8 +5884,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -5997,8 +5937,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -6063,8 +6002,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -6253,8 +6191,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -6307,8 +6244,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -6361,8 +6297,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInTypeAlias.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInTypeAlias.baseline index 060fcb3278ffd..e6f1d4512889b 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInTypeAlias.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInTypeAlias.baseline @@ -61,8 +61,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -135,8 +134,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -209,8 +207,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -291,8 +288,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -381,8 +377,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -471,8 +466,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVar.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.baseline index 2fd7ef79ccf26..b56e1b315425a 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsVar.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsVar.baseline @@ -37,8 +37,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -87,8 +86,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -129,8 +127,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -171,8 +168,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -221,8 +217,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -283,8 +278,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -345,8 +339,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -407,8 +400,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -469,8 +461,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -615,8 +606,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -761,8 +751,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -907,8 +896,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1013,8 +1001,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1119,8 +1106,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline index 0cc4b6119cb68..dfe65565790aa 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline @@ -37,8 +37,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -87,8 +86,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -129,8 +127,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -171,8 +168,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -221,8 +217,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -283,8 +278,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -345,8 +339,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -407,8 +400,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -469,8 +461,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -615,8 +606,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -761,8 +751,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -907,8 +896,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1013,8 +1001,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1119,8 +1106,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline index a80beebaaa3fa..249772f416ece 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline @@ -37,8 +37,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -87,8 +86,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -129,8 +127,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -171,8 +168,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -221,8 +217,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -283,8 +278,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -345,8 +339,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -407,8 +400,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -469,8 +461,7 @@ "kind": "keyword" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -615,8 +606,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -761,8 +751,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -907,8 +896,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1013,8 +1001,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -1119,8 +1106,7 @@ "kind": "punctuation" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVarWithStringTypes01.baseline b/tests/baselines/reference/quickInfoDisplayPartsVarWithStringTypes01.baseline index 075eea440c211..3c46a6ba6bd8b 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsVarWithStringTypes01.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsVarWithStringTypes01.baseline @@ -37,8 +37,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -79,8 +78,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } }, { @@ -137,8 +135,7 @@ "kind": "stringLiteral" } ], - "documentation": [], - "links": [] + "documentation": [] } } ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoForJSDocCodefence.baseline b/tests/baselines/reference/quickInfoForJSDocCodefence.baseline index 231a33fae311b..7587a023b520d 100644 --- a/tests/baselines/reference/quickInfoForJSDocCodefence.baseline +++ b/tests/baselines/reference/quickInfoForJSDocCodefence.baseline @@ -46,11 +46,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "example", - "text": "```\n1 + 2\n```" + "text": [ + { + "text": "```\n1 + 2\n```", + "kind": "text" + } + ] } ] } @@ -102,11 +106,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "example", - "text": "``\n1 + 2\n`" + "text": [ + { + "text": "``\n1 + 2\n`", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline b/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline index 8a669bc31edb3..d81a1b2f6c2ad 100644 --- a/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline +++ b/tests/baselines/reference/quickInfoForJSDocUnknownTag.baseline @@ -46,11 +46,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "example", - "text": "if (true) {\n foo()\n}" + "text": [ + { + "text": "if (true) {\n foo()\n}", + "kind": "text" + } + ] } ] } @@ -102,11 +106,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "example", - "text": "{\n foo()\n}" + "text": [ + { + "text": "{\n foo()\n}", + "kind": "text" + } + ] } ] } @@ -158,11 +166,15 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "example", - "text": " x y\n 12345\n b" + "text": [ + { + "text": " x y\n 12345\n b", + "kind": "text" + } + ] } ] } @@ -214,14 +226,18 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "func" }, { "name": "example", - "text": " x y\n 12345\n b" + "text": [ + { + "text": " x y\n 12345\n b", + "kind": "text" + } + ] } ] } @@ -273,14 +289,18 @@ } ], "documentation": [], - "links": [], "tags": [ { "name": "func" }, { "name": "example", - "text": "x y\n12345\n b" + "text": [ + { + "text": "x y\n12345\n b", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTags1.baseline b/tests/baselines/reference/quickInfoJsDocTags1.baseline index 1248efede1881..379f5e704aa31 100644 --- a/tests/baselines/reference/quickInfoJsDocTags1.baseline +++ b/tests/baselines/reference/quickInfoJsDocTags1.baseline @@ -67,43 +67,127 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "author", - "text": "Me " + "text": [ + { + "text": "Me ", + "kind": "text" + } + ] }, { "name": "augments", - "text": "C Augments it" + "text": [ + { + "text": "C", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Augments it", + "kind": "text" + } + ] }, { "name": "template", - "text": "T A template" + "text": [ + { + "text": "T", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A template", + "kind": "text" + } + ] }, { "name": "type", - "text": "{number | string} A type" + "text": [ + { + "text": "{number | string}", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A type", + "kind": "text" + } + ] }, { "name": "typedef", - "text": "NumOrStr" + "text": [ + { + "text": "NumOrStr", + "kind": "text" + } + ] }, { "name": "property", - "text": "{number} x The prop" + "text": [ + { + "text": "{number} x The prop", + "kind": "text" + } + ] }, { "name": "param", - "text": "x The param" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The param", + "kind": "text" + } + ] }, { "name": "returns", - "text": "The result" + "text": [ + { + "text": "The result", + "kind": "text" + } + ] }, { "name": "see", - "text": "x (the parameter)" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(the parameter)", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTags3.baseline b/tests/baselines/reference/quickInfoJsDocTags3.baseline index ea2de1ce444f7..a8e1b84114022 100644 --- a/tests/baselines/reference/quickInfoJsDocTags3.baseline +++ b/tests/baselines/reference/quickInfoJsDocTags3.baseline @@ -67,27 +67,75 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "author", - "text": "Me " + "text": [ + { + "text": "Me ", + "kind": "text" + } + ] }, { "name": "see", - "text": "x (the parameter)" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(the parameter)", + "kind": "text" + } + ] }, { "name": "param", - "text": "x - x comment" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- x comment", + "kind": "text" + } + ] }, { "name": "param", - "text": "y - y comment" + "text": [ + { + "text": "y", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- y comment", + "kind": "text" + } + ] }, { "name": "throws", - "text": "{Error} comment" + "text": [ + { + "text": "{Error} comment", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTags4.baseline b/tests/baselines/reference/quickInfoJsDocTags4.baseline index 92ca08e5d5eb5..3e223cbcc66a0 100644 --- a/tests/baselines/reference/quickInfoJsDocTags4.baseline +++ b/tests/baselines/reference/quickInfoJsDocTags4.baseline @@ -107,27 +107,75 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "author", - "text": "Me " + "text": [ + { + "text": "Me ", + "kind": "text" + } + ] }, { "name": "see", - "text": "x (the parameter)" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(the parameter)", + "kind": "text" + } + ] }, { "name": "param", - "text": "x - x comment" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- x comment", + "kind": "text" + } + ] }, { "name": "param", - "text": "y - y comment" + "text": [ + { + "text": "y", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- y comment", + "kind": "text" + } + ] }, { "name": "returns", - "text": "The result" + "text": [ + { + "text": "The result", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTags5.js b/tests/baselines/reference/quickInfoJsDocTags5.js index 27aca23f8e605..c4b80bd0eeed3 100644 --- a/tests/baselines/reference/quickInfoJsDocTags5.js +++ b/tests/baselines/reference/quickInfoJsDocTags5.js @@ -107,27 +107,75 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "author", - "text": "Me " + "text": [ + { + "text": "Me ", + "kind": "text" + } + ] }, { "name": "see", - "text": "x (the parameter)" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(the parameter)", + "kind": "text" + } + ] }, { "name": "param", - "text": "x - x comment" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- x comment", + "kind": "text" + } + ] }, { "name": "param", - "text": "y - y comment" + "text": [ + { + "text": "y", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- y comment", + "kind": "text" + } + ] }, { "name": "returns", - "text": "The result" + "text": [ + { + "text": "The result", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTags6.js b/tests/baselines/reference/quickInfoJsDocTags6.js index e04be08f0757c..6514e0feebf52 100644 --- a/tests/baselines/reference/quickInfoJsDocTags6.js +++ b/tests/baselines/reference/quickInfoJsDocTags6.js @@ -107,27 +107,75 @@ "kind": "text" } ], - "links": [], "tags": [ { "name": "author", - "text": "Me " + "text": [ + { + "text": "Me ", + "kind": "text" + } + ] }, { "name": "see", - "text": "x (the parameter)" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(the parameter)", + "kind": "text" + } + ] }, { "name": "param", - "text": "x - x comment" + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- x comment", + "kind": "text" + } + ] }, { "name": "param", - "text": "y - y comment" + "text": [ + { + "text": "y", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- y comment", + "kind": "text" + } + ] }, { "name": "returns", - "text": "The result" + "text": [ + { + "text": "The result", + "kind": "text" + } + ] }, { "name": "inheritDoc" diff --git a/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline b/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline index cd9e402001d19..b03ca277801b2 100644 --- a/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline +++ b/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline @@ -54,8 +54,7 @@ "text": "A language id, like `typescript`.", "kind": "text" } - ], - "links": [] + ] } } ] \ No newline at end of file From d216e93187c7789d64c2e5091f8d693ffe7bca30 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:26:19 -0800 Subject: [PATCH 27/44] fix lint --- src/compiler/checker.ts | 2 +- src/compiler/emitter.ts | 4 ++-- src/compiler/parser.ts | 24 +++++++++---------- src/compiler/utilitiesPublic.ts | 2 +- src/harness/client.ts | 4 ++-- src/services/jsDoc.ts | 6 ++--- src/services/types.ts | 4 ++-- src/services/utilities.ts | 8 +++---- src/testRunner/unittests/tsserver/jsdocTag.ts | 12 +++++----- 9 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d91ee3b311093..121eb184489fe 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5146,7 +5146,7 @@ namespace ts { function preserveCommentsOn(node: T) { if (some(propertySymbol.declarations, d => d.kind === SyntaxKind.JSDocPropertyTag)) { const d = find(propertySymbol.declarations, d => d.kind === SyntaxKind.JSDocPropertyTag)! as JSDocPropertyTag; - const commentText = getTextOfJSDocComment(d.comment) + const commentText = getTextOfJSDocComment(d.comment); if (commentText) { setSyntheticLeadingComments(node, [{ kind: SyntaxKind.MultiLineCommentTrivia, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 93faf94ecd054..a03039932b20c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3578,7 +3578,7 @@ namespace ts { // function emitJSDoc(node: JSDoc) { write("/**"); - const text = getTextOfJSDocComment(node.comment) + const text = getTextOfJSDocComment(node.comment); if (text) { const lines = text.split(/\r\n?|\n/g); for (const line of lines) { @@ -3720,7 +3720,7 @@ namespace ts { } function emitJSDocComment(comment: NodeArray | undefined) { - const text = getTextOfJSDocComment(comment) + const text = getTextOfJSDocComment(comment); if (text) { writeSpace(); write(text); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 58edb4d851c21..246abbd6b68fd 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7394,11 +7394,11 @@ namespace ts { const link = parseLink(linkStart); if (link) { if (!linkEnd) { - removeLeadingNewlines(comments) + removeLeadingNewlines(comments); } - parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? start, commentEnd)) + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? start, commentEnd)); parts.push(link); - comments = [] + comments = []; linkEnd = scanner.getTextPos(); break; } @@ -7415,7 +7415,7 @@ namespace ts { } removeTrailingWhitespace(comments); if (comments.length) { - parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? start, commentsPos)) + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? start, commentsPos)); } if (parts.length && tags) Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set"); const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); @@ -7628,9 +7628,9 @@ namespace ts { const linkStart = scanner.getTextPos() - 1; const link = parseLink(linkStart); if (link) { - parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? commentsPos, commentEnd)) + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? commentsPos, commentEnd)); parts.push(link); - comments = [] + comments = []; linkEnd = scanner.getTextPos(); } else { @@ -7669,7 +7669,7 @@ namespace ts { removeLeadingNewlines(comments); removeTrailingWhitespace(comments); if (comments.length) { - parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? commentsPos)) + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? commentsPos)); } if (parts.length) { return createNodeArray(parts, commentsPos, scanner.getTextPos()); @@ -7688,7 +7688,7 @@ namespace ts { : undefined; const text = []; while (token() !== SyntaxKind.CloseBraceToken && token() !== SyntaxKind.NewLineTrivia) { - text.push(scanner.getTokenText()) + text.push(scanner.getTokenText()); nextTokenJSDoc(); } return finishNode(factory.createJSDocLink(name, text.join("")), start, scanner.getTextPos()); @@ -7824,12 +7824,12 @@ namespace ts { function parseAuthorTag(start: number, tagName: Identifier, indent: number, indentText: string): JSDocAuthorTag { const commentStart = getNodePos(); const textOnly = parseAuthorNameAndEmail(); - let commentEnd = scanner.getStartPos() + let commentEnd = scanner.getStartPos(); const comments = parseTrailingTagComments(start, commentEnd, indent, indentText); if (!comments) { - commentEnd = scanner.getStartPos() + commentEnd = scanner.getStartPos(); } - const allParts = concatenate([finishNode(textOnly, commentStart, commentEnd)], comments) as Array // cast away readonly + const allParts = concatenate([finishNode(textOnly, commentStart, commentEnd)], comments) as (JSDocText | JSDocLink)[]; // cast away readonly return finishNode(factory.createJSDocAuthorTag(tagName, createNodeArray(allParts, commentStart)), start); } @@ -7853,7 +7853,7 @@ namespace ts { token = nextTokenJSDoc(); } - return factory.createJSDocText(comments.join("")) + return factory.createJSDocText(comments.join("")); } function parseImplementsTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocImplementsTag { diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 9cc309d9c9229..33012aa41629d 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -897,7 +897,7 @@ namespace ts { /** Gets the text of a jsdoc comment, flattening links to their text. */ export function getTextOfJSDocComment(comment?: NodeArray) { // TODO: Stringify c.name correctly - return comment?.map(c => c.kind === SyntaxKind.JSDocText ? c.text : `{@link ${c.name}${c.text}}`).join("") + return comment?.map(c => c.kind === SyntaxKind.JSDocText ? c.text : `{@link ${c.name}${c.text}}`).join(""); } /** diff --git a/src/harness/client.ts b/src/harness/client.ts index 38988808a5a52..1c682c8c49579 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -546,7 +546,7 @@ namespace ts.server { // } // })); // } - private decodeLinkDisplayParts(tags: Array): JSDocTagInfo[] { + private decodeLinkDisplayParts(tags: (protocol.JSDocTagInfo | JSDocTagInfo)[]): JSDocTagInfo[] { return tags.map(tag => typeof tag.text === "string" ? { ...tag, text: [textPart(tag.text)] @@ -575,7 +575,7 @@ namespace ts.server { // TODO: Same here, it doesn't actually seem to be encoded const applicableSpan = encodedApplicableSpan as unknown as TextSpan; - const items = (encodedItems as Array).map(item => ({ ...item, tags: this.decodeLinkDisplayParts(item.tags) })); + const items = (encodedItems as (SignatureHelpItem | protocol.SignatureHelpItem)[]).map(item => ({ ...item, tags: this.decodeLinkDisplayParts(item.tags) })); return { items, applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; } diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 8d17bc6aa185b..f7134e0800b06 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -127,8 +127,8 @@ namespace ts.JsDoc { return tags; } - function getDisplayPartsFromComment(comment: ReadonlyArray, checker: TypeChecker | undefined) { - return comment.map(node => node.kind === SyntaxKind.JSDocText ? textPart(node.text) : linkPart(node, checker)) + function getDisplayPartsFromComment(comment: readonly (JSDocText | JSDocLink)[], checker: TypeChecker | undefined) { + return comment.map(node => node.kind === SyntaxKind.JSDocText ? textPart(node.text) : linkPart(node, checker)); } function getCommentDisplayParts(tag: JSDocTag, checker?: TypeChecker): SymbolDisplayPart[] | undefined { @@ -158,7 +158,7 @@ namespace ts.JsDoc { } function addComment(s: string) { - return comment ? [textPart(s), spacePart(), ...getDisplayPartsFromComment(comment, checker)] : [textPart(s)] + return comment ? [textPart(s), spacePart(), ...getDisplayPartsFromComment(comment, checker)] : [textPart(s)]; } } diff --git a/src/services/types.ts b/src/services/types.ts index 7183837b03c4f..180fb9cb1983a 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1044,7 +1044,7 @@ namespace ts { export interface JSDocTagInfo { name: string; - text?: Array; + text?: (SymbolDisplayPart | JSDocLinkPart)[]; } export interface QuickInfo { @@ -1052,7 +1052,7 @@ namespace ts { kindModifiers: string; textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; - documentation?: Array; + documentation?: (SymbolDisplayPart | JSDocLinkPart)[]; tags?: JSDocTagInfo[]; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index d6b85948b4b08..f2540fb2b4ab1 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -2177,12 +2177,10 @@ namespace ts { /** return type subtype reduction elimination! */ export function linkPart(link: JSDocLink, checker?: TypeChecker): SymbolDisplayPart { - if (!link.name) - return textPart(`{@link ${link.text}}`) + if (!link.name) {return textPart(`{@link ${link.text}}`);} const text = `{@link ${getTextOfNode(link.name)}${link.text}}`; const symbol = checker?.getSymbolAtLocation(link.name); - if (!symbol) - return textPart(text) + if (!symbol) {return textPart(text);} return { text, kind: SymbolDisplayPartKind[SymbolDisplayPartKind.link], @@ -2191,7 +2189,7 @@ namespace ts { fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, textSpan: createTextSpanFromNode(symbol.valueDeclaration), }, - } as JSDocLinkPart + } as JSDocLinkPart; } const carriageReturnLineFeed = "\r\n"; diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 8635fed242435..610574a3fd0fb 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -37,8 +37,8 @@ var x = 1`); tags: [{ name: "wat", text: [{ - "kind": "text", - "text": "", + kind: "text", + text: "", }, { kind: "link", // textSpan: { @@ -96,11 +96,11 @@ var x = 1`); { text: "number", kind: "keyword" } ], documentation: [{ - "kind": "text", - "text": "", + kind: "text", + text: "", }, { - "kind": "lineBreak", - "text": "\n", + kind: "lineBreak", + text: "\n", }, { kind: "link", name: { From 6b2bd81d21a7e03fe919dd494ecd8b99908e1dc8 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 25 Feb 2021 08:41:15 -0800 Subject: [PATCH 28/44] Fix missing newlines in inferFromUsage codefix --- src/services/codefixes/inferFromUsage.ts | 4 ++-- tests/baselines/reference/api/tsserverlibrary.d.ts | 4 ++-- tests/baselines/reference/api/typescript.d.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index 86fb258144f7f..2d158184ab0d8 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -382,14 +382,14 @@ namespace ts.codefix { } export function addJSDocTags(changes: textChanges.ChangeTracker, sourceFile: SourceFile, parent: HasJSDoc, newTags: readonly JSDocTag[]): void { - const comments = flatMap(parent.jsDoc, j => j.comment); + const comments = flatMap(parent.jsDoc, j => j.comment) as (JSDocText | JSDocLink)[]; const oldTags = flatMapToMutable(parent.jsDoc, j => j.tags); const unmergedNewTags = newTags.filter(newTag => !oldTags || !oldTags.some((tag, i) => { const merged = tryMergeJsdocTags(tag, newTag); if (merged) oldTags[i] = merged; return !!merged; })); - const tag = factory.createJSDocComment(factory.createNodeArray(comments), factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); + const tag = factory.createJSDocComment(factory.createNodeArray(intersperse(comments, factory.createJSDocText("\n"))), factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags])); const jsDocNode = parent.kind === SyntaxKind.ArrowFunction ? getJsDocNodeForArrowFunction(parent) : parent; jsDocNode.jsDoc = parent.jsDoc; jsDocNode.jsDocCache = parent.jsDocCache; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 39b076ca986a2..2f025c27ef4a8 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -6014,14 +6014,14 @@ declare namespace ts { } interface JSDocTagInfo { name: string; - text?: SymbolDisplayPart[]; + text?: (SymbolDisplayPart | JSDocLinkPart)[]; } interface QuickInfo { kind: ScriptElementKind; kindModifiers: string; textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; - documentation?: SymbolDisplayPart[]; + documentation?: (SymbolDisplayPart | JSDocLinkPart)[]; tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 254c501886575..a0401b68aab17 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -6014,14 +6014,14 @@ declare namespace ts { } interface JSDocTagInfo { name: string; - text?: SymbolDisplayPart[]; + text?: (SymbolDisplayPart | JSDocLinkPart)[]; } interface QuickInfo { kind: ScriptElementKind; kindModifiers: string; textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; - documentation?: SymbolDisplayPart[]; + documentation?: (SymbolDisplayPart | JSDocLinkPart)[]; tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; From 624c8f76366bc79f17107755f4b6044c8b1bb6b2 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 3 Mar 2021 10:42:10 -0800 Subject: [PATCH 29/44] Parse jsdoc comments as text node/link array And switch to line+character offsets in the protocol --- src/server/protocol.ts | 94 +- src/server/session.ts | 93 +- src/services/types.ts | 2 +- src/services/utilities.ts | 7 +- src/testRunner/unittests/tsserver/jsdocTag.ts | 24 +- .../unittests/tsserver/webServer.ts | 1 - .../reference/api/tsserverlibrary.d.ts | 79 +- tests/baselines/reference/api/typescript.d.ts | 2 +- .../completionsCommentsClass.baseline | 180 +- .../completionsCommentsClassMembers.baseline | 1455 +++++- ...completionsCommentsCommentParsing.baseline | 4088 +++++++++++++++-- ...etionsCommentsFunctionDeclaration.baseline | 585 ++- ...letionsCommentsFunctionExpression.baseline | 896 +++- ...hodsOnAssignedFunctionExpressions.baseline | 15 +- .../jsDocDontBreakWithNamespaces.baseline | 14 +- .../jsDocFunctionSignatures5.baseline | 67 +- .../jsDocFunctionSignatures6.baseline | 240 +- tests/baselines/reference/jsdocLink1.baseline | 38 +- tests/baselines/reference/jsdocLink2.baseline | 38 +- tests/baselines/reference/jsdocLink3.baseline | 38 +- .../reference/jsdocReturnsTag.baseline | 28 +- .../reference/quickInfoAlias.baseline | 14 +- .../quickInfoCommentsClassMembers.baseline | 45 +- .../quickInfoCommentsCommentParsing.baseline | 662 ++- ...ickInfoCommentsFunctionExpression.baseline | 148 +- .../reference/quickInfoJSDocTags.baseline | 71 +- ...ckInfoJsDocTagsFunctionOverload01.baseline | 7 +- ...ckInfoJsDocTagsFunctionOverload03.baseline | 7 +- ...ckInfoJsDocTagsFunctionOverload05.baseline | 7 +- .../quickInfoJsDocTextFormatting1.baseline | 150 +- .../signatureHelpCommentsClass.baseline | 15 +- ...gnatureHelpCommentsCommentParsing.baseline | 1294 +++++- ...reHelpCommentsFunctionDeclaration.baseline | 15 +- ...ureHelpCommentsFunctionExpression.baseline | 44 +- ...elpConstructorCallParamProperties.baseline | 15 +- .../reference/signatureHelpJSDocTags.baseline | 21 +- ...natureHelpJSMissingPropertyAccess.baseline | 60 +- .../signatureHelpTypeArguments2.baseline | 268 +- .../signatureHelpWithUnknown.baseline | 15 +- .../trailingCommaSignatureHelp.baseline | 15 +- 40 files changed, 9832 insertions(+), 1025 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index ba75a2dbdaa3d..826de198b8959 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -979,11 +979,19 @@ namespace ts.server.protocol { file: string; } + // TODO: JSDoc export interface JSDocTagInfo { name: string; text?: string; } + // TODO: Better JSDoc + /** Like ts.JSDocTagInfo, but with JSDocLinkParts translated to line+offset */ + export interface RichJSDocTagInfo { + name: string; + text?: (SymbolDisplayPart | JSDocLinkPart)[]; + } + export interface TextSpanWithContext extends TextSpan { contextStart?: Location; contextEnd?: Location; @@ -2037,7 +2045,7 @@ namespace ts.server.protocol { /** * JSDoc tags associated with symbol. */ - tags: ts.JSDocTagInfo[]; + tags: RichJSDocTagInfo[]; } /** @@ -2257,6 +2265,13 @@ namespace ts.server.protocol { kind: string; } + export interface JSDocLinkPart extends SymbolDisplayPart { + // TODO: JSDoc here + name: FileSpan; + // TODO: JSDoc here + target: FileSpan; + } + /** * An item found in a completion response. */ @@ -2367,7 +2382,6 @@ namespace ts.server.protocol { /** * RICH Additional completion entry details, available on demand - * (It's just ts.JSDocTagInfo to get displayparts) */ export interface RichCompletionEntryDetails { /** @@ -2395,7 +2409,7 @@ namespace ts.server.protocol { /** * JSDoc tags for the symbol. */ - tags?: ts.JSDocTagInfo[]; + tags?: RichJSDocTagInfo[]; /** * The associated code actions for this entry @@ -2501,6 +2515,47 @@ namespace ts.server.protocol { tags: JSDocTagInfo[]; } + /** + * Represents a single signature to show in signature help. + */ + export interface RichSignatureHelpItem { + + /** + * Whether the signature accepts a variable number of arguments. + */ + isVariadic: boolean; + + /** + * The prefix display parts. + */ + prefixDisplayParts: SymbolDisplayPart[]; + + /** + * The suffix display parts. + */ + suffixDisplayParts: SymbolDisplayPart[]; + + /** + * The separator display parts. + */ + separatorDisplayParts: SymbolDisplayPart[]; + + /** + * The signature helps items for the parameters. + */ + parameters: SignatureHelpParameter[]; + + /** + * The signature's documentation + */ + documentation: SymbolDisplayPart[]; + + /** + * The signature's JSDoc tags + */ + tags: RichJSDocTagInfo[]; + } + /** * Signature help items found in the response of a signature help request. */ @@ -2532,6 +2587,37 @@ namespace ts.server.protocol { argumentCount: number; } + /** + * Signature help items found in the response of a signature help request. + */ + export interface RichSignatureHelpItems { + + /** + * The signature help items. + */ + items: RichSignatureHelpItem[]; + + /** + * The span for which signature help should appear on a signature + */ + applicableSpan: TextSpan; + + /** + * The item selected in the set of available help items. + */ + selectedItemIndex: number; + + /** + * The argument selected in the set of parameters. + */ + argumentIndex: number; + + /** + * The argument count + */ + argumentCount: number; + } + export type SignatureHelpTriggerCharacter = "," | "(" | "<"; export type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")"; @@ -2602,7 +2688,7 @@ namespace ts.server.protocol { * Response object for a SignatureHelpRequest. */ export interface SignatureHelpResponse extends Response { - body?: SignatureHelpItems | ts.SignatureHelpItems; + body?: SignatureHelpItems | RichSignatureHelpItems; } /** diff --git a/src/server/session.ts b/src/server/session.ts index 95c523337edee..499c2be0673ec 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1274,22 +1274,33 @@ namespace ts.server { result; } - // private mapJSDocLinkPart(parts: ts.SymbolDisplayPart[] | undefined, project: Project): protocol.SymbolDisplayPart[] { - // if (parts === undefined) { - // return []; - // } - // return parts.map(part => part.kind !== "link" ? part.text : { - // ...part, - // name: this.toFileSpan((part as JSDocLinkPart).name.fileName, (part as JSDocLinkPart).name.textSpan, project), - // target: this.toFileSpan((part as JSDocLinkPart).target.fileName, (part as JSDocLinkPart).target.textSpan, project), - // }); - // } - - // TODO: If rich version, then don't map (except...maybe the symbol links' spans need mapping??) private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined): protocol.JSDocTagInfo[] { return tags ? tags.map(tag => ({ ...tag, text: tag.text && tag.text.map(part => part.text).join("") })) : []; } + private mapRichJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project): protocol.RichJSDocTagInfo[] { + return tags ? tags.map(tag => ({ ...tag, text: this.mapDisplayParts(tag.text, project) })) : []; + } + + private mapDisplayParts(parts: (SymbolDisplayPart | JSDocLinkPart)[] | undefined, project: Project): (protocol.SymbolDisplayPart | protocol.JSDocLinkPart)[] { + if (!parts) { + return []; + } + return parts.map(part => part.kind !== "link" ? part : { + ...part, + name: this.toFileSpan((part as JSDocLinkPart).name.fileName, (part as JSDocLinkPart).name.textSpan, project), + target: this.toFileSpan((part as JSDocLinkPart).target.fileName, (part as JSDocLinkPart).target.textSpan, project), + }); + } + + private mapSignatureHelpItems(items: SignatureHelpItem[], project: Project): protocol.RichSignatureHelpItem[] { + return items.map(item => ({ + ...item, + documentation: this.mapDisplayParts(item.documentation, project), + tags: this.mapRichJSDocTagInfo(item.tags, project), + })); + } + private mapDefinitionInfo(definitions: readonly DefinitionInfo[], project: Project): readonly protocol.FileSpanWithContext[] { return definitions.map(def => this.toFileSpanWithContext(def.fileName, def.textSpan, def.contextSpan, project)); } @@ -1693,7 +1704,7 @@ namespace ts.server { return languageService.isValidBraceCompletionAtPosition(file, position, args.openingBrace.charCodeAt(0)); } - private getQuickInfoWorker(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean, partlyUnsimplifiedResult?: boolean): protocol.QuickInfoResponseBody | protocol.RichQuickInfoResponseBody | QuickInfo | undefined { + private getQuickInfoWorker(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean, richDocumentation?: boolean): protocol.QuickInfoResponseBody | protocol.RichQuickInfoResponseBody | QuickInfo | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo)); @@ -1703,30 +1714,19 @@ namespace ts.server { if (simplifiedResult) { const displayString = displayPartsToString(quickInfo.displayParts); - if (partlyUnsimplifiedResult) { - return { - kind: quickInfo.kind, - kindModifiers: quickInfo.kindModifiers, - start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), - end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), - displayString, - documentation: quickInfo.documentation || [], - tags: quickInfo.tags || [] - }; - - } - else { - const documentation = displayPartsToString(quickInfo.documentation); - return { - kind: quickInfo.kind, - kindModifiers: quickInfo.kindModifiers, - start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), - end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), - displayString, - documentation, - tags: this.mapJSDocTagInfo(quickInfo.tags) - }; - } + return { + kind: quickInfo.kind, + kindModifiers: quickInfo.kindModifiers, + start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), + end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), + displayString, + ...(richDocumentation ? { + documentation: this.mapDisplayParts(quickInfo.documentation, project), + tags: this.mapRichJSDocTagInfo(quickInfo.tags, project), + } : { + documentation: displayPartsToString(quickInfo.documentation), + tags: this.mapJSDocTagInfo(quickInfo.tags), + })}; } else { return quickInfo; @@ -1859,7 +1859,7 @@ namespace ts.server { return res; } - private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, fullResult: boolean, partlyUnsimplifiedResult?: boolean): readonly protocol.CompletionEntryDetails[] | readonly protocol.RichCompletionEntryDetails[] | readonly CompletionEntryDetails[] { + private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, fullResult: boolean, richDocumentation?: boolean): readonly protocol.CompletionEntryDetails[] | readonly protocol.RichCompletionEntryDetails[] | readonly CompletionEntryDetails[] { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); @@ -1870,13 +1870,16 @@ namespace ts.server { return project.getLanguageService().getCompletionEntryDetails(file, position, name, formattingOptions, source, this.getPreferences(file), data ? cast(data, isCompletionEntryData) : undefined); }); return fullResult ? result - : partlyUnsimplifiedResult ? result.map(details => ({ + : richDocumentation ? result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)), + documentation: this.mapDisplayParts(details.documentation, project), + tags: this.mapRichJSDocTagInfo(details.tags, project), })) : result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)), + documentation: this.mapDisplayParts(details.documentation, project), tags: this.mapJSDocTagInfo(details.tags) })); } @@ -1933,7 +1936,7 @@ namespace ts.server { !emitSkipped; } - private getSignatureHelpItems(args: protocol.SignatureHelpRequestArgs, simplifiedResult: boolean, partlyUnsimplifiedResult?: boolean): protocol.SignatureHelpItems | SignatureHelpItems | undefined { + private getSignatureHelpItems(args: protocol.SignatureHelpRequestArgs, simplifiedResult: boolean, richDocumentation?: boolean): protocol.SignatureHelpItems | protocol.RichSignatureHelpItems | SignatureHelpItems | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); @@ -1942,14 +1945,10 @@ namespace ts.server { return undefined; } - if (simplifiedResult && !partlyUnsimplifiedResult) { - const span = helpItems.applicableSpan; + if (simplifiedResult) { return { - items: helpItems.items, - applicableSpan: span, - selectedItemIndex: helpItems.selectedItemIndex, - argumentIndex: helpItems.argumentIndex, - argumentCount: helpItems.argumentCount, + ...helpItems, + items: richDocumentation ? this.mapSignatureHelpItems(helpItems.items, project) : helpItems.items, }; } else { diff --git a/src/services/types.ts b/src/services/types.ts index 37336d2765eba..3241893055ed2 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1041,7 +1041,7 @@ namespace ts { } export interface JSDocLinkPart extends SymbolDisplayPart { - name: TextSpan; // TODO: Might need to be relative to comment start (or, easier, filename+line+offset) + name: DocumentSpan; target: DocumentSpan; // TODO: Protocol needs to convert these to the protocol line+offset version } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 92006f483fb5e..cffed611f10e5 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -2188,11 +2188,14 @@ namespace ts { if (!link.name) {return textPart(`{@link ${link.text}}`);} const text = `{@link ${getTextOfNode(link.name)}${link.text}}`; const symbol = checker?.getSymbolAtLocation(link.name); - if (!symbol) {return textPart(text);} + if (!symbol?.valueDeclaration) {return textPart(text);} return { text, kind: SymbolDisplayPartKind[SymbolDisplayPartKind.link], - name: createTextSpanFromNode(link.name), + name: { + fileName: getSourceFileOfNode(link).fileName, + textSpan: createTextSpanFromNode(link.name), + }, target: { fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, textSpan: createTextSpanFromNode(symbol.valueDeclaration), diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 610574a3fd0fb..86cdf26ab471a 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -41,14 +41,12 @@ var x = 1`); text: "", }, { kind: "link", - // textSpan: { - // length: 9, - // start: 21, - // }, - // fileName: "someFile1.js", name: { - length: 1, - start: 28, + fileName: "someFile1.js", + textSpan: { + length: 1, + start: 28, + } }, target: { fileName: "someFile1.js", @@ -104,8 +102,11 @@ var x = 1`); }, { kind: "link", name: { - length: 1, - start: 23, + fileName: "someFile1.js", + textSpan: { + length: 1, + start: 23, + } }, target: { fileName: "someFile1.js", @@ -115,11 +116,6 @@ var x = 1`); } }, text: "{@link C}" - // fileName: "someFile1.js", - // textSpan: { - // length: 9, - // start: 16, - // }, }], tags: undefined, }); diff --git a/src/testRunner/unittests/tsserver/webServer.ts b/src/testRunner/unittests/tsserver/webServer.ts index 4e3eefe219812..5ea6f48a8a92b 100644 --- a/src/testRunner/unittests/tsserver/webServer.ts +++ b/src/testRunner/unittests/tsserver/webServer.ts @@ -88,7 +88,6 @@ namespace ts.projectSystem { end: { line: start.line, offset: start.offset + "numberConst".length }, displayString: "const numberConst: 10", documentation: "", - links: [], tags: [] } }); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index f5c601abe02f8..a1d83d387a90f 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -6029,7 +6029,7 @@ declare namespace ts { kind: string; } interface JSDocLinkPart extends SymbolDisplayPart { - name: TextSpan; + name: DocumentSpan; target: DocumentSpan; } interface JSDocTagInfo { @@ -7313,6 +7313,11 @@ declare namespace ts.server.protocol { name: string; text?: string; } + /** Like ts.JSDocTagInfo, but with JSDocLinkParts translated to line+offset */ + interface RichJSDocTagInfo { + name: string; + text?: (SymbolDisplayPart | JSDocLinkPart)[]; + } interface TextSpanWithContext extends TextSpan { contextStart?: Location; contextEnd?: Location; @@ -8100,7 +8105,7 @@ declare namespace ts.server.protocol { /** * JSDoc tags associated with symbol. */ - tags: ts.JSDocTagInfo[]; + tags: RichJSDocTagInfo[]; } /** * Quickinfo response message. @@ -8289,6 +8294,10 @@ declare namespace ts.server.protocol { */ kind: string; } + interface JSDocLinkPart extends SymbolDisplayPart { + name: FileSpan; + target: FileSpan; + } /** * An item found in a completion response. */ @@ -8393,7 +8402,6 @@ declare namespace ts.server.protocol { } /** * RICH Additional completion entry details, available on demand - * (It's just ts.JSDocTagInfo to get displayparts) */ interface RichCompletionEntryDetails { /** @@ -8419,7 +8427,7 @@ declare namespace ts.server.protocol { /** * JSDoc tags for the symbol. */ - tags?: ts.JSDocTagInfo[]; + tags?: RichJSDocTagInfo[]; /** * The associated code actions for this entry */ @@ -8505,6 +8513,39 @@ declare namespace ts.server.protocol { */ tags: JSDocTagInfo[]; } + /** + * Represents a single signature to show in signature help. + */ + interface RichSignatureHelpItem { + /** + * Whether the signature accepts a variable number of arguments. + */ + isVariadic: boolean; + /** + * The prefix display parts. + */ + prefixDisplayParts: SymbolDisplayPart[]; + /** + * The suffix display parts. + */ + suffixDisplayParts: SymbolDisplayPart[]; + /** + * The separator display parts. + */ + separatorDisplayParts: SymbolDisplayPart[]; + /** + * The signature helps items for the parameters. + */ + parameters: SignatureHelpParameter[]; + /** + * The signature's documentation + */ + documentation: SymbolDisplayPart[]; + /** + * The signature's JSDoc tags + */ + tags: RichJSDocTagInfo[]; + } /** * Signature help items found in the response of a signature help request. */ @@ -8530,6 +8571,31 @@ declare namespace ts.server.protocol { */ argumentCount: number; } + /** + * Signature help items found in the response of a signature help request. + */ + interface RichSignatureHelpItems { + /** + * The signature help items. + */ + items: RichSignatureHelpItem[]; + /** + * The span for which signature help should appear on a signature + */ + applicableSpan: TextSpan; + /** + * The item selected in the set of available help items. + */ + selectedItemIndex: number; + /** + * The argument selected in the set of parameters. + */ + argumentIndex: number; + /** + * The argument count + */ + argumentCount: number; + } type SignatureHelpTriggerCharacter = "," | "(" | "<"; type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")"; /** @@ -8590,7 +8656,7 @@ declare namespace ts.server.protocol { * Response object for a SignatureHelpRequest. */ interface SignatureHelpResponse extends Response { - body?: SignatureHelpItems | ts.SignatureHelpItems; + body?: SignatureHelpItems | RichSignatureHelpItems; } /** * Synchronous request for semantic diagnostics of one file. @@ -10225,6 +10291,9 @@ declare namespace ts.server { private getDefinitionAndBoundSpan; private getEmitOutput; private mapJSDocTagInfo; + private mapRichJSDocTagInfo; + private mapDisplayParts; + private mapSignatureHelpItems; private mapDefinitionInfo; private static mapToOriginalLocation; private toFileSpan; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1a855afe6f4fb..a14d0180849b1 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -6029,7 +6029,7 @@ declare namespace ts { kind: string; } interface JSDocLinkPart extends SymbolDisplayPart { - name: TextSpan; + name: DocumentSpan; target: DocumentSpan; } interface JSDocTagInfo { diff --git a/tests/baselines/reference/completionsCommentsClass.baseline b/tests/baselines/reference/completionsCommentsClass.baseline index 7b6471500b37e..4eaf4b743ea8b 100644 --- a/tests/baselines/reference/completionsCommentsClass.baseline +++ b/tests/baselines/reference/completionsCommentsClass.baseline @@ -95,7 +95,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -191,11 +204,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -263,7 +302,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -331,7 +383,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -399,7 +464,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -467,7 +545,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -535,7 +626,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -603,7 +707,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -703,7 +820,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -771,7 +901,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -839,7 +982,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, diff --git a/tests/baselines/reference/completionsCommentsClassMembers.baseline b/tests/baselines/reference/completionsCommentsClassMembers.baseline index d2a5cf992bfa8..014caab32e910 100644 --- a/tests/baselines/reference/completionsCommentsClassMembers.baseline +++ b/tests/baselines/reference/completionsCommentsClassMembers.baseline @@ -9034,7 +9034,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -9130,11 +9143,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -9202,7 +9241,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -9270,7 +9322,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -9338,7 +9403,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -9406,7 +9484,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -9474,7 +9565,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -9542,7 +9646,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -9642,7 +9759,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -9710,7 +9840,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -9778,7 +9921,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -14024,7 +14180,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -14120,11 +14289,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -14192,7 +14387,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -14260,7 +14468,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -14328,7 +14549,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -14396,7 +14630,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -14464,7 +14711,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -14532,7 +14792,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -14632,7 +14905,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -14700,7 +14986,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -14768,7 +15067,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -22422,7 +22734,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -22518,11 +22843,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -22590,7 +22941,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -22658,7 +23022,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -22726,7 +23103,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -22794,7 +23184,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -22862,7 +23265,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -22930,7 +23346,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -23030,7 +23459,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -23098,7 +23540,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -23166,7 +23621,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -26272,7 +26740,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -26368,11 +26849,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -26440,7 +26947,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -26508,7 +27028,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -26576,7 +27109,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -26644,7 +27190,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -26712,7 +27271,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -26780,7 +27352,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -26880,7 +27465,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -26948,7 +27546,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -27016,7 +27627,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -30122,7 +30746,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -30218,11 +30855,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -30290,7 +30953,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -30358,7 +31034,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -30426,7 +31115,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -30494,7 +31196,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -30562,7 +31277,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -30630,7 +31358,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -30730,7 +31471,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -30798,7 +31552,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -30866,7 +31633,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -33972,7 +34752,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -34068,11 +34861,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -34140,7 +34959,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -34208,7 +35040,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -34276,7 +35121,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -34344,7 +35202,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -34412,7 +35283,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -34480,7 +35364,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -34580,7 +35477,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -34648,7 +35558,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -34716,7 +35639,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -37822,7 +38758,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -37918,11 +38867,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -37990,7 +38965,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -38058,7 +39046,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -38126,7 +39127,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -38194,7 +39208,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -38262,7 +39289,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -38330,7 +39370,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -38430,7 +39483,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -38498,7 +39564,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -38566,7 +39645,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -41672,7 +42764,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -41768,11 +42873,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -41840,7 +42971,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -41908,7 +43052,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -41976,7 +43133,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -42044,7 +43214,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -42112,7 +43295,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -42180,7 +43376,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -42280,7 +43489,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -42348,7 +43570,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -42416,7 +43651,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -48922,7 +50170,20 @@ "tags": [ { "name": "param", - "text": "a this is first parameter a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is first parameter a", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/completionsCommentsCommentParsing.baseline b/tests/baselines/reference/completionsCommentsCommentParsing.baseline index 3c316e03108d7..0dcef668d6c4d 100644 --- a/tests/baselines/reference/completionsCommentsCommentParsing.baseline +++ b/tests/baselines/reference/completionsCommentsCommentParsing.baseline @@ -95,7 +95,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -191,11 +204,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -263,7 +302,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -331,7 +383,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -399,7 +464,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -467,7 +545,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -535,7 +626,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -603,7 +707,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -703,7 +820,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -771,7 +901,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -839,7 +982,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -3106,11 +3262,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] }, @@ -3286,30 +3468,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -3408,7 +3636,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] }, @@ -3692,27 +3933,97 @@ "tags": [ { "name": "param", - "text": "" - }, - { - "name": "param", - "text": "b this is about b" - }, - { - "name": "param", - "text": "c this is optional param c" - }, - { - "name": "param", - "text": "d this is optional param d" - }, - { - "name": "param", - "text": "e this is optional param e" - }, - { - "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] }, @@ -3780,15 +4091,38 @@ "tags": [ { "name": "paramTag", - "text": "{ number } a this is input number of paramTag" - }, - { - "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "{ number } a this is input number of paramTag", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] }, { "name": "returnType", - "text": "{ number } it is return type" + "text": [ + { + "text": "{ number } it is return type", + "kind": "text" + } + ] } ] }, @@ -3880,15 +4214,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] }, @@ -3980,11 +4345,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] }, @@ -4124,11 +4515,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] }, @@ -4336,15 +4753,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" - }, - { - "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" - }, - { - "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] }, @@ -5331,7 +5787,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -5427,11 +5896,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -5499,7 +5994,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -5567,7 +6075,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -5635,7 +6156,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -5703,7 +6237,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -5771,7 +6318,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -5839,7 +6399,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -5939,7 +6512,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -6007,7 +6593,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -6075,7 +6674,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -9309,11 +9921,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] }, @@ -9489,30 +10127,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -9611,7 +10295,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] }, @@ -9895,27 +10592,97 @@ "tags": [ { "name": "param", - "text": "" - }, - { - "name": "param", - "text": "b this is about b" - }, - { - "name": "param", - "text": "c this is optional param c" - }, - { - "name": "param", - "text": "d this is optional param d" - }, - { - "name": "param", - "text": "e this is optional param e" - }, - { - "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] }, @@ -9983,15 +10750,38 @@ "tags": [ { "name": "paramTag", - "text": "{ number } a this is input number of paramTag" - }, - { - "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "{ number } a this is input number of paramTag", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] }, { "name": "returnType", - "text": "{ number } it is return type" + "text": [ + { + "text": "{ number } it is return type", + "kind": "text" + } + ] } ] }, @@ -10083,15 +10873,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] }, @@ -10183,11 +11004,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] }, @@ -10327,11 +11174,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] }, @@ -10539,15 +11412,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" - }, - { - "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" - }, - { - "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] }, @@ -11300,7 +12212,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -11396,11 +12321,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -11468,7 +12419,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -11536,7 +12500,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -11604,7 +12581,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -11672,7 +12662,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -11740,7 +12743,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -11808,7 +12824,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -11908,7 +12937,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -11976,7 +13018,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -12044,7 +13099,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -14311,11 +15379,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] }, @@ -14491,30 +15585,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -14613,7 +15753,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] }, @@ -14897,27 +16050,97 @@ "tags": [ { "name": "param", - "text": "" - }, - { - "name": "param", - "text": "b this is about b" - }, - { - "name": "param", - "text": "c this is optional param c" - }, - { - "name": "param", - "text": "d this is optional param d" - }, - { - "name": "param", - "text": "e this is optional param e" - }, - { - "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] }, @@ -14985,15 +16208,38 @@ "tags": [ { "name": "paramTag", - "text": "{ number } a this is input number of paramTag" - }, - { - "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "{ number } a this is input number of paramTag", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] }, { "name": "returnType", - "text": "{ number } it is return type" + "text": [ + { + "text": "{ number } it is return type", + "kind": "text" + } + ] } ] }, @@ -15085,15 +16331,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] }, @@ -15185,11 +16462,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] }, @@ -15329,11 +16632,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] }, @@ -15541,15 +16870,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" - }, - { - "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" - }, - { - "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] }, @@ -16320,7 +17688,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -16416,11 +17797,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -16488,7 +17895,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -16556,7 +17976,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -16624,7 +18057,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -16692,7 +18138,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -16760,7 +18219,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -16828,7 +18300,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -16928,7 +18413,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -16996,7 +18494,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -17064,7 +18575,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -19331,11 +20855,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] }, @@ -19511,30 +21061,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -19633,7 +21229,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] }, @@ -19917,27 +21526,97 @@ "tags": [ { "name": "param", - "text": "" - }, - { - "name": "param", - "text": "b this is about b" - }, - { - "name": "param", - "text": "c this is optional param c" - }, - { - "name": "param", - "text": "d this is optional param d" - }, - { - "name": "param", - "text": "e this is optional param e" - }, - { - "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] }, @@ -20005,15 +21684,38 @@ "tags": [ { "name": "paramTag", - "text": "{ number } a this is input number of paramTag" - }, - { - "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "{ number } a this is input number of paramTag", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] }, { "name": "returnType", - "text": "{ number } it is return type" + "text": [ + { + "text": "{ number } it is return type", + "kind": "text" + } + ] } ] }, @@ -20105,15 +21807,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] }, @@ -20205,11 +21938,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] }, @@ -20349,11 +22108,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] }, @@ -20561,15 +22346,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" - }, - { - "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" - }, - { - "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] }, @@ -21318,7 +23142,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -21414,11 +23251,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -21486,7 +23349,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -21554,7 +23430,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -21622,7 +23511,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -21690,7 +23592,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -21758,7 +23673,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -21826,7 +23754,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -21926,7 +23867,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -21994,7 +23948,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -22062,7 +24029,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -24329,11 +26309,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] }, @@ -24509,30 +26515,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -24631,7 +26683,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] }, @@ -24915,27 +26980,97 @@ "tags": [ { "name": "param", - "text": "" - }, - { - "name": "param", - "text": "b this is about b" - }, - { - "name": "param", - "text": "c this is optional param c" - }, - { - "name": "param", - "text": "d this is optional param d" - }, - { - "name": "param", - "text": "e this is optional param e" - }, - { - "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] }, @@ -25003,15 +27138,38 @@ "tags": [ { "name": "paramTag", - "text": "{ number } a this is input number of paramTag" - }, - { - "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "{ number } a this is input number of paramTag", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] }, { "name": "returnType", - "text": "{ number } it is return type" + "text": [ + { + "text": "{ number } it is return type", + "kind": "text" + } + ] } ] }, @@ -25103,15 +27261,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] }, @@ -25203,11 +27392,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] }, @@ -25347,11 +27562,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] }, @@ -25559,15 +27800,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" - }, - { - "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" - }, - { - "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] }, @@ -26566,7 +28846,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -26662,11 +28955,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -26734,7 +29053,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -26802,7 +29134,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -26870,7 +29215,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -26938,7 +29296,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -27006,7 +29377,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -27074,7 +29458,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -27174,7 +29571,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -27242,7 +29652,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -27310,7 +29733,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -30544,11 +32980,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] }, @@ -30724,30 +33186,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -30846,7 +33354,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] }, @@ -31130,27 +33651,97 @@ "tags": [ { "name": "param", - "text": "" - }, - { - "name": "param", - "text": "b this is about b" - }, - { - "name": "param", - "text": "c this is optional param c" - }, - { - "name": "param", - "text": "d this is optional param d" - }, - { - "name": "param", - "text": "e this is optional param e" - }, - { - "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] }, @@ -31218,15 +33809,38 @@ "tags": [ { "name": "paramTag", - "text": "{ number } a this is input number of paramTag" - }, - { - "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "{ number } a this is input number of paramTag", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] }, { "name": "returnType", - "text": "{ number } it is return type" + "text": [ + { + "text": "{ number } it is return type", + "kind": "text" + } + ] } ] }, @@ -31318,15 +33932,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] }, @@ -31418,11 +34063,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] }, @@ -31562,11 +34233,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] }, @@ -31774,15 +34471,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" - }, - { - "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" - }, - { - "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] }, @@ -32535,7 +35271,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -32631,11 +35380,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -32703,7 +35478,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -32771,7 +35559,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -32839,7 +35640,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -32907,7 +35721,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -32975,7 +35802,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -33043,7 +35883,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -33143,7 +35996,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -33211,7 +36077,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -33279,7 +36158,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -35546,11 +38438,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] }, @@ -35726,30 +38644,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -35848,7 +38812,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] }, @@ -36132,27 +39109,97 @@ "tags": [ { "name": "param", - "text": "" - }, - { - "name": "param", - "text": "b this is about b" - }, - { - "name": "param", - "text": "c this is optional param c" - }, - { - "name": "param", - "text": "d this is optional param d" - }, - { - "name": "param", - "text": "e this is optional param e" - }, - { - "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] }, @@ -36220,15 +39267,38 @@ "tags": [ { "name": "paramTag", - "text": "{ number } a this is input number of paramTag" - }, - { - "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "{ number } a this is input number of paramTag", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] }, { "name": "returnType", - "text": "{ number } it is return type" + "text": [ + { + "text": "{ number } it is return type", + "kind": "text" + } + ] } ] }, @@ -36320,15 +39390,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] }, @@ -36420,11 +39521,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] }, @@ -36564,11 +39691,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] }, @@ -36776,15 +39929,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" - }, - { - "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" - }, - { - "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] }, diff --git a/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline b/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline index de8e747d5d953..44c4bf01a6191 100644 --- a/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline +++ b/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline @@ -95,7 +95,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -191,11 +204,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -263,7 +302,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -331,7 +383,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -399,7 +464,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -467,7 +545,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -535,7 +626,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -603,7 +707,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -703,7 +820,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -771,7 +901,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -839,7 +982,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -3562,7 +3718,20 @@ "tags": [ { "name": "param", - "text": "a a string" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a string", + "kind": "text" + } + ] } ] }, @@ -4434,7 +4603,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -4530,11 +4712,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -4602,7 +4810,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -4670,7 +4891,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -4738,7 +4972,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -4806,7 +5053,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -4874,7 +5134,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -4942,7 +5215,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -5042,7 +5328,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -5110,7 +5409,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -5178,7 +5490,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -6934,7 +7259,20 @@ "tags": [ { "name": "param", - "text": "a a string" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a string", + "kind": "text" + } + ] } ] }, @@ -7608,7 +7946,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -7704,11 +8055,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -7776,7 +8153,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -7844,7 +8234,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -7912,7 +8315,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -7980,7 +8396,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -8048,7 +8477,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -8116,7 +8558,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -8216,7 +8671,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -8284,7 +8752,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -8352,7 +8833,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -11075,7 +11569,20 @@ "tags": [ { "name": "param", - "text": "a a string" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a string", + "kind": "text" + } + ] } ] }, diff --git a/tests/baselines/reference/completionsCommentsFunctionExpression.baseline b/tests/baselines/reference/completionsCommentsFunctionExpression.baseline index 8c8c35f524aa8..0d1c28b095f46 100644 --- a/tests/baselines/reference/completionsCommentsFunctionExpression.baseline +++ b/tests/baselines/reference/completionsCommentsFunctionExpression.baseline @@ -95,7 +95,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -191,11 +204,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -263,7 +302,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -331,7 +383,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -399,7 +464,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -467,7 +545,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -535,7 +626,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -603,7 +707,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -703,7 +820,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -771,7 +901,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -839,7 +982,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -2744,19 +2900,55 @@ "tags": [ { "name": "param", - "text": "s param on expression" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param on expression", + "kind": "text" + } + ] }, { "name": "returns", - "text": "return on expression" + "text": [ + { + "text": "return on expression", + "kind": "text" + } + ] }, { "name": "param", - "text": "s the first parameter!" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the first parameter!", + "kind": "text" + } + ] }, { "name": "returns", - "text": "the parameter's length" + "text": [ + { + "text": "the parameter's length", + "kind": "text" + } + ] } ] }, @@ -3640,7 +3832,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -3736,11 +3941,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -3808,7 +4039,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -3876,7 +4120,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -3944,7 +4201,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -4012,7 +4282,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -4080,7 +4363,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -4148,7 +4444,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -4248,7 +4557,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -4316,7 +4638,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -4384,7 +4719,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -7256,19 +7604,55 @@ "tags": [ { "name": "param", - "text": "s param on expression" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param on expression", + "kind": "text" + } + ] }, { "name": "returns", - "text": "return on expression" + "text": [ + { + "text": "return on expression", + "kind": "text" + } + ] }, { "name": "param", - "text": "s the first parameter!" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the first parameter!", + "kind": "text" + } + ] }, { "name": "returns", - "text": "the parameter's length" + "text": [ + { + "text": "the parameter's length", + "kind": "text" + } + ] } ] }, @@ -8140,7 +8524,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -8236,11 +8633,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -8308,7 +8731,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -8376,7 +8812,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -8444,7 +8893,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -8512,7 +8974,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -8580,7 +9055,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -8648,7 +9136,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -8748,7 +9249,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -8816,7 +9330,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -8884,7 +9411,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -10789,19 +11329,55 @@ "tags": [ { "name": "param", - "text": "s param on expression" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param on expression", + "kind": "text" + } + ] }, { "name": "returns", - "text": "return on expression" + "text": [ + { + "text": "return on expression", + "kind": "text" + } + ] }, { "name": "param", - "text": "s the first parameter!" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the first parameter!", + "kind": "text" + } + ] }, { "name": "returns", - "text": "the parameter's length" + "text": [ + { + "text": "the parameter's length", + "kind": "text" + } + ] } ] }, @@ -11685,7 +12261,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] }, @@ -11781,11 +12370,37 @@ "tags": [ { "name": "param", - "text": "s A string to convert into a number." + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] }, { "name": "param", - "text": "radix A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal." + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in numString.\r\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\nAll other strings are considered decimal.", + "kind": "text" + } + ] } ] }, @@ -11853,7 +12468,20 @@ "tags": [ { "name": "param", - "text": "string A string that contains a floating-point number." + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] } ] }, @@ -11921,7 +12549,20 @@ "tags": [ { "name": "param", - "text": "number A numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] } ] }, @@ -11989,7 +12630,20 @@ "tags": [ { "name": "param", - "text": "number Any numeric value." + "text": [ + { + "text": "number", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] } ] }, @@ -12057,7 +12711,20 @@ "tags": [ { "name": "param", - "text": "encodedURI A value representing an encoded URI." + "text": [ + { + "text": "encodedURI", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -12125,7 +12792,20 @@ "tags": [ { "name": "param", - "text": "encodedURIComponent A value representing an encoded URI component." + "text": [ + { + "text": "encodedURIComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -12193,7 +12873,20 @@ "tags": [ { "name": "param", - "text": "uri A value representing an encoded URI." + "text": [ + { + "text": "uri", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] } ] }, @@ -12293,7 +12986,20 @@ "tags": [ { "name": "param", - "text": "uriComponent A value representing an encoded URI component." + "text": [ + { + "text": "uriComponent", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] } ] }, @@ -12361,7 +13067,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -12429,7 +13148,20 @@ "tags": [ { "name": "param", - "text": "string A string value" + "text": [ + { + "text": "string", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] } ] }, @@ -15301,19 +16033,55 @@ "tags": [ { "name": "param", - "text": "s param on expression" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param on expression", + "kind": "text" + } + ] }, { "name": "returns", - "text": "return on expression" + "text": [ + { + "text": "return on expression", + "kind": "text" + } + ] }, { "name": "param", - "text": "s the first parameter!" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the first parameter!", + "kind": "text" + } + ] }, { "name": "returns", - "text": "the parameter's length" + "text": [ + { + "text": "the parameter's length", + "kind": "text" + } + ] } ] }, diff --git a/tests/baselines/reference/completionsSalsaMethodsOnAssignedFunctionExpressions.baseline b/tests/baselines/reference/completionsSalsaMethodsOnAssignedFunctionExpressions.baseline index 2f79cc777318f..01c7bdd2ea960 100644 --- a/tests/baselines/reference/completionsSalsaMethodsOnAssignedFunctionExpressions.baseline +++ b/tests/baselines/reference/completionsSalsaMethodsOnAssignedFunctionExpressions.baseline @@ -405,7 +405,20 @@ "tags": [ { "name": "param", - "text": "a Parameter definition." + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Parameter definition.", + "kind": "text" + } + ] } ] }, diff --git a/tests/baselines/reference/jsDocDontBreakWithNamespaces.baseline b/tests/baselines/reference/jsDocDontBreakWithNamespaces.baseline index 2ea08d0385685..3618b914c58c3 100644 --- a/tests/baselines/reference/jsDocDontBreakWithNamespaces.baseline +++ b/tests/baselines/reference/jsDocDontBreakWithNamespaces.baseline @@ -52,7 +52,12 @@ "tags": [ { "name": "returns", - "text": "Websocket server object" + "text": [ + { + "text": "Websocket server object", + "kind": "text" + } + ] } ] } @@ -181,7 +186,12 @@ "tags": [ { "name": "type", - "text": "{function(module:xxxx, module:xxxx): module:xxxxx}" + "text": [ + { + "text": "{function(module:xxxx, module:xxxx): module:xxxxx}", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/jsDocFunctionSignatures5.baseline b/tests/baselines/reference/jsDocFunctionSignatures5.baseline index e24b57ba4496d..cabdccbae4361 100644 --- a/tests/baselines/reference/jsDocFunctionSignatures5.baseline +++ b/tests/baselines/reference/jsDocFunctionSignatures5.baseline @@ -182,23 +182,80 @@ "tags": [ { "name": "param", - "text": "basePath The base path where the search will be performed." + "text": [ + { + "text": "basePath", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The base path where the search will be performed.", + "kind": "text" + } + ] }, { "name": "param", - "text": "pattern A string defining a regexp of a glob pattern." + "text": [ + { + "text": "pattern", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string defining a regexp of a glob pattern.", + "kind": "text" + } + ] }, { "name": "param", - "text": "type The search pattern type, can be a regexp or a glob." + "text": [ + { + "text": "type", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The search pattern type, can be a regexp or a glob.", + "kind": "text" + } + ] }, { "name": "param", - "text": "options A object containing options to the search." + "text": [ + { + "text": "options", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A object containing options to the search.", + "kind": "text" + } + ] }, { "name": "return", - "text": "A list containing the filtered paths." + "text": [ + { + "text": "A list containing the filtered paths.", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/jsDocFunctionSignatures6.baseline b/tests/baselines/reference/jsDocFunctionSignatures6.baseline index 94ef27f867872..6703610328702 100644 --- a/tests/baselines/reference/jsDocFunctionSignatures6.baseline +++ b/tests/baselines/reference/jsDocFunctionSignatures6.baseline @@ -177,19 +177,71 @@ "tags": [ { "name": "param", - "text": "p1 - A string param" + "text": [ + { + "text": "p1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- A string param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p2 - An optional param" + "text": [ + { + "text": "p2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- An optional param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p3 - Another optional param" + "text": [ + { + "text": "p3", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- Another optional param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p4 - An optional param with a default value" + "text": [ + { + "text": "p4", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- An optional param with a default value", + "kind": "text" + } + ] } ] } @@ -381,19 +433,71 @@ "tags": [ { "name": "param", - "text": "p1 - A string param" + "text": [ + { + "text": "p1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- A string param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p2 - An optional param" + "text": [ + { + "text": "p2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- An optional param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p3 - Another optional param" + "text": [ + { + "text": "p3", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- Another optional param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p4 - An optional param with a default value" + "text": [ + { + "text": "p4", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- An optional param with a default value", + "kind": "text" + } + ] } ] } @@ -585,19 +689,71 @@ "tags": [ { "name": "param", - "text": "p1 - A string param" + "text": [ + { + "text": "p1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- A string param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p2 - An optional param" + "text": [ + { + "text": "p2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- An optional param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p3 - Another optional param" + "text": [ + { + "text": "p3", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- Another optional param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p4 - An optional param with a default value" + "text": [ + { + "text": "p4", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- An optional param with a default value", + "kind": "text" + } + ] } ] } @@ -789,19 +945,71 @@ "tags": [ { "name": "param", - "text": "p1 - A string param" + "text": [ + { + "text": "p1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- A string param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p2 - An optional param" + "text": [ + { + "text": "p2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- An optional param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p3 - Another optional param" + "text": [ + { + "text": "p3", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- Another optional param", + "kind": "text" + } + ] }, { "name": "param", - "text": "p4 - An optional param with a default value" + "text": [ + { + "text": "p4", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "- An optional param with a default value", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/jsdocLink1.baseline b/tests/baselines/reference/jsdocLink1.baseline index 1d38938436c19..1e7d085d2625b 100644 --- a/tests/baselines/reference/jsdocLink1.baseline +++ b/tests/baselines/reference/jsdocLink1.baseline @@ -2,7 +2,8 @@ { "marker": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "position": 189 + "position": 189, + "name": "" }, "quickInfo": { "kind": "function", @@ -58,8 +59,11 @@ "text": "{@link C}", "kind": "link", "name": { - "start": 26, - "length": 1 + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 26, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", @@ -82,8 +86,11 @@ "text": "{@link C}", "kind": "link", "name": { - "start": 52, - "length": 1 + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 52, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", @@ -101,8 +108,11 @@ "text": "{@link C()}", "kind": "link", "name": { - "start": 81, - "length": 1 + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 81, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", @@ -120,8 +130,11 @@ "text": "{@link C|postfix text}", "kind": "link", "name": { - "start": 96, - "length": 1 + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 96, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", @@ -152,8 +165,11 @@ "text": "{@link C}", "kind": "link", "name": { - "start": 163, - "length": 1 + "fileName": "/tests/cases/fourslash/jsdocLink1.ts", + "textSpan": { + "start": 163, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", diff --git a/tests/baselines/reference/jsdocLink2.baseline b/tests/baselines/reference/jsdocLink2.baseline index 4daa6c0193ff2..f9cff3a428f92 100644 --- a/tests/baselines/reference/jsdocLink2.baseline +++ b/tests/baselines/reference/jsdocLink2.baseline @@ -2,7 +2,8 @@ { "marker": { "fileName": "/tests/cases/fourslash/script.ts", - "position": 177 + "position": 177, + "name": "" }, "quickInfo": { "kind": "function", @@ -58,8 +59,11 @@ "text": "{@link C}", "kind": "link", "name": { - "start": 14, - "length": 1 + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 14, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", @@ -82,8 +86,11 @@ "text": "{@link C}", "kind": "link", "name": { - "start": 40, - "length": 1 + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 40, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", @@ -101,8 +108,11 @@ "text": "{@link C()}", "kind": "link", "name": { - "start": 69, - "length": 1 + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 69, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", @@ -120,8 +130,11 @@ "text": "{@link C|postfix text}", "kind": "link", "name": { - "start": 84, - "length": 1 + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 84, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", @@ -152,8 +165,11 @@ "text": "{@link C}", "kind": "link", "name": { - "start": 151, - "length": 1 + "fileName": "/tests/cases/fourslash/script.ts", + "textSpan": { + "start": 151, + "length": 1 + } }, "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", diff --git a/tests/baselines/reference/jsdocLink3.baseline b/tests/baselines/reference/jsdocLink3.baseline index 9e5cb97475587..28961e06d7c1e 100644 --- a/tests/baselines/reference/jsdocLink3.baseline +++ b/tests/baselines/reference/jsdocLink3.baseline @@ -2,7 +2,8 @@ { "marker": { "fileName": "/module1.ts", - "position": 210 + "position": 210, + "name": "" }, "quickInfo": { "kind": "function", @@ -58,8 +59,11 @@ "text": "{@link C}", "kind": "link", "name": { - "start": 47, - "length": 1 + "fileName": "/module1.ts", + "textSpan": { + "start": 47, + "length": 1 + } }, "target": { "fileName": "/jsdocLink3.ts", @@ -82,8 +86,11 @@ "text": "{@link C}", "kind": "link", "name": { - "start": 73, - "length": 1 + "fileName": "/module1.ts", + "textSpan": { + "start": 73, + "length": 1 + } }, "target": { "fileName": "/jsdocLink3.ts", @@ -101,8 +108,11 @@ "text": "{@link C()}", "kind": "link", "name": { - "start": 102, - "length": 1 + "fileName": "/module1.ts", + "textSpan": { + "start": 102, + "length": 1 + } }, "target": { "fileName": "/jsdocLink3.ts", @@ -120,8 +130,11 @@ "text": "{@link C|postfix text}", "kind": "link", "name": { - "start": 117, - "length": 1 + "fileName": "/module1.ts", + "textSpan": { + "start": 117, + "length": 1 + } }, "target": { "fileName": "/jsdocLink3.ts", @@ -152,8 +165,11 @@ "text": "{@link C}", "kind": "link", "name": { - "start": 184, - "length": 1 + "fileName": "/module1.ts", + "textSpan": { + "start": 184, + "length": 1 + } }, "target": { "fileName": "/jsdocLink3.ts", diff --git a/tests/baselines/reference/jsdocReturnsTag.baseline b/tests/baselines/reference/jsdocReturnsTag.baseline index 35366b2e59ba9..1ab8b6a24399b 100644 --- a/tests/baselines/reference/jsdocReturnsTag.baseline +++ b/tests/baselines/reference/jsdocReturnsTag.baseline @@ -114,19 +114,39 @@ "tags": [ { "name": "template", - "text": "T" + "text": [ + { + "text": "T", + "kind": "text" + } + ] }, { "name": "param", - "text": "l" + "text": [ + { + "text": "l", + "kind": "text" + } + ] }, { "name": "param", - "text": "x" + "text": [ + { + "text": "x", + "kind": "text" + } + ] }, { "name": "returns", - "text": "The names of the found item(s)." + "text": [ + { + "text": "The names of the found item(s).", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoAlias.baseline b/tests/baselines/reference/quickInfoAlias.baseline index 48872b59ff931..b295074dcd3e6 100644 --- a/tests/baselines/reference/quickInfoAlias.baseline +++ b/tests/baselines/reference/quickInfoAlias.baseline @@ -79,7 +79,12 @@ "tags": [ { "name": "tag", - "text": "Tag text" + "text": [ + { + "text": "Tag text", + "kind": "text" + } + ] } ] } @@ -164,7 +169,12 @@ "tags": [ { "name": "tag", - "text": "Tag text" + "text": [ + { + "text": "Tag text", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoCommentsClassMembers.baseline b/tests/baselines/reference/quickInfoCommentsClassMembers.baseline index f031ee57fe345..6306ede8fc434 100644 --- a/tests/baselines/reference/quickInfoCommentsClassMembers.baseline +++ b/tests/baselines/reference/quickInfoCommentsClassMembers.baseline @@ -5585,7 +5585,20 @@ "tags": [ { "name": "param", - "text": "a this is first parameter a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is first parameter a", + "kind": "text" + } + ] } ] } @@ -5746,7 +5759,20 @@ "tags": [ { "name": "param", - "text": "a this is first parameter a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is first parameter a", + "kind": "text" + } + ] } ] } @@ -5815,7 +5841,20 @@ "tags": [ { "name": "param", - "text": "a this is first parameter a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is first parameter a", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoCommentsCommentParsing.baseline b/tests/baselines/reference/quickInfoCommentsCommentParsing.baseline index 1d980ebdd6f1f..c8988eca2542e 100644 --- a/tests/baselines/reference/quickInfoCommentsCommentParsing.baseline +++ b/tests/baselines/reference/quickInfoCommentsCommentParsing.baseline @@ -800,7 +800,20 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] } ] } @@ -861,7 +874,20 @@ "tags": [ { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] } @@ -962,11 +988,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] } @@ -1027,7 +1079,20 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] } ] } @@ -1083,7 +1148,12 @@ "tags": [ { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] } ] } @@ -1139,7 +1209,12 @@ "tags": [ { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] } ] } @@ -1195,7 +1270,12 @@ "tags": [ { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] } ] } @@ -1256,7 +1336,20 @@ "tags": [ { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] } ] } @@ -1441,30 +1534,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -1672,7 +1811,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] } @@ -1777,7 +1929,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] } @@ -1888,7 +2053,20 @@ "tags": [ { "name": "param", - "text": "b this is about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] } ] } @@ -1969,7 +2147,20 @@ "tags": [ { "name": "param", - "text": "c this is optional param c" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] } ] } @@ -2050,7 +2241,20 @@ "tags": [ { "name": "param", - "text": "d this is optional param d" + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] } ] } @@ -2131,7 +2335,20 @@ "tags": [ { "name": "param", - "text": "e this is optional param e" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] } ] } @@ -2494,27 +2711,97 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is optional param c" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d this is optional param d" + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] }, { "name": "param", - "text": "e this is optional param e" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] }, { "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] } @@ -2575,7 +2862,20 @@ "tags": [ { "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] } ] } @@ -2652,15 +2952,38 @@ "tags": [ { "name": "paramTag", - "text": "{ number } a this is input number of paramTag" + "text": [ + { + "text": "{ number } a this is input number of paramTag", + "kind": "text" + } + ] }, { "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] }, { "name": "returnType", - "text": "{ number } it is return type" + "text": [ + { + "text": "{ number } it is return type", + "kind": "text" + } + ] } ] } @@ -2721,7 +3044,20 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] } ] } @@ -2782,7 +3118,20 @@ "tags": [ { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] } @@ -2883,15 +3232,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] } @@ -2952,7 +3332,20 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] } ] } @@ -3013,7 +3406,20 @@ "tags": [ { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] } @@ -3114,11 +3520,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] } @@ -3187,7 +3619,20 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] } ] } @@ -3303,7 +3748,20 @@ "tags": [ { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] } @@ -3502,11 +3960,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] } @@ -3677,7 +4161,20 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] } ] } @@ -3738,7 +4235,20 @@ "tags": [ { "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] } ] } @@ -3799,7 +4309,20 @@ "tags": [ { "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] } @@ -3924,15 +4447,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoCommentsFunctionExpression.baseline b/tests/baselines/reference/quickInfoCommentsFunctionExpression.baseline index eee453d18b898..1fc21ef81faa5 100644 --- a/tests/baselines/reference/quickInfoCommentsFunctionExpression.baseline +++ b/tests/baselines/reference/quickInfoCommentsFunctionExpression.baseline @@ -387,7 +387,20 @@ "tags": [ { "name": "param", - "text": "b inner parameter" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "inner parameter", + "kind": "text" + } + ] } ] } @@ -448,7 +461,20 @@ "tags": [ { "name": "param", - "text": "b inner parameter" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "inner parameter", + "kind": "text" + } + ] } ] } @@ -609,7 +635,20 @@ "tags": [ { "name": "param", - "text": "b inner parameter" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "inner parameter", + "kind": "text" + } + ] } ] } @@ -714,7 +753,20 @@ "tags": [ { "name": "param", - "text": "b inner parameter" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "inner parameter", + "kind": "text" + } + ] } ] } @@ -811,19 +863,55 @@ "tags": [ { "name": "param", - "text": "s param on expression" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param on expression", + "kind": "text" + } + ] }, { "name": "returns", - "text": "return on expression" + "text": [ + { + "text": "return on expression", + "kind": "text" + } + ] }, { "name": "param", - "text": "s the first parameter!" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the first parameter!", + "kind": "text" + } + ] }, { "name": "returns", - "text": "the parameter's length" + "text": [ + { + "text": "the parameter's length", + "kind": "text" + } + ] } ] } @@ -920,19 +1008,55 @@ "tags": [ { "name": "param", - "text": "s param on expression" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param on expression", + "kind": "text" + } + ] }, { "name": "returns", - "text": "return on expression" + "text": [ + { + "text": "return on expression", + "kind": "text" + } + ] }, { "name": "param", - "text": "s the first parameter!" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the first parameter!", + "kind": "text" + } + ] }, { "name": "returns", - "text": "the parameter's length" + "text": [ + { + "text": "the parameter's length", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoJSDocTags.baseline b/tests/baselines/reference/quickInfoJSDocTags.baseline index 809251945cc42..aba5c894b474d 100644 --- a/tests/baselines/reference/quickInfoJSDocTags.baseline +++ b/tests/baselines/reference/quickInfoJSDocTags.baseline @@ -71,7 +71,12 @@ "tags": [ { "name": "myjsdoctag", - "text": "this is a comment" + "text": [ + { + "text": "this is a comment", + "kind": "text" + } + ] } ] } @@ -119,7 +124,12 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": [ + { + "text": "comment1 comment2", + "kind": "text" + } + ] } ] } @@ -196,7 +206,12 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": [ + { + "text": "comment1 comment2", + "kind": "text" + } + ] } ] } @@ -353,7 +368,12 @@ "tags": [ { "name": "returns", - "text": "a value" + "text": [ + { + "text": "a value", + "kind": "text" + } + ] } ] } @@ -448,11 +468,29 @@ "tags": [ { "name": "param", - "text": "foo A value." + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value.", + "kind": "text" + } + ] }, { "name": "returns", - "text": "Another value" + "text": [ + { + "text": "Another value", + "kind": "text" + } + ] }, { "name": "mytag" @@ -519,7 +557,12 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": [ + { + "text": "comment1 comment2", + "kind": "text" + } + ] } ] } @@ -583,11 +626,21 @@ "tags": [ { "name": "mytag1", - "text": "some comments\nsome more comments about mytag1" + "text": [ + { + "text": "some comments\nsome more comments about mytag1", + "kind": "text" + } + ] }, { "name": "mytag2", - "text": "here all the comments are on a new line" + "text": [ + { + "text": "here all the comments are on a new line", + "kind": "text" + } + ] }, { "name": "mytag3" diff --git a/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload01.baseline b/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload01.baseline index 035e225d0b196..cc8957dc9b181 100644 --- a/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload01.baseline +++ b/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload01.baseline @@ -182,7 +182,12 @@ "tags": [ { "name": "tag", - "text": "Tag text" + "text": [ + { + "text": "Tag text", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload03.baseline b/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload03.baseline index bad9a67c3db53..a119b5b0d0b61 100644 --- a/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload03.baseline +++ b/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload03.baseline @@ -177,7 +177,12 @@ "tags": [ { "name": "tag", - "text": "Tag text" + "text": [ + { + "text": "Tag text", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload05.baseline b/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload05.baseline index 547c712574584..718528d3008c0 100644 --- a/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload05.baseline +++ b/tests/baselines/reference/quickInfoJsDocTagsFunctionOverload05.baseline @@ -172,7 +172,12 @@ "tags": [ { "name": "tag", - "text": "Tag text" + "text": [ + { + "text": "Tag text", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/quickInfoJsDocTextFormatting1.baseline b/tests/baselines/reference/quickInfoJsDocTextFormatting1.baseline index 24f7be4aa0312..2cdb8c5676e09 100644 --- a/tests/baselines/reference/quickInfoJsDocTextFormatting1.baseline +++ b/tests/baselines/reference/quickInfoJsDocTextFormatting1.baseline @@ -111,11 +111,37 @@ "tags": [ { "name": "param", - "text": "var1 **Highlighted text**" + "text": [ + { + "text": "var1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "**Highlighted text**", + "kind": "text" + } + ] }, { "name": "param", - "text": "var2 Another **Highlighted text**" + "text": [ + { + "text": "var2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Another **Highlighted text**", + "kind": "text" + } + ] } ] } @@ -241,11 +267,37 @@ "tags": [ { "name": "param", - "text": "var1 *Regular text with an asterisk" + "text": [ + { + "text": "var1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "*Regular text with an asterisk", + "kind": "text" + } + ] }, { "name": "param", - "text": "var2 Another *Regular text with an asterisk" + "text": [ + { + "text": "var2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Another *Regular text with an asterisk", + "kind": "text" + } + ] } ] } @@ -371,11 +423,37 @@ "tags": [ { "name": "param", - "text": "var1 *Regular text with an asterisk" + "text": [ + { + "text": "var1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "*Regular text with an asterisk", + "kind": "text" + } + ] }, { "name": "param", - "text": "var2 Another *Regular text with an asterisk" + "text": [ + { + "text": "var2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Another *Regular text with an asterisk", + "kind": "text" + } + ] } ] } @@ -501,11 +579,37 @@ "tags": [ { "name": "param", - "text": "var1 **Highlighted text**" + "text": [ + { + "text": "var1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "**Highlighted text**", + "kind": "text" + } + ] }, { "name": "param", - "text": "var2 Another **Highlighted text**" + "text": [ + { + "text": "var2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Another **Highlighted text**", + "kind": "text" + } + ] } ] } @@ -631,11 +735,37 @@ "tags": [ { "name": "param", - "text": "var1 **Highlighted text**" + "text": [ + { + "text": "var1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "**Highlighted text**", + "kind": "text" + } + ] }, { "name": "param", - "text": "var2 Another **Highlighted text**" + "text": [ + { + "text": "var2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Another **Highlighted text**", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/signatureHelpCommentsClass.baseline b/tests/baselines/reference/signatureHelpCommentsClass.baseline index a8b78e7b0b574..a61ef94a79132 100644 --- a/tests/baselines/reference/signatureHelpCommentsClass.baseline +++ b/tests/baselines/reference/signatureHelpCommentsClass.baseline @@ -412,7 +412,20 @@ "tags": [ { "name": "param", - "text": "a this is my a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is my a", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/signatureHelpCommentsCommentParsing.baseline b/tests/baselines/reference/signatureHelpCommentsCommentParsing.baseline index 1c08e91a056cc..0455ed71ed381 100644 --- a/tests/baselines/reference/signatureHelpCommentsCommentParsing.baseline +++ b/tests/baselines/reference/signatureHelpCommentsCommentParsing.baseline @@ -1029,11 +1029,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] } @@ -1164,11 +1190,37 @@ "tags": [ { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b second number" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] } ] } @@ -1383,30 +1435,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -1624,30 +1722,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -1865,30 +2009,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -2106,30 +2296,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -2347,30 +2583,76 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "a first number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] }, { "name": "param", - "text": "b" + "text": [ + { + "text": "b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c" + "text": [ + { + "text": "c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d" + "text": [ + { + "text": "d", + "kind": "text" + } + ] }, { "name": "anotherTag" }, { "name": "param", - "text": "e LastParam" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LastParam", + "kind": "text" + } + ] }, { "name": "anotherTag" @@ -2470,7 +2752,20 @@ "tags": [ { "name": "param", - "text": "b about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] } ] }, @@ -2636,9 +2931,22 @@ "tags": [ { "name": "param", - "text": "b about b" - } - ] + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "about b", + "kind": "text" + } + ] + } + ] }, { "isVariadic": false, @@ -3038,27 +3346,97 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is optional param c" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d this is optional param d" + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] }, { "name": "param", - "text": "e this is optional param e" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] }, { "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] } @@ -3391,27 +3769,97 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is optional param c" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d this is optional param d" + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] }, { "name": "param", - "text": "e this is optional param e" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] }, { "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] } @@ -3744,27 +4192,97 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is optional param c" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d this is optional param d" + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] }, { "name": "param", - "text": "e this is optional param e" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] }, { "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] } @@ -4097,27 +4615,97 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is optional param c" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d this is optional param d" + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] }, { "name": "param", - "text": "e this is optional param e" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] }, { "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] } @@ -4450,27 +5038,97 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is optional param c" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d this is optional param d" + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] }, { "name": "param", - "text": "e this is optional param e" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] }, { "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] } @@ -4803,27 +5461,97 @@ "tags": [ { "name": "param", - "text": "" + "text": [ + { + "text": "", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is about b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is about b", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is optional param c" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param c", + "kind": "text" + } + ] }, { "name": "param", - "text": "d this is optional param d" + "text": [ + { + "text": "d", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param d", + "kind": "text" + } + ] }, { "name": "param", - "text": "e this is optional param e" + "text": [ + { + "text": "e", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is optional param e", + "kind": "text" + } + ] }, { "name": "param", - "text": " { () => string; } } f this is optional param f" + "text": [ + { + "text": "", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{ () => string; } } f this is optional param f", + "kind": "text" + } + ] } ] } @@ -4925,15 +5653,38 @@ "tags": [ { "name": "paramTag", - "text": "{ number } a this is input number of paramTag" + "text": [ + { + "text": "{ number } a this is input number of paramTag", + "kind": "text" + } + ] }, { "name": "param", - "text": "a this is input number" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is input number", + "kind": "text" + } + ] }, { "name": "returnType", - "text": "{ number } it is return type" + "text": [ + { + "text": "{ number } it is return type", + "kind": "text" + } + ] } ] } @@ -5064,15 +5815,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] } @@ -5203,15 +5985,46 @@ "tags": [ { "name": "param", - "text": "a this is a" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is a", + "kind": "text" + } + ] }, { "name": "paramTag", - "text": "{ number } g this is optional param g" + "text": [ + { + "text": "{ number } g this is optional param g", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is b" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is b", + "kind": "text" + } + ] } ] } @@ -5342,11 +6155,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] } @@ -5477,11 +6316,37 @@ "tags": [ { "name": "param", - "text": "foo is string" + "text": [ + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is string", + "kind": "text" + } + ] }, { "name": "param", - "text": "bar is second string" + "text": [ + { + "text": "bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is second string", + "kind": "text" + } + ] } ] } @@ -5680,11 +6545,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] } @@ -5876,11 +6767,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] } @@ -6072,11 +6989,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] } @@ -6268,11 +7211,37 @@ "tags": [ { "name": "param", - "text": "a it is first parameter" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is first parameter", + "kind": "text" + } + ] }, { "name": "param", - "text": "c it is third parameter" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "it is third parameter", + "kind": "text" + } + ] } ] } @@ -6566,15 +7535,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] } @@ -6734,15 +7742,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] } @@ -6902,15 +7949,54 @@ "tags": [ { "name": "param", - "text": "a this is info about a\nspanning on two lines and aligned perfectly" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about a\nspanning on two lines and aligned perfectly", + "kind": "text" + } + ] }, { "name": "param", - "text": "b this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", + "kind": "text" + } + ] }, { "name": "param", - "text": "c this is info about b\nnot aligned text about parameter will eat only one space" + "text": [ + { + "text": "c", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this is info about b\nnot aligned text about parameter will eat only one space", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/signatureHelpCommentsFunctionDeclaration.baseline b/tests/baselines/reference/signatureHelpCommentsFunctionDeclaration.baseline index 66af6c08827f1..b2f6a0c141d9b 100644 --- a/tests/baselines/reference/signatureHelpCommentsFunctionDeclaration.baseline +++ b/tests/baselines/reference/signatureHelpCommentsFunctionDeclaration.baseline @@ -406,7 +406,20 @@ "tags": [ { "name": "param", - "text": "a a string" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a string", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/signatureHelpCommentsFunctionExpression.baseline b/tests/baselines/reference/signatureHelpCommentsFunctionExpression.baseline index b1ce387a4fe54..e816216e1d48d 100644 --- a/tests/baselines/reference/signatureHelpCommentsFunctionExpression.baseline +++ b/tests/baselines/reference/signatureHelpCommentsFunctionExpression.baseline @@ -379,19 +379,55 @@ "tags": [ { "name": "param", - "text": "s param on expression" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param on expression", + "kind": "text" + } + ] }, { "name": "returns", - "text": "return on expression" + "text": [ + { + "text": "return on expression", + "kind": "text" + } + ] }, { "name": "param", - "text": "s the first parameter!" + "text": [ + { + "text": "s", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the first parameter!", + "kind": "text" + } + ] }, { "name": "returns", - "text": "the parameter's length" + "text": [ + { + "text": "the parameter's length", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/signatureHelpConstructorCallParamProperties.baseline b/tests/baselines/reference/signatureHelpConstructorCallParamProperties.baseline index 2cecc06b9dbeb..34c4fce1b992a 100644 --- a/tests/baselines/reference/signatureHelpConstructorCallParamProperties.baseline +++ b/tests/baselines/reference/signatureHelpConstructorCallParamProperties.baseline @@ -87,7 +87,20 @@ "tags": [ { "name": "param", - "text": "radius The radius of the circle." + "text": [ + { + "text": "radius", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The radius of the circle.", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/signatureHelpJSDocTags.baseline b/tests/baselines/reference/signatureHelpJSDocTags.baseline index d8d7f53f3d024..aa9108406a593 100644 --- a/tests/baselines/reference/signatureHelpJSDocTags.baseline +++ b/tests/baselines/reference/signatureHelpJSDocTags.baseline @@ -82,7 +82,12 @@ "tags": [ { "name": "myjsdoctag", - "text": "this is a comment" + "text": [ + { + "text": "this is a comment", + "kind": "text" + } + ] } ] } @@ -154,7 +159,12 @@ "tags": [ { "name": "mytag", - "text": "comment1 comment2" + "text": [ + { + "text": "comment1 comment2", + "kind": "text" + } + ] } ] } @@ -287,7 +297,12 @@ "tags": [ { "name": "returns", - "text": "a value" + "text": [ + { + "text": "a value", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/signatureHelpJSMissingPropertyAccess.baseline b/tests/baselines/reference/signatureHelpJSMissingPropertyAccess.baseline index 0c70fab97f360..4e7c06b0639cc 100644 --- a/tests/baselines/reference/signatureHelpJSMissingPropertyAccess.baseline +++ b/tests/baselines/reference/signatureHelpJSMissingPropertyAccess.baseline @@ -280,11 +280,37 @@ "tags": [ { "name": "param", - "text": "predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array." + "text": [ + { + "text": "predicate", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.", + "kind": "text" + } + ] }, { "name": "param", - "text": "thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value." + "text": [ + { + "text": "thisArg", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.", + "kind": "text" + } + ] } ] }, @@ -517,11 +543,37 @@ "tags": [ { "name": "param", - "text": "predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array." + "text": [ + { + "text": "predicate", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.", + "kind": "text" + } + ] }, { "name": "param", - "text": "thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value." + "text": [ + { + "text": "thisArg", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/signatureHelpTypeArguments2.baseline b/tests/baselines/reference/signatureHelpTypeArguments2.baseline index cc640c86df268..e79ddcba49d2c 100644 --- a/tests/baselines/reference/signatureHelpTypeArguments2.baseline +++ b/tests/baselines/reference/signatureHelpTypeArguments2.baseline @@ -193,23 +193,80 @@ "tags": [ { "name": "template", - "text": "T some documentation 2" + "text": [ + { + "text": "T", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "some documentation 2", + "kind": "text" + } + ] }, { "name": "template", - "text": "W" + "text": [ + { + "text": "W", + "kind": "text" + } + ] }, { "name": "template", - "text": "U, V others" + "text": [ + { + "text": "U, V", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "others", + "kind": "text" + } + ] }, { "name": "param", - "text": "a ok" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ok", + "kind": "text" + } + ] }, { "name": "param", - "text": "b not ok" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "not ok", + "kind": "text" + } + ] } ] } @@ -417,23 +474,80 @@ "tags": [ { "name": "template", - "text": "T some documentation 2" + "text": [ + { + "text": "T", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "some documentation 2", + "kind": "text" + } + ] }, { "name": "template", - "text": "W" + "text": [ + { + "text": "W", + "kind": "text" + } + ] }, { "name": "template", - "text": "U, V others" + "text": [ + { + "text": "U, V", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "others", + "kind": "text" + } + ] }, { "name": "param", - "text": "a ok" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ok", + "kind": "text" + } + ] }, { "name": "param", - "text": "b not ok" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "not ok", + "kind": "text" + } + ] } ] } @@ -641,23 +755,80 @@ "tags": [ { "name": "template", - "text": "T some documentation 2" + "text": [ + { + "text": "T", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "some documentation 2", + "kind": "text" + } + ] }, { "name": "template", - "text": "W" + "text": [ + { + "text": "W", + "kind": "text" + } + ] }, { "name": "template", - "text": "U, V others" + "text": [ + { + "text": "U, V", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "others", + "kind": "text" + } + ] }, { "name": "param", - "text": "a ok" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ok", + "kind": "text" + } + ] }, { "name": "param", - "text": "b not ok" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "not ok", + "kind": "text" + } + ] } ] } @@ -865,23 +1036,80 @@ "tags": [ { "name": "template", - "text": "T some documentation 2" + "text": [ + { + "text": "T", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "some documentation 2", + "kind": "text" + } + ] }, { "name": "template", - "text": "W" + "text": [ + { + "text": "W", + "kind": "text" + } + ] }, { "name": "template", - "text": "U, V others" + "text": [ + { + "text": "U, V", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "others", + "kind": "text" + } + ] }, { "name": "param", - "text": "a ok" + "text": [ + { + "text": "a", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ok", + "kind": "text" + } + ] }, { "name": "param", - "text": "b not ok" + "text": [ + { + "text": "b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "not ok", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/signatureHelpWithUnknown.baseline b/tests/baselines/reference/signatureHelpWithUnknown.baseline index 29b7572023e83..79436405c215a 100644 --- a/tests/baselines/reference/signatureHelpWithUnknown.baseline +++ b/tests/baselines/reference/signatureHelpWithUnknown.baseline @@ -87,7 +87,20 @@ "tags": [ { "name": "param", - "text": "x A String value that contains valid JavaScript code." + "text": [ + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] } ] } diff --git a/tests/baselines/reference/trailingCommaSignatureHelp.baseline b/tests/baselines/reference/trailingCommaSignatureHelp.baseline index 043fc9e6b70d8..6b4243453eeca 100644 --- a/tests/baselines/reference/trailingCommaSignatureHelp.baseline +++ b/tests/baselines/reference/trailingCommaSignatureHelp.baseline @@ -180,7 +180,20 @@ "tags": [ { "name": "param", - "text": "radix The radix" + "text": [ + { + "text": "radix", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The radix", + "kind": "text" + } + ] } ] } From 6dbc6ce672c59367217259fd31cf94ceaece6654 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 3 Mar 2021 11:35:00 -0800 Subject: [PATCH 30/44] Fix fourslash tests Mostly ones that can't be baselined, but I switched a couple more over to baselines --- src/harness/fourslashImpl.ts | 2 +- .../completionEntryForUnionMethod.baseline | 6133 +++++++++++++++++ .../signatureHelpJSDocCallbackTag.baseline | 554 ++ .../completionEntryForUnionMethod.ts | 13 +- tests/cases/fourslash/fourslash.ts | 2 +- .../fourslash/getJavaScriptCompletions16.ts | 2 +- tests/cases/fourslash/importJsNodeModule3.ts | 4 +- .../fourslash/jsDocDontBreakWithNamespaces.ts | 27 - .../completionEntryDetailAcrossFiles01.ts | 9 +- .../completionEntryDetailAcrossFiles02.ts | 6 +- tests/cases/fourslash/server/completions02.ts | 4 +- .../fourslash/server/jsdocCallbackTag.ts | 16 - .../server/signatureHelpJSDocCallbackTag.ts | 28 + .../signatureHelpWhenEditingCallExpression.ts | 4 +- 14 files changed, 6734 insertions(+), 70 deletions(-) create mode 100644 tests/baselines/reference/completionEntryForUnionMethod.baseline create mode 100644 tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline create mode 100644 tests/cases/fourslash/server/signatureHelpJSDocCallbackTag.ts diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index d5c1a7ad8e900..534ff477a7c46 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -1583,7 +1583,7 @@ namespace FourSlash { assert.equal(actualTags.length, (options.tags || ts.emptyArray).length, this.assertionMessageAtLastKnownMarker("signature help tags")); ts.zipWith((options.tags || ts.emptyArray), actualTags, (expectedTag, actualTag) => { assert.equal(actualTag.name, expectedTag.name); - assert.equal(actualTag.text, expectedTag.text, this.assertionMessageAtLastKnownMarker("signature help tag " + actualTag.name)); + assert.deepEqual(actualTag.text, expectedTag.text, this.assertionMessageAtLastKnownMarker("signature help tag " + actualTag.name)); }); const allKeys: readonly (keyof FourSlashInterface.VerifySignatureHelpOptions)[] = [ diff --git a/tests/baselines/reference/completionEntryForUnionMethod.baseline b/tests/baselines/reference/completionEntryForUnionMethod.baseline new file mode 100644 index 0000000000000..ce000ec6ddbcb --- /dev/null +++ b/tests/baselines/reference/completionEntryForUnionMethod.baseline @@ -0,0 +1,6133 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/completionEntryForUnionMethod.ts", + "position": 41, + "name": "" + }, + "completionList": { + "isGlobalCompletion": false, + "isMemberCompletion": true, + "isNewIdentifierLocation": false, + "optionalReplacementSpan": { + "start": 38, + "length": 3 + }, + "entries": [ + { + "name": "length", + "kind": "property", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "length", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets or sets the length of the array. This is a number one higher than the highest index in the array.", + "kind": "text" + } + ] + }, + { + "name": "toString", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "toString", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns a string representation of an array.", + "kind": "text" + } + ] + }, + { + "name": "toLocaleString", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "toLocaleString", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns a string representation of an array. The elements are converted to string using their toLocalString methods.", + "kind": "text" + } + ] + }, + { + "name": "pop", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "pop", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Removes the last element from an array and returns it.\r\nIf the array is empty, undefined is returned and the array is not modified.", + "kind": "text" + } + ] + }, + { + "name": "push", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "push", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "items", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "never", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Appends new elements to the end of an array, and returns the new length of the array.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "items", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "New elements to add to the array.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "concat", + "kind": "property", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "concat", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "punctuation" + }, + { + "text": "items", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ConcatArray", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "punctuation" + }, + { + "text": "items", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ConcatArray", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "punctuation" + }, + { + "text": "items", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ConcatArray", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "punctuation" + }, + { + "text": "items", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ConcatArray", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "text" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Combines two or more arrays.\r\nThis method returns a new array without modifying any existing arrays.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "items", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Additional arrays and/or items to add to the end of the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "items", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Additional arrays and/or items to add to the end of the array.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "join", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "join", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "separator", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Adds all the elements of an array into a string, separated by the specified separator string.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "separator", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "reverse", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "reverse", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Reverses the elements in an array in place.\r\nThis method mutates the array and returns a reference to the same array.", + "kind": "text" + } + ] + }, + { + "name": "shift", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "shift", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Removes the first element from an array and returns it.\r\nIf the array is empty, undefined is returned and the array is not modified.", + "kind": "text" + } + ] + }, + { + "name": "slice", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "slice", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "end", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Returns a copy of a section of an array.\r\nFor both start and end, a negative index can be used to indicate an offset from the end of the array.\r\nFor example, -2 refers to the second to last element of the array.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "start", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The beginning index of the specified portion of the array.\r\nIf start is undefined, then the slice begins at index 0.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "end", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The end index of the specified portion of the array. This is exclusive of the element at the index 'end'.\r\nIf end is undefined, then the slice extends to the end of the array.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "sort", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "sort", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "compareFn", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Sorts an array in place.\r\nThis method mutates the array and returns a reference to the same array.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "compareFn", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function used to determine the order of the elements. It is expected to return\r\na negative value if first argument is less than second argument, zero if they're equal and a positive\r\nvalue otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r\n```ts\r\n[11,2,22,1].sort((a, b) => a - b)\r\n```", + "kind": "text" + } + ] + } + ] + }, + { + "name": "splice", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "splice", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "deleteCount", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "start", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The zero-based location in the array from which to start removing elements.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "deleteCount", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The number of elements to remove.", + "kind": "text" + } + ] + }, + { + "name": "returns", + "text": [ + { + "text": "An array containing the elements that were deleted.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "unshift", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "unshift", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "items", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "never", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Inserts new elements at the start of an array, and returns the new length of the array.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "items", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Elements to insert at the start of the array.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "indexOf", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "indexOf", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "searchElement", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "never", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fromIndex", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns the index of the first occurrence of a value in an array, or -1 if it is not present.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "searchElement", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The value to locate in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "fromIndex", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "lastIndexOf", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "lastIndexOf", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "searchElement", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "never", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fromIndex", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "searchElement", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The value to locate in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "fromIndex", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "every", + "kind": "property", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "every", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "S", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "predicate", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "S", + "kind": "typeParameterName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thisArg", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "S", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "predicate", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thisArg", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "propertyName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Determines whether all the members of an array satisfy the specified test.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "predicate", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to three arguments. The every method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value false, or until the end of the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "thisArg", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "predicate", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to three arguments. The every method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value false, or until the end of the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "thisArg", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "some", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "some", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "predicate", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thisArg", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Determines whether the specified callback function returns true for any element of an array.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "predicate", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to three arguments. The some method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value true, or until the end of the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "thisArg", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "forEach", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "forEach", + "kind": "propertyName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "callbackfn", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thisArg", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Performs the specified action for each element in an array.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "callbackfn", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "thisArg", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "map", + "kind": "method", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "map", + "kind": "propertyName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "callbackfn", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thisArg", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Calls a defined callback function on each element of an array, and returns an array that contains the results.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "callbackfn", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "thisArg", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "filter", + "kind": "property", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "filter", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "S", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "predicate", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "S", + "kind": "typeParameterName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thisArg", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "S", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "predicate", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thisArg", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "propertyName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Returns the elements of an array that meet the condition specified in a callback function.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "predicate", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "thisArg", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "predicate", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "thisArg", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "reduce", + "kind": "property", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "reduce", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "callbackfn", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "previousValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentIndex", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "callbackfn", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "previousValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentIndex", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "initialValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "callbackfn", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "previousValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentIndex", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "initialValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "propertyName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "callbackfn", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "initialValue", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "callbackfn", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "initialValue", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "reduceRight", + "kind": "property", + "kindModifiers": "declare", + "sortText": "1", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "reduceRight", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "callbackfn", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "previousValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentIndex", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "callbackfn", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "previousValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentIndex", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "initialValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "callbackfn", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "previousValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "currentIndex", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "initialValue", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "propertyName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "callbackfn", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "initialValue", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "callbackfn", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "initialValue", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.", + "kind": "text" + } + ] + } + ] + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline b/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline new file mode 100644 index 0000000000000..6d74f9e60dd81 --- /dev/null +++ b/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline @@ -0,0 +1,554 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/server/jsdocCallbackTag.js", + "position": 480, + "name": "4" + }, + "signatureHelp": { + "items": [ + { + "isVariadic": false, + "prefixDisplayParts": [ + { + "text": "t", + "kind": "localName" + }, + { + "text": "(", + "kind": "punctuation" + } + ], + "suffixDisplayParts": [ + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "separatorDisplayParts": [ + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + } + ], + "parameters": [ + { + "name": "eventName", + "documentation": [ + { + "text": "- So many words", + "kind": "text" + } + ], + "displayParts": [ + { + "text": "eventName", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + }, + { + "name": "eventName2", + "documentation": [ + { + "text": "- Silence is golden", + "kind": "text" + } + ], + "displayParts": [ + { + "text": "eventName2", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + }, + { + "name": "eventName3", + "documentation": [ + { + "text": "- Osterreich mos def", + "kind": "text" + } + ], + "displayParts": [ + { + "text": "eventName3", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + } + ], + "documentation": [], + "tags": [ + { + "name": "type", + "text": [ + { + "text": "{FooHandler}", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "callback", + "kind": "text" + } + ] + } + ] + } + ], + "applicableSpan": { + "start": 480, + "length": 14 + }, + "selectedItemIndex": 0, + "argumentIndex": 0, + "argumentCount": 3 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/server/jsdocCallbackTag.js", + "position": 485, + "name": "5" + }, + "signatureHelp": { + "items": [ + { + "isVariadic": false, + "prefixDisplayParts": [ + { + "text": "t", + "kind": "localName" + }, + { + "text": "(", + "kind": "punctuation" + } + ], + "suffixDisplayParts": [ + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "separatorDisplayParts": [ + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + } + ], + "parameters": [ + { + "name": "eventName", + "documentation": [ + { + "text": "- So many words", + "kind": "text" + } + ], + "displayParts": [ + { + "text": "eventName", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + }, + { + "name": "eventName2", + "documentation": [ + { + "text": "- Silence is golden", + "kind": "text" + } + ], + "displayParts": [ + { + "text": "eventName2", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + }, + { + "name": "eventName3", + "documentation": [ + { + "text": "- Osterreich mos def", + "kind": "text" + } + ], + "displayParts": [ + { + "text": "eventName3", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + } + ], + "documentation": [], + "tags": [ + { + "name": "type", + "text": [ + { + "text": "{FooHandler}", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "callback", + "kind": "text" + } + ] + } + ] + } + ], + "applicableSpan": { + "start": 480, + "length": 14 + }, + "selectedItemIndex": 0, + "argumentIndex": 1, + "argumentCount": 3 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/server/jsdocCallbackTag.js", + "position": 489, + "name": "6" + }, + "signatureHelp": { + "items": [ + { + "isVariadic": false, + "prefixDisplayParts": [ + { + "text": "t", + "kind": "localName" + }, + { + "text": "(", + "kind": "punctuation" + } + ], + "suffixDisplayParts": [ + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "separatorDisplayParts": [ + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + } + ], + "parameters": [ + { + "name": "eventName", + "documentation": [ + { + "text": "- So many words", + "kind": "text" + } + ], + "displayParts": [ + { + "text": "eventName", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + }, + { + "name": "eventName2", + "documentation": [ + { + "text": "- Silence is golden", + "kind": "text" + } + ], + "displayParts": [ + { + "text": "eventName2", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + }, + { + "name": "eventName3", + "documentation": [ + { + "text": "- Osterreich mos def", + "kind": "text" + } + ], + "displayParts": [ + { + "text": "eventName3", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + } + ], + "documentation": [], + "tags": [ + { + "name": "type", + "text": [ + { + "text": "{FooHandler}", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "callback", + "kind": "text" + } + ] + } + ] + } + ], + "applicableSpan": { + "start": 480, + "length": 14 + }, + "selectedItemIndex": 0, + "argumentIndex": 2, + "argumentCount": 3 + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/completionEntryForUnionMethod.ts b/tests/cases/fourslash/completionEntryForUnionMethod.ts index 65a8ab3c8ece5..2804a373fd2a0 100644 --- a/tests/cases/fourslash/completionEntryForUnionMethod.ts +++ b/tests/cases/fourslash/completionEntryForUnionMethod.ts @@ -7,15 +7,4 @@ const text = "(method) Array.map(callbackfn: ((value: string, index: const documentation = "Calls a defined callback function on each element of an array, and returns an array that contains the results."; verify.quickInfoAt("", text, documentation); -verify.completions({ - marker: "", - includes: { - name: "map", - text, - documentation, - tags: [ - { name: "param", text: "callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.", links: undefined }, - { name: "param", text: "thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.", links: undefined } - ], - }, -}); +verify.baselineCompletions() diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 80e00b42183f8..b34d99e2f4b3f 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -745,7 +745,7 @@ declare namespace FourSlashInterface { interface JSDocTagInfo { readonly name: string; - readonly text: string | undefined; + readonly text: ts.SymbolDisplayPart[] | undefined; } interface GenerateTypesOptions { diff --git a/tests/cases/fourslash/getJavaScriptCompletions16.ts b/tests/cases/fourslash/getJavaScriptCompletions16.ts index 112bef3c24b97..a61e4681b62eb 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions16.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions16.ts @@ -30,7 +30,7 @@ edit.backspace(); verify.signatureHelp({ marker: "sig", text: "Something(a: number, b: any): Something", - tags: [{ name: "param", text: "a" }], + tags: [{ name: "param", text: [{ kind: "text", text: "a" }] }], }); goTo.marker('method'); diff --git a/tests/cases/fourslash/importJsNodeModule3.ts b/tests/cases/fourslash/importJsNodeModule3.ts index 4f3777724e1a6..3551a574a34a6 100644 --- a/tests/cases/fourslash/importJsNodeModule3.ts +++ b/tests/cases/fourslash/importJsNodeModule3.ts @@ -37,7 +37,7 @@ verify.signatureHelp({ text: "z(a: number | boolean, b: string[]): string", parameterDocComment: "The first param", tags: [ - { name: "param", text: "a The first param" }, - { name: "param", text: "b The second param" }, + { name: "param", text: [{ kind: "text", text: "a" }, { kind: "space", text: " " }, { kind: "text", text: "The first param" }] }, + { name: "param", text: [{ kind: "text", text: "b" }, { kind: "space", text: " " }, { kind: "text", text: "The second param" }] }, ], }); diff --git a/tests/cases/fourslash/jsDocDontBreakWithNamespaces.ts b/tests/cases/fourslash/jsDocDontBreakWithNamespaces.ts index fbbb93cdb6d06..0fd89194f99d4 100644 --- a/tests/cases/fourslash/jsDocDontBreakWithNamespaces.ts +++ b/tests/cases/fourslash/jsDocDontBreakWithNamespaces.ts @@ -19,30 +19,3 @@ // #31298 verify.baselineSignatureHelp() - - -verify.signatureHelp({ - marker: "foo", - text: "foo(): any", - docComment: "", - tags: [ - { name: "returns", text: "Websocket server object" }, - ], -}); - -verify.signatureHelp({ - marker: "bar", - text: "bar(): void", - docComment: "", - tags: [], -}); - - -verify.signatureHelp({ - marker: "zee", - text: "zee(): any", - docComment: "", - tags: [ - { name: "type", text: "{function(module:xxxx, module:xxxx): module:xxxxx}" }, - ], -}); diff --git a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts index a29064b6ca849..680836f4f7129 100644 --- a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts +++ b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts @@ -18,8 +18,13 @@ const entry = (text: string): FourSlashInterface.ExpectedCompletionEntry => ({ name: "foo", text, documentation: "Modify the parameter", - links: [], - tags: [{ name: "param", text: "p1", links: [] }] + tags: [{ + name: "param", + text: [{ + "kind": "text", + "text": "p1", + }], + }] }); verify.completions( { marker: "1", includes: entry("var foo: (p1: string) => void") }, diff --git a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts index 22900942a9271..6c42f76a578de 100644 --- a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts +++ b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts @@ -19,14 +19,12 @@ verify.completions( name: "foo", text: "var foo: (p1: string) => void", documentation: "Modify the parameter", - links: [], - tags: [{ name: "param", text: "p1", links: [] }] + tags: [{ name: "param", text: [{ kind: "text", text: "p1" }] }] } }, { marker: "2", exact: { name: "foo", text: "(alias) var foo: (p1: string) => void\nimport a.foo", documentation: "Modify the parameter", - links: [], - tags: [{ name: "param", text: "p1", links: [] }] + tags: [{ name: "param", text: [{ kind: "text", text: "p1" }] }] } }, ); diff --git a/tests/cases/fourslash/server/completions02.ts b/tests/cases/fourslash/server/completions02.ts index 603d2079d66c1..80285c3453de2 100644 --- a/tests/cases/fourslash/server/completions02.ts +++ b/tests/cases/fourslash/server/completions02.ts @@ -10,9 +10,9 @@ const sortedFunctionMembers = completion.functionMembersWithPrototype.slice().sort((a, b) => a.name.localeCompare(b.name)); const exact: ReadonlyArray = [ ...sortedFunctionMembers.map(e => - e.name === "arguments" ? { ...e, kind: "property", kindModifiers: "declare", tags: [] } : + e.name === "arguments" ? { ...e, kind: "property", kindModifiers: "declare", tags: undefined } : e.name === "prototype" ? { ...e, kindModifiers: undefined } : e), - { name: "x", text: "var Foo.x: number", tags: [] }, + { name: "x", text: "var Foo.x: number", tags: undefined }, ]; verify.completions({ marker: "", exact }); diff --git a/tests/cases/fourslash/server/jsdocCallbackTag.ts b/tests/cases/fourslash/server/jsdocCallbackTag.ts index 315ad0ee1735e..df1b9e1296919 100644 --- a/tests/cases/fourslash/server/jsdocCallbackTag.ts +++ b/tests/cases/fourslash/server/jsdocCallbackTag.ts @@ -33,19 +33,3 @@ goTo.marker("3"); verify.quickInfoIs("type FooHandler2 = (eventName?: string | undefined, eventName2?: string) => any", "- What, another one?"); goTo.marker("8"); verify.quickInfoIs("type FooHandler = (eventName: string, eventName2: number | string, eventName3: any) => number", "- A kind of magic"); -verify.signatureHelp({ - marker: '4', - text: "t(eventName: string, eventName2: string | number, eventName3: any): number", - parameterDocComment: "- So many words", - tags: [{ name: "type", text: "{FooHandler} callback" }] -}); -verify.signatureHelp({ - marker: '5', - parameterDocComment: "- Silence is golden", - tags: [{ name: "type", text: "{FooHandler} callback" }] -}); -verify.signatureHelp({ - marker: '6', - parameterDocComment: "- Osterreich mos def", - tags: [{ name: "type", text: "{FooHandler} callback" }] -}); diff --git a/tests/cases/fourslash/server/signatureHelpJSDocCallbackTag.ts b/tests/cases/fourslash/server/signatureHelpJSDocCallbackTag.ts new file mode 100644 index 0000000000000..65a831ebd5598 --- /dev/null +++ b/tests/cases/fourslash/server/signatureHelpJSDocCallbackTag.ts @@ -0,0 +1,28 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: jsdocCallbackTag.js +//// /** +//// * @callback FooHandler - A kind of magic +//// * @param {string} eventName - So many words +//// * @param eventName2 {number | string} - Silence is golden +//// * @param eventName3 - Osterreich mos def +//// * @return {number} - DIVEKICK +//// */ +//// /** +//// * @type {FooHandler} callback +//// */ +//// var t; +//// +//// /** +//// * @callback FooHandler2 - What, another one? +//// * @param {string=} eventName - it keeps happening +//// * @param {string} [eventName2] - i WARNED you dog +//// */ +//// /** +//// * @type {FooHandler2} callback +//// */ +//// var t2; +//// t(/*4*/"!", /*5*/12, /*6*/false); + +verify.baselineSignatureHelp() diff --git a/tests/cases/fourslash/signatureHelpWhenEditingCallExpression.ts b/tests/cases/fourslash/signatureHelpWhenEditingCallExpression.ts index 334a6f30058b4..64da8e16b2e07 100644 --- a/tests/cases/fourslash/signatureHelpWhenEditingCallExpression.ts +++ b/tests/cases/fourslash/signatureHelpWhenEditingCallExpression.ts @@ -10,8 +10,8 @@ ////fo/*1*/ const tags: ReadonlyArray = [ - { name: "param", text: "start The start" }, - { name: "param", text: "end The end\nMore text" }, + { name: "param", text: [{ kind: "text", text: "start" }, { kind: "space", text: " " }, { kind: "text", text: "The start" }] }, + { name: "param", text: [{ kind: "text", text: "end" }, { kind: "space", text: " " }, { kind: "text", text: "The end\nMore text" }] }, ]; verify.noSignatureHelp("1"); edit.insert("o"); From ff2aba6ce8a95c0ced616e879445561bfdbd3576 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 3 Mar 2021 15:13:25 -0800 Subject: [PATCH 31/44] Improve types and documentation --- src/server/protocol.ts | 19 +++++++++---------- src/server/session.ts | 2 +- src/services/types.ts | 6 +++--- src/testRunner/unittests/tsserver/jsdocTag.ts | 4 ++-- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 826de198b8959..e5848e55f38b3 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -979,17 +979,18 @@ namespace ts.server.protocol { file: string; } - // TODO: JSDoc export interface JSDocTagInfo { + /** Name of the JSDoc tag */ name: string; + /** Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ text?: string; } - // TODO: Better JSDoc - /** Like ts.JSDocTagInfo, but with JSDocLinkParts translated to line+offset */ export interface RichJSDocTagInfo { + /** Name of the JSDoc tag */ name: string; - text?: (SymbolDisplayPart | JSDocLinkPart)[]; + /** Comment display parts after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ + text?: SymbolDisplayPart[]; } export interface TextSpanWithContext extends TextSpan { @@ -2008,9 +2009,6 @@ namespace ts.server.protocol { tags: JSDocTagInfo[]; } - /** - * RICH Body of QuickInfoResponse. - */ export interface RichQuickInfoResponseBody { /** * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). @@ -2265,10 +2263,11 @@ namespace ts.server.protocol { kind: string; } + /** A part of a symbol description that links from a jsdoc @link tag to a declaration */ export interface JSDocLinkPart extends SymbolDisplayPart { - // TODO: JSDoc here + /** The name of the linked declaration. Includes the location inside the @link tag. */ name: FileSpan; - // TODO: JSDoc here + /** The location of the declaration that the @link tag links to. */ target: FileSpan; } @@ -2381,7 +2380,7 @@ namespace ts.server.protocol { } /** - * RICH Additional completion entry details, available on demand + * Additional completion entry details, available on demand */ export interface RichCompletionEntryDetails { /** diff --git a/src/server/session.ts b/src/server/session.ts index 499c2be0673ec..86d3d1eae4997 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1282,7 +1282,7 @@ namespace ts.server { return tags ? tags.map(tag => ({ ...tag, text: this.mapDisplayParts(tag.text, project) })) : []; } - private mapDisplayParts(parts: (SymbolDisplayPart | JSDocLinkPart)[] | undefined, project: Project): (protocol.SymbolDisplayPart | protocol.JSDocLinkPart)[] { + private mapDisplayParts(parts: SymbolDisplayPart[] | undefined, project: Project): protocol.SymbolDisplayPart[] { if (!parts) { return []; } diff --git a/src/services/types.ts b/src/services/types.ts index 3241893055ed2..d0c2df0f5a3c6 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1042,12 +1042,12 @@ namespace ts { export interface JSDocLinkPart extends SymbolDisplayPart { name: DocumentSpan; - target: DocumentSpan; // TODO: Protocol needs to convert these to the protocol line+offset version + target: DocumentSpan; } export interface JSDocTagInfo { name: string; - text?: (SymbolDisplayPart | JSDocLinkPart)[]; + text?: SymbolDisplayPart[]; } export interface QuickInfo { @@ -1055,7 +1055,7 @@ namespace ts { kindModifiers: string; textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; - documentation?: (SymbolDisplayPart | JSDocLinkPart)[]; + documentation?: SymbolDisplayPart[]; tags?: JSDocTagInfo[]; } diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 86cdf26ab471a..ad6ad6813fd1b 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -56,7 +56,7 @@ var x = 1`); } }, text: "{@link C}", - }], + } as SymbolDisplayPart], }] }); }); @@ -116,7 +116,7 @@ var x = 1`); } }, text: "{@link C}" - }], + } as SymbolDisplayPart], tags: undefined, }); }); From 8c5c650728535a4d2a2801906e25add5003f1059 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 3 Mar 2021 15:45:05 -0800 Subject: [PATCH 32/44] Test+fix @link emit, scrub other TODOs --- src/compiler/parser.ts | 2 +- src/compiler/utilitiesPublic.ts | 3 +- src/harness/client.ts | 12 ---- tests/baselines/reference/linkTagEmit1.js | 64 +++++++++++++++++++ .../baselines/reference/linkTagEmit1.symbols | 28 ++++++++ tests/baselines/reference/linkTagEmit1.types | 28 ++++++++ tests/cases/conformance/jsdoc/linkTagEmit1.ts | 23 +++++++ 7 files changed, 145 insertions(+), 15 deletions(-) create mode 100644 tests/baselines/reference/linkTagEmit1.js create mode 100644 tests/baselines/reference/linkTagEmit1.symbols create mode 100644 tests/baselines/reference/linkTagEmit1.types create mode 100644 tests/cases/conformance/jsdoc/linkTagEmit1.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9cd670c48bf3b..74c3662f560a3 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7599,7 +7599,7 @@ namespace ts { if (!margin) { margin = indent; } - comments.push(text); // TODO: finishNode??? + comments.push(text); indent += text.length; } if (initialMargin !== undefined) { diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 523b771a45547..6b79932d3ec41 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -896,8 +896,7 @@ namespace ts { /** Gets the text of a jsdoc comment, flattening links to their text. */ export function getTextOfJSDocComment(comment?: NodeArray) { - // TODO: Stringify c.name correctly - return comment?.map(c => c.kind === SyntaxKind.JSDocText ? c.text : `{@link ${c.name}${c.text}}`).join(""); + return comment?.map(c => c.kind === SyntaxKind.JSDocText ? c.text : `{@link ${c.name ? entityNameToString(c.name) + " " : ""}${c.text}}`).join(""); } /** diff --git a/src/harness/client.ts b/src/harness/client.ts index f7084a08ed855..f85e0e111317d 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -536,17 +536,6 @@ namespace ts.server { this.lineOffsetToPosition(fileName, span.end, lineMap)); } - // private decodeLinks(links: protocol.JSDocLinkInfo[]): JSDocLinkInfo[] { - // return links.map(link => ({ - // ...link, - // name: link.name as unknown as TextSpan, - // target: { - // // TODO: The JSDocLinkInfo tag data mismatches the type!! (probably wasn't correctly encoded in the first place?) - // textSpan: link.target as unknown as TextSpan, - // fileName: link.target.file, - // } - // })); - // } private decodeLinkDisplayParts(tags: (protocol.JSDocTagInfo | JSDocTagInfo)[]): JSDocTagInfo[] { return tags.map(tag => typeof tag.text === "string" ? { ...tag, @@ -574,7 +563,6 @@ namespace ts.server { const { items: encodedItems, applicableSpan: encodedApplicableSpan, selectedItemIndex, argumentIndex, argumentCount } = response.body; - // TODO: Same here, it doesn't actually seem to be encoded const applicableSpan = encodedApplicableSpan as unknown as TextSpan; const items = (encodedItems as (SignatureHelpItem | protocol.SignatureHelpItem)[]).map(item => ({ ...item, tags: this.decodeLinkDisplayParts(item.tags) })); diff --git a/tests/baselines/reference/linkTagEmit1.js b/tests/baselines/reference/linkTagEmit1.js new file mode 100644 index 0000000000000..377fa211381c8 --- /dev/null +++ b/tests/baselines/reference/linkTagEmit1.js @@ -0,0 +1,64 @@ +//// [tests/cases/conformance/jsdoc/linkTagEmit1.ts] //// + +//// [declarations.d.ts] +declare namespace NS { + type R = number +} +//// [linkTagEmit1.js] +/** @typedef {number} N */ +/** + * @typedef {Object} D1 + * @property {1} e Just link to {@link NS.R} this time + * @property {1} m Wyatt Earp loved {@link N integers} I bet. + */ + +/** @typedef {number} Z @see N {@link N} */ + +/** + * @param {number} integer {@link Z} + */ +function computeCommonSourceDirectoryOfFilenames(integer) { + return integer + 1 // pls pls pls +} + + +//// [linkTagEmit1.js] +/** @typedef {number} N */ +/** + * @typedef {Object} D1 + * @property {1} e Just link to {@link NS.R} this time + * @property {1} m Wyatt Earp loved {@link N integers} I bet. + */ +/** @typedef {number} Z @see N {@link N} */ +/** + * @param {number} integer {@link Z} + */ +function computeCommonSourceDirectoryOfFilenames(integer) { + return integer + 1; // pls pls pls +} + + +//// [linkTagEmit1.d.ts] +/** @typedef {number} N */ +/** + * @typedef {Object} D1 + * @property {1} e Just link to {@link NS.R} this time + * @property {1} m Wyatt Earp loved {@link N integers} I bet. + */ +/** @typedef {number} Z @see N {@link N} */ +/** + * @param {number} integer {@link Z} + */ +declare function computeCommonSourceDirectoryOfFilenames(integer: number): number; +type N = number; +type D1 = { + /** + * Just link to {@link NS.R } this time + */ + e: 1; + /** + * Wyatt Earp loved {@link N integers} I bet. + */ + m: 1; +}; +type Z = number; diff --git a/tests/baselines/reference/linkTagEmit1.symbols b/tests/baselines/reference/linkTagEmit1.symbols new file mode 100644 index 0000000000000..30b7ab681f89b --- /dev/null +++ b/tests/baselines/reference/linkTagEmit1.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/jsdoc/declarations.d.ts === +declare namespace NS { +>NS : Symbol(NS, Decl(declarations.d.ts, 0, 0)) + + type R = number +>R : Symbol(R, Decl(declarations.d.ts, 0, 22)) +} +=== tests/cases/conformance/jsdoc/linkTagEmit1.js === +/** @typedef {number} N */ +/** + * @typedef {Object} D1 + * @property {1} e Just link to {@link NS.R} this time + * @property {1} m Wyatt Earp loved {@link N integers} I bet. + */ + +/** @typedef {number} Z @see N {@link N} */ + +/** + * @param {number} integer {@link Z} + */ +function computeCommonSourceDirectoryOfFilenames(integer) { +>computeCommonSourceDirectoryOfFilenames : Symbol(computeCommonSourceDirectoryOfFilenames, Decl(linkTagEmit1.js, 0, 0)) +>integer : Symbol(integer, Decl(linkTagEmit1.js, 12, 49)) + + return integer + 1 // pls pls pls +>integer : Symbol(integer, Decl(linkTagEmit1.js, 12, 49)) +} + diff --git a/tests/baselines/reference/linkTagEmit1.types b/tests/baselines/reference/linkTagEmit1.types new file mode 100644 index 0000000000000..a5456e3877f0b --- /dev/null +++ b/tests/baselines/reference/linkTagEmit1.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/jsdoc/declarations.d.ts === +declare namespace NS { + type R = number +>R : number +} +=== tests/cases/conformance/jsdoc/linkTagEmit1.js === +/** @typedef {number} N */ +/** + * @typedef {Object} D1 + * @property {1} e Just link to {@link NS.R} this time + * @property {1} m Wyatt Earp loved {@link N integers} I bet. + */ + +/** @typedef {number} Z @see N {@link N} */ + +/** + * @param {number} integer {@link Z} + */ +function computeCommonSourceDirectoryOfFilenames(integer) { +>computeCommonSourceDirectoryOfFilenames : (integer: number) => number +>integer : number + + return integer + 1 // pls pls pls +>integer + 1 : number +>integer : number +>1 : 1 +} + diff --git a/tests/cases/conformance/jsdoc/linkTagEmit1.ts b/tests/cases/conformance/jsdoc/linkTagEmit1.ts new file mode 100644 index 0000000000000..3c35376414618 --- /dev/null +++ b/tests/cases/conformance/jsdoc/linkTagEmit1.ts @@ -0,0 +1,23 @@ +// @checkJs: true +// @outdir: foo +// @declaration: true +// @filename: declarations.d.ts +declare namespace NS { + type R = number +} +// @filename: linkTagEmit1.js +/** @typedef {number} N */ +/** + * @typedef {Object} D1 + * @property {1} e Just link to {@link NS.R} this time + * @property {1} m Wyatt Earp loved {@link N integers} I bet. + */ + +/** @typedef {number} Z @see N {@link N} */ + +/** + * @param {number} integer {@link Z} + */ +function computeCommonSourceDirectoryOfFilenames(integer) { + return integer + 1 // pls pls pls +} From f93e131a80eb714bfdec84bde77f97655fe3e425 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 3 Mar 2021 16:58:08 -0800 Subject: [PATCH 33/44] update API baselines --- .../reference/api/tsserverlibrary.d.ts | 19 +++++++++++-------- tests/baselines/reference/api/typescript.d.ts | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index a1d83d387a90f..c0fe4089036d5 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -6034,14 +6034,14 @@ declare namespace ts { } interface JSDocTagInfo { name: string; - text?: (SymbolDisplayPart | JSDocLinkPart)[]; + text?: SymbolDisplayPart[]; } interface QuickInfo { kind: ScriptElementKind; kindModifiers: string; textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; - documentation?: (SymbolDisplayPart | JSDocLinkPart)[]; + documentation?: SymbolDisplayPart[]; tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; @@ -7310,13 +7310,16 @@ declare namespace ts.server.protocol { file: string; } interface JSDocTagInfo { + /** Name of the JSDoc tag */ name: string; + /** Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ text?: string; } - /** Like ts.JSDocTagInfo, but with JSDocLinkParts translated to line+offset */ interface RichJSDocTagInfo { + /** Name of the JSDoc tag */ name: string; - text?: (SymbolDisplayPart | JSDocLinkPart)[]; + /** Comment display parts after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ + text?: SymbolDisplayPart[]; } interface TextSpanWithContext extends TextSpan { contextStart?: Location; @@ -8074,9 +8077,6 @@ declare namespace ts.server.protocol { */ tags: JSDocTagInfo[]; } - /** - * RICH Body of QuickInfoResponse. - */ interface RichQuickInfoResponseBody { /** * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). @@ -8294,8 +8294,11 @@ declare namespace ts.server.protocol { */ kind: string; } + /** A part of a symbol description that links from a jsdoc @link tag to a declaration */ interface JSDocLinkPart extends SymbolDisplayPart { + /** The name of the linked declaration. Includes the location inside the @link tag. */ name: FileSpan; + /** The location of the declaration that the @link tag links to. */ target: FileSpan; } /** @@ -8401,7 +8404,7 @@ declare namespace ts.server.protocol { source?: SymbolDisplayPart[]; } /** - * RICH Additional completion entry details, available on demand + * Additional completion entry details, available on demand */ interface RichCompletionEntryDetails { /** diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index a14d0180849b1..b59b504c427c3 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -6034,14 +6034,14 @@ declare namespace ts { } interface JSDocTagInfo { name: string; - text?: (SymbolDisplayPart | JSDocLinkPart)[]; + text?: SymbolDisplayPart[]; } interface QuickInfo { kind: ScriptElementKind; kindModifiers: string; textSpan: TextSpan; displayParts?: SymbolDisplayPart[]; - documentation?: (SymbolDisplayPart | JSDocLinkPart)[]; + documentation?: SymbolDisplayPart[]; tags?: JSDocTagInfo[]; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; From c67946e5672466e47f52ebcb393e5281a24a1193 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 3 Mar 2021 16:59:58 -0800 Subject: [PATCH 34/44] test that goto-def works with @link --- .../cases/fourslash/gotoDefinitionLinkTag1.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/cases/fourslash/gotoDefinitionLinkTag1.ts diff --git a/tests/cases/fourslash/gotoDefinitionLinkTag1.ts b/tests/cases/fourslash/gotoDefinitionLinkTag1.ts new file mode 100644 index 0000000000000..2e8d55c7a07b7 --- /dev/null +++ b/tests/cases/fourslash/gotoDefinitionLinkTag1.ts @@ -0,0 +1,40 @@ +/// + +//// interface [|/*def1*/Foo|] { +//// foo: string +//// } + +//// namespace NS { +//// export interface [|/*def2*/Bar|] { +//// baz: Foo +//// } +//// } + +//// /** {@link /*use1*/[|Foo|]} foooo*/ +//// const a = "" + +//// /** {@link NS./*use2*/[|Bar|]} ns.bar*/ +//// const b = "" + +//// /** {@link /*use3*/[|Foo|] f1}*/ +//// const c = "" + +//// /** {@link NS./*use4*/[|Bar|] ns.bar}*/ +//// const [|/*def3*/d|] = "" + +//// /** {@link /*use5*/[|d|] }dd*/ +//// const e = "" + +goTo.marker("use1"); +verify.goToDefinitionIs("def1"); + +goTo.marker("use2"); +verify.goToDefinitionIs("def2"); + +goTo.marker("use3"); +verify.goToDefinitionIs("def1"); + +goTo.marker("use4"); +verify.goToDefinitionIs("def2"); + +goTo.marker("use5"); From 36aa0919eb6c1c44f9d294f70c115fed1cbdc5fa Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 4 Mar 2021 16:34:10 -0800 Subject: [PATCH 35/44] Split link displaypart into 3 One for link prefix and suffix, one for link name, and one for link text. --- src/server/protocol.ts | 178 +----------------- src/server/session.ts | 28 +-- src/services/jsDoc.ts | 30 ++- src/services/types.ts | 13 +- src/services/utilities.ts | 48 +++-- .../unittests/tsserver/completions.ts | 2 +- src/testRunner/unittests/tsserver/jsdocTag.ts | 37 ++-- .../reference/api/tsserverlibrary.d.ts | 25 +-- tests/baselines/reference/api/typescript.d.ts | 15 +- tests/baselines/reference/jsdocLink1.baseline | 115 ++++++----- tests/baselines/reference/jsdocLink2.baseline | 115 ++++++----- tests/baselines/reference/jsdocLink3.baseline | 115 ++++++----- 12 files changed, 327 insertions(+), 394 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index e5848e55f38b3..792e7d7fd1deb 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -983,14 +983,7 @@ namespace ts.server.protocol { /** Name of the JSDoc tag */ name: string; /** Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ - text?: string; - } - - export interface RichJSDocTagInfo { - /** Name of the JSDoc tag */ - name: string; - /** Comment display parts after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ - text?: SymbolDisplayPart[]; + text?: string | SymbolDisplayPart[]; } export interface TextSpanWithContext extends TextSpan { @@ -1965,7 +1958,7 @@ namespace ts.server.protocol { */ export interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; - /** if true - return response as with documentation as display parts instead of string */ + /** if true - return response with documentation as display parts instead of string */ richResponse?: boolean; } @@ -2001,7 +1994,7 @@ namespace ts.server.protocol { /** * Documentation associated with symbol. */ - documentation: string; + documentation: string | SymbolDisplayPart[]; /** * JSDoc tags associated with symbol. @@ -2009,48 +2002,11 @@ namespace ts.server.protocol { tags: JSDocTagInfo[]; } - export interface RichQuickInfoResponseBody { - /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ - kind: ScriptElementKind; - - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - - /** - * Starting file location of symbol. - */ - start: Location; - - /** - * One past last character of symbol. - */ - end: Location; - - /** - * Type and kind of symbol. - */ - displayString: string; - - /** - * Documentation associated with symbol. - */ - documentation: SymbolDisplayPart[]; - - /** - * JSDoc tags associated with symbol. - */ - tags: RichJSDocTagInfo[]; - } - /** * Quickinfo response message. */ export interface QuickInfoResponse extends Response { - body?: QuickInfoResponseBody | RichQuickInfoResponseBody; + body?: QuickInfoResponseBody; } /** @@ -2244,7 +2200,7 @@ namespace ts.server.protocol { export interface CompletionDetailsRequest extends FileLocationRequest { command: CommandTypes.CompletionDetails; arguments: CompletionDetailsRequestArgs; - /** if true - return response as with documentation as display parts instead of string */ + /** if true - return response with documentation as display parts instead of string */ richResponse?: boolean; } @@ -2264,9 +2220,7 @@ namespace ts.server.protocol { } /** A part of a symbol description that links from a jsdoc @link tag to a declaration */ - export interface JSDocLinkPart extends SymbolDisplayPart { - /** The name of the linked declaration. Includes the location inside the @link tag. */ - name: FileSpan; + export interface JSDocLinkDisplayPart extends SymbolDisplayPart { /** The location of the declaration that the @link tag links to. */ target: FileSpan; } @@ -2379,48 +2333,6 @@ namespace ts.server.protocol { source?: SymbolDisplayPart[]; } - /** - * Additional completion entry details, available on demand - */ - export interface RichCompletionEntryDetails { - /** - * The symbol's name. - */ - name: string; - /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ - kind: ScriptElementKind; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - /** - * Display parts of the symbol (similar to quick info). - */ - displayParts: SymbolDisplayPart[]; - - /** - * Documentation strings for the symbol. - */ - documentation?: SymbolDisplayPart[]; - - /** - * JSDoc tags for the symbol. - */ - tags?: RichJSDocTagInfo[]; - - /** - * The associated code actions for this entry - */ - codeActions?: CodeAction[]; - - /** - * Human-readable description of the `source` from the CompletionEntry. - */ - source?: SymbolDisplayPart[]; - } - /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */ export interface CompletionsResponse extends Response { body?: CompletionEntry[]; @@ -2444,7 +2356,7 @@ namespace ts.server.protocol { } export interface CompletionDetailsResponse extends Response { - body?: CompletionEntryDetails[] | RichCompletionEntryDetails[]; + body?: CompletionEntryDetails[]; } /** @@ -2514,47 +2426,6 @@ namespace ts.server.protocol { tags: JSDocTagInfo[]; } - /** - * Represents a single signature to show in signature help. - */ - export interface RichSignatureHelpItem { - - /** - * Whether the signature accepts a variable number of arguments. - */ - isVariadic: boolean; - - /** - * The prefix display parts. - */ - prefixDisplayParts: SymbolDisplayPart[]; - - /** - * The suffix display parts. - */ - suffixDisplayParts: SymbolDisplayPart[]; - - /** - * The separator display parts. - */ - separatorDisplayParts: SymbolDisplayPart[]; - - /** - * The signature helps items for the parameters. - */ - parameters: SignatureHelpParameter[]; - - /** - * The signature's documentation - */ - documentation: SymbolDisplayPart[]; - - /** - * The signature's JSDoc tags - */ - tags: RichJSDocTagInfo[]; - } - /** * Signature help items found in the response of a signature help request. */ @@ -2586,37 +2457,6 @@ namespace ts.server.protocol { argumentCount: number; } - /** - * Signature help items found in the response of a signature help request. - */ - export interface RichSignatureHelpItems { - - /** - * The signature help items. - */ - items: RichSignatureHelpItem[]; - - /** - * The span for which signature help should appear on a signature - */ - applicableSpan: TextSpan; - - /** - * The item selected in the set of available help items. - */ - selectedItemIndex: number; - - /** - * The argument selected in the set of parameters. - */ - argumentIndex: number; - - /** - * The argument count - */ - argumentCount: number; - } - export type SignatureHelpTriggerCharacter = "," | "(" | "<"; export type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")"; @@ -2679,7 +2519,7 @@ namespace ts.server.protocol { export interface SignatureHelpRequest extends FileLocationRequest { command: CommandTypes.SignatureHelp; arguments: SignatureHelpRequestArgs; - /** if true - return response as with documentation as display parts instead of string */ + /** if true - return response with documentation as display parts instead of string */ richResponse?: boolean; } @@ -2687,7 +2527,7 @@ namespace ts.server.protocol { * Response object for a SignatureHelpRequest. */ export interface SignatureHelpResponse extends Response { - body?: SignatureHelpItems | RichSignatureHelpItems; + body?: SignatureHelpItems; } /** diff --git a/src/server/session.ts b/src/server/session.ts index 86d3d1eae4997..79969a43b7237 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1278,7 +1278,7 @@ namespace ts.server { return tags ? tags.map(tag => ({ ...tag, text: tag.text && tag.text.map(part => part.text).join("") })) : []; } - private mapRichJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project): protocol.RichJSDocTagInfo[] { + private mapRichJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project): protocol.JSDocTagInfo[] { return tags ? tags.map(tag => ({ ...tag, text: this.mapDisplayParts(tag.text, project) })) : []; } @@ -1286,14 +1286,13 @@ namespace ts.server { if (!parts) { return []; } - return parts.map(part => part.kind !== "link" ? part : { + return parts.map(part => part.kind !== "linkName" ? part : { ...part, - name: this.toFileSpan((part as JSDocLinkPart).name.fileName, (part as JSDocLinkPart).name.textSpan, project), - target: this.toFileSpan((part as JSDocLinkPart).target.fileName, (part as JSDocLinkPart).target.textSpan, project), + target: this.toFileSpan((part as JSDocLinkDisplayPart).target.fileName, (part as JSDocLinkDisplayPart).target.textSpan, project), }); } - private mapSignatureHelpItems(items: SignatureHelpItem[], project: Project): protocol.RichSignatureHelpItem[] { + private mapRichSignatureHelpItems(items: SignatureHelpItem[], project: Project): protocol.SignatureHelpItem[] { return items.map(item => ({ ...item, documentation: this.mapDisplayParts(item.documentation, project), @@ -1704,7 +1703,7 @@ namespace ts.server { return languageService.isValidBraceCompletionAtPosition(file, position, args.openingBrace.charCodeAt(0)); } - private getQuickInfoWorker(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean, richDocumentation?: boolean): protocol.QuickInfoResponseBody | protocol.RichQuickInfoResponseBody | QuickInfo | undefined { + private getQuickInfoWorker(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean, richDocumentation?: boolean): protocol.QuickInfoResponseBody | QuickInfo | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo)); @@ -1859,7 +1858,7 @@ namespace ts.server { return res; } - private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, fullResult: boolean, richDocumentation?: boolean): readonly protocol.CompletionEntryDetails[] | readonly protocol.RichCompletionEntryDetails[] | readonly CompletionEntryDetails[] { + private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, fullResult: boolean, richDocumentation?: boolean): readonly protocol.CompletionEntryDetails[] | readonly CompletionEntryDetails[] { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); @@ -1936,19 +1935,20 @@ namespace ts.server { !emitSkipped; } - private getSignatureHelpItems(args: protocol.SignatureHelpRequestArgs, simplifiedResult: boolean, richDocumentation?: boolean): protocol.SignatureHelpItems | protocol.RichSignatureHelpItems | SignatureHelpItems | undefined { + private getSignatureHelpItems(args: protocol.SignatureHelpRequestArgs, simplifiedResult: boolean, richDocumentation?: boolean): protocol.SignatureHelpItems | SignatureHelpItems | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); const helpItems = project.getLanguageService().getSignatureHelpItems(file, position, args); - if (!helpItems) { - return undefined; - } - - if (simplifiedResult) { + if (helpItems && simplifiedResult) { + const span = helpItems.applicableSpan; return { ...helpItems, - items: richDocumentation ? this.mapSignatureHelpItems(helpItems.items, project) : helpItems.items, + applicableSpan: { + start: scriptInfo.positionToLineOffset(span.start), + end: scriptInfo.positionToLineOffset(span.start + span.length) + }, + items: richDocumentation ? this.mapRichSignatureHelpItems(helpItems.items, project) : helpItems.items, }; } else { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index f7134e0800b06..d387664a4df8e 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -89,18 +89,29 @@ namespace ts.JsDoc { // Eg. const a: Array | Array; a.length // The property length will have two declarations of property length coming // from Array - Array and Array - const parts: SymbolDisplayPart[] = []; + const parts: SymbolDisplayPart[][] = []; forEachUnique(declarations, declaration => { for (const { comment } of getCommentHavingNodes(declaration)) { if (comment === undefined) continue; - for (const part of getDisplayPartsFromComment(comment, checker)) { - if (!contains(parts, part, (part1,part2) => part1.kind === part2.kind && part1.text === part2.text)) { - parts.push(part); - } + const newparts = getDisplayPartsFromComment(comment, checker); + if (!contains(parts, newparts, isIdenticalListOfDisplayParts)) { + parts.push(newparts); } } }); - return intersperse(parts, lineBreakPart()); + return flatten(intersperse(parts, [lineBreakPart()])); + } + + function isIdenticalListOfDisplayParts(parts1: SymbolDisplayPart[], parts2: SymbolDisplayPart[]) { + if (parts1.length !== parts2.length) { + return false; + } + for (let i = 0; i < parts1.length; i++) { + if (parts1[i].kind !== parts2[i].kind || parts1[i].text !== parts2[i].text) { + return false; + } + } + return true; } function getCommentHavingNodes(declaration: Declaration): readonly (JSDoc | JSDocTag)[] { @@ -127,8 +138,11 @@ namespace ts.JsDoc { return tags; } - function getDisplayPartsFromComment(comment: readonly (JSDocText | JSDocLink)[], checker: TypeChecker | undefined) { - return comment.map(node => node.kind === SyntaxKind.JSDocText ? textPart(node.text) : linkPart(node, checker)); + function getDisplayPartsFromComment(comment: readonly (JSDocText | JSDocLink)[], checker: TypeChecker | undefined): SymbolDisplayPart[] { + return flatMap( + comment, + node => node.kind === SyntaxKind.JSDocText ? [textPart(node.text)] : buildLinkParts(node, checker) + ) as SymbolDisplayPart[]; } function getCommentDisplayParts(tag: JSDocTag, checker?: TypeChecker): SymbolDisplayPart[] | undefined { diff --git a/src/services/types.ts b/src/services/types.ts index d0c2df0f5a3c6..724ffef43e10d 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1033,6 +1033,8 @@ namespace ts { functionName, regularExpressionLiteral, link, + linkName, + linkText, } export interface SymbolDisplayPart { @@ -1040,8 +1042,7 @@ namespace ts { kind: string; } - export interface JSDocLinkPart extends SymbolDisplayPart { - name: DocumentSpan; + export interface JSDocLinkDisplayPart extends SymbolDisplayPart { target: DocumentSpan; } @@ -1398,8 +1399,14 @@ namespace ts { /** String literal */ string = "string", - /** Jsdoc {@link entityname} */ + /** Jsdoc @link: in `{@link C link text}`, the before and after text "{@link " and "}" */ link = "link", + + /** Jsdoc @link: in `{@link C link text}`, the entity name "C" */ + linkName = "link name", + + /** Jsdoc @link: in `{@link C link text}`, the link text "link text" */ + linkText = "link text", } export const enum ScriptElementKindModifier { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index cffed611f10e5..3fb677efd00c6 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -2183,24 +2183,42 @@ namespace ts { return displayPart(text, SymbolDisplayPartKind.text); } - /** return type subtype reduction elimination! */ - export function linkPart(link: JSDocLink, checker?: TypeChecker): SymbolDisplayPart { - if (!link.name) {return textPart(`{@link ${link.text}}`);} - const text = `{@link ${getTextOfNode(link.name)}${link.text}}`; - const symbol = checker?.getSymbolAtLocation(link.name); - if (!symbol?.valueDeclaration) {return textPart(text);} + export function linkTextPart(text: string) { + return displayPart(text, SymbolDisplayPartKind.linkText); + } + + export function linkNamePart(name: EntityName, target: Declaration): JSDocLinkDisplayPart { return { - text, - kind: SymbolDisplayPartKind[SymbolDisplayPartKind.link], - name: { - fileName: getSourceFileOfNode(link).fileName, - textSpan: createTextSpanFromNode(link.name), - }, + text: getTextOfNode(name), + kind: SymbolDisplayPartKind[SymbolDisplayPartKind.linkName], target: { - fileName: getSourceFileOfNode(symbol.valueDeclaration).fileName, - textSpan: createTextSpanFromNode(symbol.valueDeclaration), + fileName: getSourceFileOfNode(target).fileName, + textSpan: createTextSpanFromNode(target), }, - } as JSDocLinkPart; + }; + } + + export function linkPart(text: string) { + return displayPart(text, SymbolDisplayPartKind.link); + } + + export function buildLinkParts(link: JSDocLink, checker?: TypeChecker): SymbolDisplayPart[] { + const parts = [linkPart("{@link ")]; + if (!link.name) { + if (link.text) {parts.push(linkTextPart(link.text));} + } + else { + const symbol = checker?.getSymbolAtLocation(link.name); + if (symbol?.valueDeclaration) { + parts.push(linkNamePart(link.name, symbol.valueDeclaration)); + if (link.text) {parts.push(linkTextPart(link.text));} + } + else { + parts.push(linkTextPart(getTextOfNode(link.name) + link.text)); + } + } + parts.push(linkPart("}")); + return parts; } const carriageReturnLineFeed = "\r\n"; diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index eb1c724b8ce27..1f098dcdd581c 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -70,7 +70,7 @@ namespace ts.projectSystem { name: "foo", source: [{ text: "./a", kind: "text" }], }; - assert.deepEqual(detailsResponse, [ + assert.deepEqual(detailsResponse, [ { codeActions: [ { diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index ad6ad6813fd1b..2577ec56a7be3 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -41,13 +41,9 @@ var x = 1`); text: "", }, { kind: "link", - name: { - fileName: "someFile1.js", - textSpan: { - length: 1, - start: 28, - } - }, + text: "{@link ", + }, { + kind: "linkName", target: { fileName: "someFile1.js", textSpan: { @@ -55,8 +51,11 @@ var x = 1`); start: 0, } }, - text: "{@link C}", - } as SymbolDisplayPart], + text: "C", + } as SymbolDisplayPart, { + kind: "link", + text: "}" + }], }] }); }); @@ -96,18 +95,11 @@ var x = 1`); documentation: [{ kind: "text", text: "", - }, { - kind: "lineBreak", - text: "\n", }, { kind: "link", - name: { - fileName: "someFile1.js", - textSpan: { - length: 1, - start: 23, - } - }, + text: "{@link ", + }, { + kind: "linkName", target: { fileName: "someFile1.js", textSpan: { @@ -115,8 +107,11 @@ var x = 1`); start: 0, } }, - text: "{@link C}" - } as SymbolDisplayPart], + text: "C" + } as SymbolDisplayPart, { + kind: "link", + text: "}" + }], tags: undefined, }); }); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index c0fe4089036d5..7275e53073e2e 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -6022,14 +6022,15 @@ declare namespace ts { enumMemberName = 19, functionName = 20, regularExpressionLiteral = 21, - link = 22 + link = 22, + linkName = 23, + linkText = 24 } interface SymbolDisplayPart { text: string; kind: string; } - interface JSDocLinkPart extends SymbolDisplayPart { - name: DocumentSpan; + interface JSDocLinkDisplayPart extends SymbolDisplayPart { target: DocumentSpan; } interface JSDocTagInfo { @@ -6324,8 +6325,12 @@ declare namespace ts { jsxAttribute = "JSX attribute", /** String literal */ string = "string", - /** Jsdoc {@link entityname} */ - link = "link" + /** Jsdoc @link: in `{@link C link text}`, the before and after text "{@link " and "}" */ + link = "link", + /** Jsdoc @link: in `{@link C link text}`, the entity name "C" */ + linkName = "link name", + /** Jsdoc @link: in `{@link C link text}`, the link text "link text" */ + linkText = "link text" } enum ScriptElementKindModifier { none = "", @@ -8041,7 +8046,7 @@ declare namespace ts.server.protocol { */ interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; - /** if true - return response as with documentation as display parts instead of string */ + /** if true - return response with documentation as display parts instead of string */ richResponse?: boolean; } /** @@ -8278,7 +8283,7 @@ declare namespace ts.server.protocol { interface CompletionDetailsRequest extends FileLocationRequest { command: CommandTypes.CompletionDetails; arguments: CompletionDetailsRequestArgs; - /** if true - return response as with documentation as display parts instead of string */ + /** if true - return response with documentation as display parts instead of string */ richResponse?: boolean; } /** @@ -8295,9 +8300,7 @@ declare namespace ts.server.protocol { kind: string; } /** A part of a symbol description that links from a jsdoc @link tag to a declaration */ - interface JSDocLinkPart extends SymbolDisplayPart { - /** The name of the linked declaration. Includes the location inside the @link tag. */ - name: FileSpan; + interface JSDocLinkDisplayPart extends SymbolDisplayPart { /** The location of the declaration that the @link tag links to. */ target: FileSpan; } @@ -8652,7 +8655,7 @@ declare namespace ts.server.protocol { interface SignatureHelpRequest extends FileLocationRequest { command: CommandTypes.SignatureHelp; arguments: SignatureHelpRequestArgs; - /** if true - return response as with documentation as display parts instead of string */ + /** if true - return response with documentation as display parts instead of string */ richResponse?: boolean; } /** diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index b59b504c427c3..1a403a8f51273 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -6022,14 +6022,15 @@ declare namespace ts { enumMemberName = 19, functionName = 20, regularExpressionLiteral = 21, - link = 22 + link = 22, + linkName = 23, + linkText = 24 } interface SymbolDisplayPart { text: string; kind: string; } - interface JSDocLinkPart extends SymbolDisplayPart { - name: DocumentSpan; + interface JSDocLinkDisplayPart extends SymbolDisplayPart { target: DocumentSpan; } interface JSDocTagInfo { @@ -6324,8 +6325,12 @@ declare namespace ts { jsxAttribute = "JSX attribute", /** String literal */ string = "string", - /** Jsdoc {@link entityname} */ - link = "link" + /** Jsdoc @link: in `{@link C link text}`, the before and after text "{@link " and "}" */ + link = "link", + /** Jsdoc @link: in `{@link C link text}`, the entity name "C" */ + linkName = "link name", + /** Jsdoc @link: in `{@link C link text}`, the link text "link text" */ + linkText = "link text" } enum ScriptElementKindModifier { none = "", diff --git a/tests/baselines/reference/jsdocLink1.baseline b/tests/baselines/reference/jsdocLink1.baseline index 1e7d085d2625b..3924cca14d7de 100644 --- a/tests/baselines/reference/jsdocLink1.baseline +++ b/tests/baselines/reference/jsdocLink1.baseline @@ -52,19 +52,12 @@ "kind": "text" }, { - "text": "\n", - "kind": "lineBreak" + "text": "{@link ", + "kind": "link" }, { - "text": "{@link C}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 26, - "length": 1 - } - }, + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", "textSpan": { @@ -72,6 +65,10 @@ "length": 11 } } + }, + { + "text": "}", + "kind": "link" } ], "tags": [ @@ -83,15 +80,12 @@ "kind": "text" }, { - "text": "{@link C}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 52, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", "textSpan": { @@ -100,20 +94,21 @@ } } }, + { + "text": "}", + "kind": "link" + }, { "text": ". A default one.\n", "kind": "text" }, { - "text": "{@link C()}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 81, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", "textSpan": { @@ -122,20 +117,25 @@ } } }, + { + "text": "()", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" + }, { "text": "\n", "kind": "text" }, { - "text": "{@link C|postfix text}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 96, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", "textSpan": { @@ -144,13 +144,29 @@ } } }, + { + "text": "|postfix text", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" + }, { "text": "\n", "kind": "text" }, { - "text": "{@link unformattedpostfix text}", - "kind": "text" + "text": "{@link ", + "kind": "link" + }, + { + "text": "unformattedpostfix text", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" } ] }, @@ -162,15 +178,12 @@ "kind": "text" }, { - "text": "{@link C}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/jsdocLink1.ts", - "textSpan": { - "start": 163, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink1.ts", "textSpan": { @@ -179,6 +192,10 @@ } } }, + { + "text": "}", + "kind": "link" + }, { "text": " its great", "kind": "text" diff --git a/tests/baselines/reference/jsdocLink2.baseline b/tests/baselines/reference/jsdocLink2.baseline index f9cff3a428f92..9111696d2d848 100644 --- a/tests/baselines/reference/jsdocLink2.baseline +++ b/tests/baselines/reference/jsdocLink2.baseline @@ -52,19 +52,12 @@ "kind": "text" }, { - "text": "\n", - "kind": "lineBreak" + "text": "{@link ", + "kind": "link" }, { - "text": "{@link C}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 14, - "length": 1 - } - }, + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", "textSpan": { @@ -72,6 +65,10 @@ "length": 11 } } + }, + { + "text": "}", + "kind": "link" } ], "tags": [ @@ -83,15 +80,12 @@ "kind": "text" }, { - "text": "{@link C}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 40, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", "textSpan": { @@ -100,20 +94,21 @@ } } }, + { + "text": "}", + "kind": "link" + }, { "text": ". A default one.\n", "kind": "text" }, { - "text": "{@link C()}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 69, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", "textSpan": { @@ -122,20 +117,25 @@ } } }, + { + "text": "()", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" + }, { "text": "\n", "kind": "text" }, { - "text": "{@link C|postfix text}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 84, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", "textSpan": { @@ -144,13 +144,29 @@ } } }, + { + "text": "|postfix text", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" + }, { "text": "\n", "kind": "text" }, { - "text": "{@link unformattedpostfix text}", - "kind": "text" + "text": "{@link ", + "kind": "link" + }, + { + "text": "unformattedpostfix text", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" } ] }, @@ -162,15 +178,12 @@ "kind": "text" }, { - "text": "{@link C}", - "kind": "link", - "name": { - "fileName": "/tests/cases/fourslash/script.ts", - "textSpan": { - "start": 151, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/tests/cases/fourslash/jsdocLink2.ts", "textSpan": { @@ -179,6 +192,10 @@ } } }, + { + "text": "}", + "kind": "link" + }, { "text": " its great", "kind": "text" diff --git a/tests/baselines/reference/jsdocLink3.baseline b/tests/baselines/reference/jsdocLink3.baseline index 28961e06d7c1e..2d44f4f69cd56 100644 --- a/tests/baselines/reference/jsdocLink3.baseline +++ b/tests/baselines/reference/jsdocLink3.baseline @@ -52,19 +52,12 @@ "kind": "text" }, { - "text": "\n", - "kind": "lineBreak" + "text": "{@link ", + "kind": "link" }, { - "text": "{@link C}", - "kind": "link", - "name": { - "fileName": "/module1.ts", - "textSpan": { - "start": 47, - "length": 1 - } - }, + "text": "C", + "kind": "linkName", "target": { "fileName": "/jsdocLink3.ts", "textSpan": { @@ -72,6 +65,10 @@ "length": 18 } } + }, + { + "text": "}", + "kind": "link" } ], "tags": [ @@ -83,15 +80,12 @@ "kind": "text" }, { - "text": "{@link C}", - "kind": "link", - "name": { - "fileName": "/module1.ts", - "textSpan": { - "start": 73, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/jsdocLink3.ts", "textSpan": { @@ -100,20 +94,21 @@ } } }, + { + "text": "}", + "kind": "link" + }, { "text": ". A default one.\n", "kind": "text" }, { - "text": "{@link C()}", - "kind": "link", - "name": { - "fileName": "/module1.ts", - "textSpan": { - "start": 102, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/jsdocLink3.ts", "textSpan": { @@ -122,20 +117,25 @@ } } }, + { + "text": "()", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" + }, { "text": "\n", "kind": "text" }, { - "text": "{@link C|postfix text}", - "kind": "link", - "name": { - "fileName": "/module1.ts", - "textSpan": { - "start": 117, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/jsdocLink3.ts", "textSpan": { @@ -144,13 +144,29 @@ } } }, + { + "text": "|postfix text", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" + }, { "text": "\n", "kind": "text" }, { - "text": "{@link unformattedpostfix text}", - "kind": "text" + "text": "{@link ", + "kind": "link" + }, + { + "text": "unformattedpostfix text", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" } ] }, @@ -162,15 +178,12 @@ "kind": "text" }, { - "text": "{@link C}", - "kind": "link", - "name": { - "fileName": "/module1.ts", - "textSpan": { - "start": 184, - "length": 1 - } - }, + "text": "{@link ", + "kind": "link" + }, + { + "text": "C", + "kind": "linkName", "target": { "fileName": "/jsdocLink3.ts", "textSpan": { @@ -179,6 +192,10 @@ } } }, + { + "text": "}", + "kind": "link" + }, { "text": " its great", "kind": "text" From c3883b7a4b2d81309cd425d2a476c4c59a55c20d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 4 Mar 2021 16:38:52 -0800 Subject: [PATCH 36/44] update baselines --- .../reference/api/tsserverlibrary.d.ts | 143 +----------------- .../signatureHelpJSDocCallbackTag.baseline | 30 +++- 2 files changed, 30 insertions(+), 143 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 7275e53073e2e..2441199304627 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -7318,13 +7318,7 @@ declare namespace ts.server.protocol { /** Name of the JSDoc tag */ name: string; /** Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ - text?: string; - } - interface RichJSDocTagInfo { - /** Name of the JSDoc tag */ - name: string; - /** Comment display parts after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ - text?: SymbolDisplayPart[]; + text?: string | SymbolDisplayPart[]; } interface TextSpanWithContext extends TextSpan { contextStart?: Location; @@ -8076,47 +8070,17 @@ declare namespace ts.server.protocol { /** * Documentation associated with symbol. */ - documentation: string; + documentation: string | SymbolDisplayPart[]; /** * JSDoc tags associated with symbol. */ tags: JSDocTagInfo[]; } - interface RichQuickInfoResponseBody { - /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ - kind: ScriptElementKind; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - /** - * Starting file location of symbol. - */ - start: Location; - /** - * One past last character of symbol. - */ - end: Location; - /** - * Type and kind of symbol. - */ - displayString: string; - /** - * Documentation associated with symbol. - */ - documentation: SymbolDisplayPart[]; - /** - * JSDoc tags associated with symbol. - */ - tags: RichJSDocTagInfo[]; - } /** * Quickinfo response message. */ interface QuickInfoResponse extends Response { - body?: QuickInfoResponseBody | RichQuickInfoResponseBody; + body?: QuickInfoResponseBody; } /** * Arguments for format messages. @@ -8406,43 +8370,6 @@ declare namespace ts.server.protocol { */ source?: SymbolDisplayPart[]; } - /** - * Additional completion entry details, available on demand - */ - interface RichCompletionEntryDetails { - /** - * The symbol's name. - */ - name: string; - /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ - kind: ScriptElementKind; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - /** - * Display parts of the symbol (similar to quick info). - */ - displayParts: SymbolDisplayPart[]; - /** - * Documentation strings for the symbol. - */ - documentation?: SymbolDisplayPart[]; - /** - * JSDoc tags for the symbol. - */ - tags?: RichJSDocTagInfo[]; - /** - * The associated code actions for this entry - */ - codeActions?: CodeAction[]; - /** - * Human-readable description of the `source` from the CompletionEntry. - */ - source?: SymbolDisplayPart[]; - } /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */ interface CompletionsResponse extends Response { body?: CompletionEntry[]; @@ -8463,7 +8390,7 @@ declare namespace ts.server.protocol { readonly entries: readonly CompletionEntry[]; } interface CompletionDetailsResponse extends Response { - body?: CompletionEntryDetails[] | RichCompletionEntryDetails[]; + body?: CompletionEntryDetails[]; } /** * Signature help information for a single parameter @@ -8519,39 +8446,6 @@ declare namespace ts.server.protocol { */ tags: JSDocTagInfo[]; } - /** - * Represents a single signature to show in signature help. - */ - interface RichSignatureHelpItem { - /** - * Whether the signature accepts a variable number of arguments. - */ - isVariadic: boolean; - /** - * The prefix display parts. - */ - prefixDisplayParts: SymbolDisplayPart[]; - /** - * The suffix display parts. - */ - suffixDisplayParts: SymbolDisplayPart[]; - /** - * The separator display parts. - */ - separatorDisplayParts: SymbolDisplayPart[]; - /** - * The signature helps items for the parameters. - */ - parameters: SignatureHelpParameter[]; - /** - * The signature's documentation - */ - documentation: SymbolDisplayPart[]; - /** - * The signature's JSDoc tags - */ - tags: RichJSDocTagInfo[]; - } /** * Signature help items found in the response of a signature help request. */ @@ -8577,31 +8471,6 @@ declare namespace ts.server.protocol { */ argumentCount: number; } - /** - * Signature help items found in the response of a signature help request. - */ - interface RichSignatureHelpItems { - /** - * The signature help items. - */ - items: RichSignatureHelpItem[]; - /** - * The span for which signature help should appear on a signature - */ - applicableSpan: TextSpan; - /** - * The item selected in the set of available help items. - */ - selectedItemIndex: number; - /** - * The argument selected in the set of parameters. - */ - argumentIndex: number; - /** - * The argument count - */ - argumentCount: number; - } type SignatureHelpTriggerCharacter = "," | "(" | "<"; type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")"; /** @@ -8662,7 +8531,7 @@ declare namespace ts.server.protocol { * Response object for a SignatureHelpRequest. */ interface SignatureHelpResponse extends Response { - body?: SignatureHelpItems | RichSignatureHelpItems; + body?: SignatureHelpItems; } /** * Synchronous request for semantic diagnostics of one file. @@ -10299,7 +10168,7 @@ declare namespace ts.server { private mapJSDocTagInfo; private mapRichJSDocTagInfo; private mapDisplayParts; - private mapSignatureHelpItems; + private mapRichSignatureHelpItems; private mapDefinitionInfo; private static mapToOriginalLocation; private toFileSpan; diff --git a/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline b/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline index 6d74f9e60dd81..63e3e900022d8 100644 --- a/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline +++ b/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline @@ -175,8 +175,14 @@ } ], "applicableSpan": { - "start": 480, - "length": 14 + "start": { + "line": 22, + "offset": 3 + }, + "end": { + "line": 22, + "offset": 17 + } }, "selectedItemIndex": 0, "argumentIndex": 0, @@ -359,8 +365,14 @@ } ], "applicableSpan": { - "start": 480, - "length": 14 + "start": { + "line": 22, + "offset": 3 + }, + "end": { + "line": 22, + "offset": 17 + } }, "selectedItemIndex": 0, "argumentIndex": 1, @@ -543,8 +555,14 @@ } ], "applicableSpan": { - "start": 480, - "length": 14 + "start": { + "line": 22, + "offset": 3 + }, + "end": { + "line": 22, + "offset": 17 + } }, "selectedItemIndex": 0, "argumentIndex": 2, From 89e49551a4148a451d1daf683ef322bf2a78052c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 5 Mar 2021 09:10:08 -0800 Subject: [PATCH 37/44] Provide JSDocTagInfo.text: string to full clients by default Instead of upgrading them to displayparts. --- src/server/session.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 79969a43b7237..d96a4b2a40666 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1275,7 +1275,7 @@ namespace ts.server { } private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined): protocol.JSDocTagInfo[] { - return tags ? tags.map(tag => ({ ...tag, text: tag.text && tag.text.map(part => part.text).join("") })) : []; + return tags ? tags.map(tag => ({ ...tag, text: tag.text?.map(part => part.text).join("") })) : []; } private mapRichJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project): protocol.JSDocTagInfo[] { @@ -1728,7 +1728,10 @@ namespace ts.server { })}; } else { - return quickInfo; + return richDocumentation ? quickInfo : { + ...quickInfo, + tags: this.mapJSDocTagInfo(quickInfo.tags) as JSDocTagInfo[] + }; } } @@ -1868,7 +1871,8 @@ namespace ts.server { const { name, source, data } = typeof entryName === "string" ? { name: entryName, source: undefined, data: undefined } : entryName; return project.getLanguageService().getCompletionEntryDetails(file, position, name, formattingOptions, source, this.getPreferences(file), data ? cast(data, isCompletionEntryData) : undefined); }); - return fullResult ? result + return fullResult + ? (richDocumentation ? result : result.map(details => ({ ...details, tags: this.mapJSDocTagInfo(details.tags) as JSDocTagInfo[] }))) : richDocumentation ? result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)), @@ -1951,6 +1955,12 @@ namespace ts.server { items: richDocumentation ? this.mapRichSignatureHelpItems(helpItems.items, project) : helpItems.items, }; } + else if (helpItems && richDocumentation) { + return { + ...helpItems, + items: helpItems.items.map(item => ({ ...item, tags: this.mapJSDocTagInfo(item.tags) as JSDocTagInfo[] })) + } + } else { return helpItems; } @@ -2672,7 +2682,7 @@ namespace ts.server { return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ true, request.richResponse)); }, [CommandNames.QuickinfoFull]: (request: protocol.QuickInfoRequest) => { - return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ false)); + return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ false, request.richResponse)); }, [CommandNames.GetOutliningSpans]: (request: protocol.FileRequest) => { return this.requiredResponse(this.getOutliningSpans(request.arguments, /*simplifiedResult*/ true)); @@ -2735,7 +2745,7 @@ namespace ts.server { return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ false, request.richResponse)); }, [CommandNames.CompletionDetailsFull]: (request: protocol.CompletionDetailsRequest) => { - return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ true)); + return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ true, request.richResponse)); }, [CommandNames.CompileOnSaveAffectedFileList]: (request: protocol.CompileOnSaveAffectedFileListRequest) => { return this.requiredResponse(this.getCompileOnSaveAffectedFileList(request.arguments)); @@ -2747,7 +2757,7 @@ namespace ts.server { return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ true, request.richResponse)); }, [CommandNames.SignatureHelpFull]: (request: protocol.SignatureHelpRequest) => { - return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ false)); + return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ false, request.richResponse)); }, [CommandNames.CompilerOptionsDiagnosticsFull]: (request: protocol.CompilerOptionsDiagnosticsRequest) => { return this.requiredResponse(this.getCompilerOptionsDiagnostics(request.arguments)); From 52d64db512f4d64ff7ad0c95bb35681fa8da07e6 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 8 Mar 2021 11:56:49 -0800 Subject: [PATCH 38/44] Real server tests --- src/server/session.ts | 52 +- .../unittests/tsserver/completions.ts | 2 +- src/testRunner/unittests/tsserver/jsdocTag.ts | 718 ++++++++++++++++-- .../reference/api/tsserverlibrary.d.ts | 3 +- .../signatureHelpJSDocCallbackTag.baseline | 30 +- tests/cases/fourslash/fourslash.ts | 2 +- .../cases/fourslash/gotoDefinitionLinkTag1.ts | 7 + .../completionEntryDetailAcrossFiles01.ts | 5 +- .../completionEntryDetailAcrossFiles02.ts | 4 +- tests/cases/fourslash/server/completions02.ts | 4 +- ...nsImport_defaultAndNamedConflict_server.ts | 6 +- 11 files changed, 689 insertions(+), 144 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index d96a4b2a40666..e615fbfc9148e 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1274,12 +1274,11 @@ namespace ts.server { result; } - private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined): protocol.JSDocTagInfo[] { - return tags ? tags.map(tag => ({ ...tag, text: tag.text?.map(part => part.text).join("") })) : []; - } - - private mapRichJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project): protocol.JSDocTagInfo[] { - return tags ? tags.map(tag => ({ ...tag, text: this.mapDisplayParts(tag.text, project) })) : []; + private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project, richResponse: boolean): protocol.JSDocTagInfo[] { + return tags ? tags.map(tag => ({ + ...tag, + text: richResponse ? this.mapDisplayParts(tag.text, project) : tag.text?.map(part => part.text).join("") + })) : []; } private mapDisplayParts(parts: SymbolDisplayPart[] | undefined, project: Project): protocol.SymbolDisplayPart[] { @@ -1292,11 +1291,12 @@ namespace ts.server { }); } - private mapRichSignatureHelpItems(items: SignatureHelpItem[], project: Project): protocol.SignatureHelpItem[] { + private mapSignatureHelpItems(items: SignatureHelpItem[], project: Project, richResponse: boolean): protocol.SignatureHelpItem[] { return items.map(item => ({ ...item, documentation: this.mapDisplayParts(item.documentation, project), - tags: this.mapRichJSDocTagInfo(item.tags, project), + parameters: item.parameters.map(p => ({ ...p, documentation: this.mapDisplayParts(p.documentation, project) })), + tags: this.mapJSDocTagInfo(item.tags, project, richResponse), })); } @@ -1719,18 +1719,14 @@ namespace ts.server { start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), displayString, - ...(richDocumentation ? { - documentation: this.mapDisplayParts(quickInfo.documentation, project), - tags: this.mapRichJSDocTagInfo(quickInfo.tags, project), - } : { - documentation: displayPartsToString(quickInfo.documentation), - tags: this.mapJSDocTagInfo(quickInfo.tags), - })}; + documentation: richDocumentation ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation), + tags: this.mapJSDocTagInfo(quickInfo.tags, project, !!richDocumentation), + }; } else { return richDocumentation ? quickInfo : { ...quickInfo, - tags: this.mapJSDocTagInfo(quickInfo.tags) as JSDocTagInfo[] + tags: this.mapJSDocTagInfo(quickInfo.tags, project, /*richDocumentation*/ false) as JSDocTagInfo[] }; } } @@ -1872,18 +1868,12 @@ namespace ts.server { return project.getLanguageService().getCompletionEntryDetails(file, position, name, formattingOptions, source, this.getPreferences(file), data ? cast(data, isCompletionEntryData) : undefined); }); return fullResult - ? (richDocumentation ? result : result.map(details => ({ ...details, tags: this.mapJSDocTagInfo(details.tags) as JSDocTagInfo[] }))) - : richDocumentation ? result.map(details => ({ - ...details, - codeActions: map(details.codeActions, action => this.mapCodeAction(action)), - documentation: this.mapDisplayParts(details.documentation, project), - tags: this.mapRichJSDocTagInfo(details.tags, project), - })) + ? (richDocumentation ? result : result.map(details => ({ ...details, tags: this.mapJSDocTagInfo(details.tags, project, /*richDocumentation*/ false) as JSDocTagInfo[] }))) : result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)), documentation: this.mapDisplayParts(details.documentation, project), - tags: this.mapJSDocTagInfo(details.tags) + tags: this.mapJSDocTagInfo(details.tags, project, !!richDocumentation), })); } @@ -1952,17 +1942,17 @@ namespace ts.server { start: scriptInfo.positionToLineOffset(span.start), end: scriptInfo.positionToLineOffset(span.start + span.length) }, - items: richDocumentation ? this.mapRichSignatureHelpItems(helpItems.items, project) : helpItems.items, + items: this.mapSignatureHelpItems(helpItems.items, project, !!richDocumentation), }; } - else if (helpItems && richDocumentation) { - return { - ...helpItems, - items: helpItems.items.map(item => ({ ...item, tags: this.mapJSDocTagInfo(item.tags) as JSDocTagInfo[] })) - } + else if (richDocumentation || !helpItems) { + return helpItems; } else { - return helpItems; + return { + ...helpItems, + items: helpItems.items.map(item => ({ ...item, tags: this.mapJSDocTagInfo(item.tags, project, /*richDocumentation*/ false) as JSDocTagInfo[] })) + }; } } diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index 1f098dcdd581c..0d14838690fa9 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -117,7 +117,7 @@ namespace ts.projectSystem { commands: undefined, } ], - tags: undefined, + tags: [], ...detailsCommon, } ]); diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 2577ec56a7be3..03e0218d53771 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -1,38 +1,97 @@ namespace ts.projectSystem { describe("unittests:: tsserver:: jsdoc @link ", () => { - it("should provide a target span for a working link in a tag", () => { - const file: File = { - path: "someFile1.js", - content: `class C { } -/** @wat {@link C} */ -var x = 1` - }; - const host = createServerHost([libFile], { useCaseSensitiveFileNames: true }); - const projectService = createProjectService(host); - projectService.setCompilerOptionsForInferredProjects({ - module: ModuleKind.CommonJS, - allowJs: true, - allowSyntheticDefaultImports: true, - allowNonTsExtensions: true - }); - projectService.openClientFile(file.path, `class C { } -/** @wat {@link C} */ -var x = 1`); + const config: File = { + path: "/a/tsconfig.json", + content: `{ +"compilerOptions": { +"checkJs": true, +"noEmit": true +} +"files": ["someFile1.js"] +} +` + }; + function assertQuickInfoJSDoc(file: File, options: { + richResponse: boolean, + command: protocol.CommandTypes, + tags: string | unknown[] | undefined, + documentation: string | unknown[] + }) { - const project = projectService.inferredProjects[0]; + const { command, richResponse, tags, documentation } = options; + const session = createSession(createServerHost([file, config])); + openFilesForSession([file], session); const indexOfX = file.content.indexOf("x"); - assert.deepEqual(project.getLanguageService(/*ensureSynchronized*/ true).getQuickInfoAtPosition(file.path, indexOfX), { - kind: ScriptElementKind.variableElement, + const quickInfo = session.executeCommandSeq({ + command: command as protocol.CommandTypes.Quickinfo, + richResponse, + arguments: { + file: file.path, + position: indexOfX, + } as protocol.FileLocationRequestArgs + }).response; + const summaryAndLocation = command === protocol.CommandTypes.Quickinfo ? { + displayString: "var x: number", + start: { + line: 3, + offset: 5, + }, + end: { + line: 3, + offset: 6, + } + } : { + displayParts: [{ + kind: "keyword", + text: "var", + }, { + kind: "space", + text: " ", + }, { + kind: "localName", + text: "x", + }, { + kind: "punctuation", + text: ":", + }, { + kind: "space", + text: " ", + }, { + kind: "keyword", + text: "number", + }], + textSpan: { + length: 1, + start: 38, + } + }; + assert.deepEqual(quickInfo, { + kind: "var", kindModifiers: "", - textSpan: { start: indexOfX, length: 1 }, - displayParts: [ - { text: "var", kind: "keyword" }, - { text: " ", kind: "space" }, - { text: "x", kind: "localName" }, - { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }, - { text: "number", kind: "keyword" } - ], + ...summaryAndLocation, + documentation, + tags + }); + } + + const linkInTag: File = { + path: "/a/someFile1.js", + content: `class C { } +/** @wat {@link C} */ +var x = 1` + }; + const linkInComment: File = { + path: "/a/someFile1.js", + content: `class C { } + /** {@link C} */ +var x = 1 +;` + }; + + it("for quickinfo, should provide display parts plus a span for a working link in a tag", () => { + assertQuickInfoJSDoc(linkInTag, { + command: protocol.CommandTypes.Quickinfo, + richResponse: true, documentation: [], tags: [{ name: "wat", @@ -45,74 +104,589 @@ var x = 1`); }, { kind: "linkName", target: { - fileName: "someFile1.js", + end: { + line: 1, + offset: 12, + }, + file: "/a/someFile1.js", + start: { + line: 1, + offset: 1, + }, + }, + text: "C", + }, { + kind: "link", + text: "}", + }] + }], + }); + }); + it("for quickinfo, should provide a string for a working link in a tag", () => { + assertQuickInfoJSDoc(linkInTag, { + command: protocol.CommandTypes.Quickinfo, + richResponse: false, + documentation: "", + tags: [{ + name: "wat", + text: "{@link C}" + }], + }); + }); + it("for quickinfo, should provide display parts for a working link in a comment", () => { + assertQuickInfoJSDoc(linkInComment, { + command: protocol.CommandTypes.Quickinfo, + richResponse: true, + documentation: [{ + kind: "text", + text: "", + }, { + kind: "link", + text: "{@link ", + }, { + kind: "linkName", + target: { + end: { + line: 1, + offset: 12, + }, + file: "/a/someFile1.js", + start: { + line: 1, + offset: 1, + }, + }, + text: "C", + }, { + kind: "link", + text: "}", + }], + tags: [], + }); + }); + it("for quickinfo, should provide a string for a working link in a comment", () => { + assertQuickInfoJSDoc(linkInComment, { + command: protocol.CommandTypes.Quickinfo, + richResponse: false, + documentation: "{@link C}", + tags: [], + }); + }); + + it("for quickinfo-full, should provide display parts plus a span for a working link in a tag", () => { + assertQuickInfoJSDoc(linkInTag, { + command: protocol.CommandTypes.QuickinfoFull, + richResponse: true, + documentation: [], + tags: [{ + name: "wat", + text: [{ + kind: "text", + text: "", + }, { + kind: "link", + text: "{@link ", + }, { + kind: "linkName", + target: { + fileName: "/a/someFile1.js", textSpan: { length: 11, - start: 0, - } + start: 0 + }, }, text: "C", - } as SymbolDisplayPart, { + }, { kind: "link", - text: "}" + text: "}", + }] + }], + }); + }); + it("for quickinfo-full, should provide a string for a working link in a tag", () => { + assertQuickInfoJSDoc(linkInTag, { + command: protocol.CommandTypes.QuickinfoFull, + richResponse: false, + documentation: [], + tags: [{ + name: "wat", + text: "{@link C}" + }], + }); + }); + it("for quickinfo-full, should provide display parts plus a span for a working link in a comment", () => { + assertQuickInfoJSDoc(linkInComment, { + command: protocol.CommandTypes.QuickinfoFull, + richResponse: true, + documentation: [{ + kind: "text", + text: "", + }, { + kind: "link", + text: "{@link ", + }, { + kind: "linkName", + target: { + fileName: "/a/someFile1.js", + textSpan: { + length: 11, + start: 0 + }, + }, + text: "C", + }, { + kind: "link", + text: "}", + }], + tags: undefined, + }); + }); + it("for quickinfo-full, should provide a string for a working link in a comment", () => { + assertQuickInfoJSDoc(linkInComment, { + command: protocol.CommandTypes.QuickinfoFull, + richResponse: false, + documentation: [{ + kind: "text", + text: "", + }, { + kind: "link", + text: "{@link ", + }, { + kind: "linkName", + target: { + fileName: "/a/someFile1.js", + textSpan: { + length: 11, + start: 0 + }, + }, + text: "C", + }, { + kind: "link", + text: "}", }], - }] + tags: [], }); }); - it("should provide a target span for a working link in a comment", () => { - const file: File = { - path: "someFile1.js", + + function assertSignatureHelpJSDoc(options: { + richResponse: boolean, + command: protocol.CommandTypes, + documentation: string | unknown[], + tags: unknown[] + }) { + const linkInParamTag: File = { + path: "/a/someFile1.js", content: `class C { } -/** {@link C} */ -var x = 1` +/** @param y - {@link C} */ +function x(y) { } +x(1)` }; - const host = createServerHost([libFile], { useCaseSensitiveFileNames: true }); - const projectService = createProjectService(host); - projectService.setCompilerOptionsForInferredProjects({ - module: ModuleKind.CommonJS, - allowJs: true, - allowSyntheticDefaultImports: true, - allowNonTsExtensions: true - }); - projectService.openClientFile(file.path, `class C { } -/** {@link C} */ -var x = 1`); - const project = projectService.inferredProjects[0]; - const indexOfX = file.content.indexOf("x"); - assert.deepEqual(project.getLanguageService(/*ensureSynchronized*/ true).getQuickInfoAtPosition(file.path, indexOfX), { - kind: ScriptElementKind.variableElement, - kindModifiers: "", - textSpan: { start: indexOfX, length: 1 }, - displayParts: [ - { text: "var", kind: "keyword" }, - { text: " ", kind: "space" }, - { text: "x", kind: "localName" }, - { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }, - { text: "number", kind: "keyword" } - ], + const { command, richResponse, documentation, tags } = options; + const session = createSession(createServerHost([linkInParamTag, config])); + openFilesForSession([linkInParamTag], session); + const indexOfX = linkInParamTag.content.lastIndexOf("1"); + const signatureHelp = session.executeCommandSeq({ + command: command as protocol.CommandTypes.SignatureHelp, + richResponse, + arguments: { + triggerReason: { + kind: "invoked" + }, + file: linkInParamTag.path, + position: indexOfX, + } as protocol.SignatureHelpRequestArgs + }).response; + const applicableSpan = command === protocol.CommandTypes.SignatureHelp ? { + end: { + line: 4, + offset: 4 + }, + start: { + line: 4, + offset: 3 + } + } : { + length: 1, + start: 60 + }; + assert.deepEqual(signatureHelp, { + applicableSpan, + argumentCount: 1, + argumentIndex: 0, + selectedItemIndex: 0, + items: [{ + documentation: [], + isVariadic: false, + parameters: [{ + displayParts: [{ + kind: "parameterName", + text: "y" + }, { + kind: "punctuation", + text: ":" + }, { + kind: "space", + text: " " + }, { + kind: "keyword", + text: "any" + }], + documentation, + isOptional: false, + isRest: false, + name: "y" + }], + prefixDisplayParts: [ + { + kind: "functionName", + text: "x", + }, + { + kind: "punctuation", + text: "(", + }, + ], + separatorDisplayParts: [ + { + kind: "punctuation", + text: ",", + }, + { + kind: "space", + text: " ", + }, + ], + suffixDisplayParts: [ + { + kind: "punctuation", + text: ")", + }, + { + kind: "punctuation", + text: ":", + }, + { + kind: "space", + text: " ", + }, + { + kind: "keyword", + text: "void", + } + ], + tags, + }], + }); + } + it("for signature help, should provide a string for a working link in a comment", () => { + assertSignatureHelpJSDoc({ + command: protocol.CommandTypes.SignatureHelp, + richResponse: false, + tags: [{ + name: "param", + text: "y - {@link C}" + }], documentation: [{ kind: "text", - text: "", + text: "- " }, { kind: "link", - text: "{@link ", + text: "{@link " }, { kind: "linkName", target: { - fileName: "someFile1.js", + file: "/a/someFile1.js", + start: { + line: 1, + offset: 1 + }, + end: { + line: 1, + offset: 12 + } + }, + text: "C" + }, { + kind: "link", + text: "}" + }], + }); + }); + it("for signature help, should provide display parts for a working link in a comment", () => { + const tags = [{ + name: "param", + text: [{ + kind: "text", + text: "y" + }, { + kind: "space", + text: " " + }, { + kind: "text", + text: "- " + }, { + kind: "link", + text: "{@link " + }, { + kind: "linkName", + target: { + file: "/a/someFile1.js", + start: { + line: 1, + offset: 1 + }, + end: { + line: 1, + offset: 12 + } + }, + text: "C" + }, { + kind: "link", + text: "}" + }] + }]; + assertSignatureHelpJSDoc({ + command: protocol.CommandTypes.SignatureHelp, + richResponse: true, + tags, + documentation: tags[0].text.slice(2) + }); + }); + it("for signature help-full, should provide a string for a working link in a comment", () => { + assertSignatureHelpJSDoc({ + command: protocol.CommandTypes.SignatureHelpFull, + richResponse: false, + tags: [{ + name: "param", + text: "y - {@link C}" + }], + documentation: [{ + kind: "text", + text: "- " + }, { + kind: "link", + text: "{@link " + }, { + kind: "linkName", + target: { + fileName: "/a/someFile1.js", textSpan: { length: 11, - start: 0, + start: 0 } }, text: "C" - } as SymbolDisplayPart, { + }, { kind: "link", text: "}" }], - tags: undefined, + }); + }); + it("for signature help-full, should provide display parts for a working link in a comment", () => { + const tags = [{ + name: "param", + text: [{ + kind: "text", + text: "y" + }, { + kind: "space", + text: " " + }, { + kind: "text", + text: "- " + }, { + kind: "link", + text: "{@link " + }, { + kind: "linkName", + target: { + fileName: "/a/someFile1.js", + textSpan: { + length: 11, + start: 0 + } + }, + text: "C" + }, { + kind: "link", + text: "}" + }] + }]; + assertSignatureHelpJSDoc({ + command: protocol.CommandTypes.SignatureHelpFull, + richResponse: true, + tags, + documentation: tags[0].text.slice(2), + }); + }); + + function assertCompletionsJSDoc(options: { + richResponse: boolean, + command: protocol.CommandTypes, + tags: unknown[] + }) { + const linkInParamJSDoc: File = { + path: "/a/someFile1.js", + content: `class C { } +/** @param x - see {@link C} */ +function foo (x) { } +foo` + }; + const { command, richResponse, tags } = options; + const session = createSession(createServerHost([linkInParamJSDoc, config])); + openFilesForSession([linkInParamJSDoc], session); + const indexOfFoo = linkInParamJSDoc.content.lastIndexOf("fo"); + const completions = session.executeCommandSeq({ + command: command as protocol.CommandTypes.CompletionDetails, + richResponse, + arguments: { + entryNames: ["foo"], + file: linkInParamJSDoc.path, + position: indexOfFoo, + } as protocol.CompletionDetailsRequestArgs + }).response; + assert.deepEqual(completions, [{ + codeActions: undefined, + displayParts: [{ + kind: "keyword", + text: "function", + }, { + kind: "space", + text: " ", + }, { + kind: "functionName", + text: "foo", + }, { + kind: "punctuation", + text: "(", + }, { + kind: "parameterName", + text: "x", + }, { + kind: "punctuation", + text: ":", + }, { + kind: "space", + text: " ", + }, { + kind: "keyword", + text: "any", + }, { + kind: "punctuation", + text: ")", + }, { + kind: "punctuation", + text: ":", + }, { + kind: "space", + text: " ", + }, { + kind: "keyword", + text: "void", + }], + documentation: [], + kind: "function", + kindModifiers: "", + name: "foo", + source: undefined, + tags, + }]); + } + it("for completions, should provide display parts for a working link in a comment", () => { + assertCompletionsJSDoc({ + command: protocol.CommandTypes.CompletionDetails, + richResponse: true, + tags: [{ + name: "param", + text: [{ + kind: "text", + text: "x" + }, { + kind: "space", + text: " " + }, { + kind: "text", + text: "- see " + }, { + kind: "link", + text: "{@link " + }, { + kind: "linkName", + target: { + file: "/a/someFile1.js", + end: { + line: 1, + offset: 12, + }, + start: { + line: 1, + offset: 1, + } + }, + text: "C" + }, { + kind: "link", + text: "}" + }], + }], + }); + }); + it("for completions, should provide a string for a working link in a comment", () => { + assertCompletionsJSDoc({ + command: protocol.CommandTypes.CompletionDetails, + richResponse: false, + tags: [{ + name: "param", + text: "x - see {@link C}", + }], + }); + }); + it("for completions-full, should provide display parts for a working link in a comment", () => { + assertCompletionsJSDoc({ + command: protocol.CommandTypes.CompletionDetailsFull, + richResponse: true, + tags: [{ + name: "param", + text: [{ + kind: "text", + text: "x" + }, { + kind: "space", + text: " " + }, { + kind: "text", + text: "- see " + }, { + kind: "link", + text: "{@link " + }, { + kind: "linkName", + target: { + fileName: "/a/someFile1.js", + textSpan: { + length: 11, + start: 0 + } + }, + text: "C" + }, { + kind: "link", + text: "}" + }], + }], + }); + }); + it("for completions-full, should provide a string for a working link in a comment", () => { + assertCompletionsJSDoc({ + command: protocol.CommandTypes.CompletionDetailsFull, + richResponse: false, + tags: [{ + name: "param", + text: "x - see {@link C}", + }], }); }); }); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2441199304627..4009b2e6ca175 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -10166,9 +10166,8 @@ declare namespace ts.server { private getDefinitionAndBoundSpan; private getEmitOutput; private mapJSDocTagInfo; - private mapRichJSDocTagInfo; private mapDisplayParts; - private mapRichSignatureHelpItems; + private mapSignatureHelpItems; private mapDefinitionInfo; private static mapToOriginalLocation; private toFileSpan; diff --git a/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline b/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline index 63e3e900022d8..640c0c7dc1e79 100644 --- a/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline +++ b/tests/baselines/reference/signatureHelpJSDocCallbackTag.baseline @@ -158,15 +158,7 @@ "name": "type", "text": [ { - "text": "{FooHandler}", - "kind": "text" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "callback", + "text": "{FooHandler} callback", "kind": "text" } ] @@ -348,15 +340,7 @@ "name": "type", "text": [ { - "text": "{FooHandler}", - "kind": "text" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "callback", + "text": "{FooHandler} callback", "kind": "text" } ] @@ -538,15 +522,7 @@ "name": "type", "text": [ { - "text": "{FooHandler}", - "kind": "text" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "callback", + "text": "{FooHandler} callback", "kind": "text" } ] diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index b34d99e2f4b3f..f9b111dc31f11 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -745,7 +745,7 @@ declare namespace FourSlashInterface { interface JSDocTagInfo { readonly name: string; - readonly text: ts.SymbolDisplayPart[] | undefined; + readonly text: string | ts.SymbolDisplayPart[] | undefined; } interface GenerateTypesOptions { diff --git a/tests/cases/fourslash/gotoDefinitionLinkTag1.ts b/tests/cases/fourslash/gotoDefinitionLinkTag1.ts index 2e8d55c7a07b7..75cac8d7cd968 100644 --- a/tests/cases/fourslash/gotoDefinitionLinkTag1.ts +++ b/tests/cases/fourslash/gotoDefinitionLinkTag1.ts @@ -25,6 +25,9 @@ //// /** {@link /*use5*/[|d|] }dd*/ //// const e = "" +//// /** @param x {@link /*use6*/[|Foo|]} */ +//// function foo(x) { } + goTo.marker("use1"); verify.goToDefinitionIs("def1"); @@ -38,3 +41,7 @@ goTo.marker("use4"); verify.goToDefinitionIs("def2"); goTo.marker("use5"); +verify.goToDefinitionIs("def3"); + +goTo.marker("use6"); +verify.goToDefinitionIs("def1"); diff --git a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts index 680836f4f7129..6d4324adb8877 100644 --- a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts +++ b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles01.ts @@ -20,10 +20,7 @@ const entry = (text: string): FourSlashInterface.ExpectedCompletionEntry => ({ documentation: "Modify the parameter", tags: [{ name: "param", - text: [{ - "kind": "text", - "text": "p1", - }], + text: "p1", }] }); verify.completions( diff --git a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts index 6c42f76a578de..fb131ce5d7ace 100644 --- a/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts +++ b/tests/cases/fourslash/server/completionEntryDetailAcrossFiles02.ts @@ -19,12 +19,12 @@ verify.completions( name: "foo", text: "var foo: (p1: string) => void", documentation: "Modify the parameter", - tags: [{ name: "param", text: [{ kind: "text", text: "p1" }] }] + tags: [{ name: "param", text: "p1" }] } }, { marker: "2", exact: { name: "foo", text: "(alias) var foo: (p1: string) => void\nimport a.foo", documentation: "Modify the parameter", - tags: [{ name: "param", text: [{ kind: "text", text: "p1" }] }] + tags: [{ name: "param", text: "p1" }] } }, ); diff --git a/tests/cases/fourslash/server/completions02.ts b/tests/cases/fourslash/server/completions02.ts index 80285c3453de2..603d2079d66c1 100644 --- a/tests/cases/fourslash/server/completions02.ts +++ b/tests/cases/fourslash/server/completions02.ts @@ -10,9 +10,9 @@ const sortedFunctionMembers = completion.functionMembersWithPrototype.slice().sort((a, b) => a.name.localeCompare(b.name)); const exact: ReadonlyArray = [ ...sortedFunctionMembers.map(e => - e.name === "arguments" ? { ...e, kind: "property", kindModifiers: "declare", tags: undefined } : + e.name === "arguments" ? { ...e, kind: "property", kindModifiers: "declare", tags: [] } : e.name === "prototype" ? { ...e, kindModifiers: undefined } : e), - { name: "x", text: "var Foo.x: number", tags: undefined }, + { name: "x", text: "var Foo.x: number", tags: [] }, ]; verify.completions({ marker: "", exact }); diff --git a/tests/cases/fourslash/server/completionsImport_defaultAndNamedConflict_server.ts b/tests/cases/fourslash/server/completionsImport_defaultAndNamedConflict_server.ts index 16dd9d7fb1dce..2532b09d2c8fb 100644 --- a/tests/cases/fourslash/server/completionsImport_defaultAndNamedConflict_server.ts +++ b/tests/cases/fourslash/server/completionsImport_defaultAndNamedConflict_server.ts @@ -21,7 +21,8 @@ verify.completions({ kind: "const", kindModifiers: "export", hasAction: true, - sortText: completion.SortText.AutoImportSuggestions + sortText: completion.SortText.AutoImportSuggestions, + tags: [] }, { name: "someModule", @@ -31,7 +32,8 @@ verify.completions({ kind: "property", kindModifiers: "export", hasAction: true, - sortText: completion.SortText.AutoImportSuggestions + sortText: completion.SortText.AutoImportSuggestions, + tags: [] }, ], preferences: { From 5a21851fef728276eeff463c391cc0ec9b188a62 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 8 Mar 2021 12:14:32 -0800 Subject: [PATCH 39/44] Disambiguate {@link} and @param x {type} They are ambiguous; previously the parser preferred the type interpretation, but will now look ahead and parse links instead when the prefix is `{@link`. --- src/compiler/parser.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 74c3662f560a3..1e3c2734a9b38 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7411,7 +7411,7 @@ namespace ts { state = JSDocState.SavingComments; const commentEnd = scanner.getStartPos(); const linkStart = scanner.getTextPos() - 1; - const link = parseLink(linkStart); + const link = parseJSDocLink(linkStart); if (link) { if (!linkEnd) { removeLeadingNewlines(comments); @@ -7646,7 +7646,7 @@ namespace ts { state = JSDocState.SavingComments; const commentEnd = scanner.getStartPos(); const linkStart = scanner.getTextPos() - 1; - const link = parseLink(linkStart); + const link = parseJSDocLink(linkStart); if (link) { parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? commentsPos, commentEnd)); parts.push(link); @@ -7696,8 +7696,8 @@ namespace ts { } } - function parseLink(start: number) { - if (!tryParse(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenValue() === "link")) { + function parseJSDocLink(start: number) { + if (!tryParse(parseJSDocLinkPrefix)) { return undefined; } nextTokenJSDoc(); // start at token after link, then skip any whitespace @@ -7714,6 +7714,14 @@ namespace ts { return finishNode(factory.createJSDocLink(name, text.join("")), start, scanner.getTextPos()); } + function parseJSDocLinkPrefix() { + skipWhitespaceOrAsterisk(); + return token() === SyntaxKind.OpenBraceToken + && nextTokenJSDoc() === SyntaxKind.AtToken + && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) + && scanner.getTokenValue() === "link"; + } + function parseUnknownTag(start: number, tagName: Identifier, indent: number, indentText: string) { return finishNode(factory.createJSDocUnknownTag(tagName, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start); } @@ -7781,7 +7789,7 @@ namespace ts { const { name, isBracketed } = parseBracketNameInPropertyAndParamTag(); const indentText = skipWhitespaceOrAsterisk(); - if (isNameFirst) { + if (isNameFirst && !lookAhead(parseJSDocLinkPrefix)) { typeExpression = tryParseTypeExpression(); } From ab340f458d400b2586f071b29551eaf76bf245ce Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 8 Mar 2021 12:19:54 -0800 Subject: [PATCH 40/44] Add explanatory comment in test --- tests/cases/fourslash/gotoDefinitionLinkTag1.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cases/fourslash/gotoDefinitionLinkTag1.ts b/tests/cases/fourslash/gotoDefinitionLinkTag1.ts index 75cac8d7cd968..c7c634861feff 100644 --- a/tests/cases/fourslash/gotoDefinitionLinkTag1.ts +++ b/tests/cases/fourslash/gotoDefinitionLinkTag1.ts @@ -25,6 +25,7 @@ //// /** {@link /*use5*/[|d|] }dd*/ //// const e = "" +// Without lookahead, ambiguous between suffix type and link tag //// /** @param x {@link /*use6*/[|Foo|]} */ //// function foo(x) { } From 5a29c2ebf6d92c2521eb1405a567878dfe375b5d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 10 Mar 2021 12:10:24 -0800 Subject: [PATCH 41/44] fix location in richResponse in protocol --- src/server/protocol.ts | 12 ++++--- src/server/session.ts | 36 +++++++++---------- src/testRunner/unittests/tsserver/jsdocTag.ts | 8 ++--- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 792e7d7fd1deb..b71766738cc52 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1958,6 +1958,10 @@ namespace ts.server.protocol { */ export interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; + arguments: QuickInfoRequestArgs; + } + + export interface QuickInfoRequestArgs extends FileLocationRequestArgs { /** if true - return response with documentation as display parts instead of string */ richResponse?: boolean; } @@ -2183,6 +2187,8 @@ namespace ts.server.protocol { * Names of one or more entries for which to obtain details. */ entryNames: (string | CompletionEntryIdentifier)[]; + /** if true - return response with documentation as display parts instead of string */ + richResponse?: boolean; } export interface CompletionEntryIdentifier { @@ -2200,8 +2206,6 @@ namespace ts.server.protocol { export interface CompletionDetailsRequest extends FileLocationRequest { command: CommandTypes.CompletionDetails; arguments: CompletionDetailsRequestArgs; - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; } /** @@ -2469,6 +2473,8 @@ namespace ts.server.protocol { * See each individual possible */ triggerReason?: SignatureHelpTriggerReason; + /** if true - return response with documentation as display parts instead of string */ + richResponse?: boolean; } export type SignatureHelpTriggerReason = @@ -2519,8 +2525,6 @@ namespace ts.server.protocol { export interface SignatureHelpRequest extends FileLocationRequest { command: CommandTypes.SignatureHelp; arguments: SignatureHelpRequestArgs; - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; } /** diff --git a/src/server/session.ts b/src/server/session.ts index e615fbfc9148e..3f95002de628b 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1703,7 +1703,7 @@ namespace ts.server { return languageService.isValidBraceCompletionAtPosition(file, position, args.openingBrace.charCodeAt(0)); } - private getQuickInfoWorker(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean, richDocumentation?: boolean): protocol.QuickInfoResponseBody | QuickInfo | undefined { + private getQuickInfoWorker(args: protocol.QuickInfoRequestArgs, simplifiedResult: boolean): protocol.QuickInfoResponseBody | QuickInfo | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo)); @@ -1719,14 +1719,14 @@ namespace ts.server { start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), displayString, - documentation: richDocumentation ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation), - tags: this.mapJSDocTagInfo(quickInfo.tags, project, !!richDocumentation), + documentation: args.richResponse ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation), + tags: this.mapJSDocTagInfo(quickInfo.tags, project, !!args.richResponse), }; } else { - return richDocumentation ? quickInfo : { + return args.richResponse ? quickInfo : { ...quickInfo, - tags: this.mapJSDocTagInfo(quickInfo.tags, project, /*richDocumentation*/ false) as JSDocTagInfo[] + tags: this.mapJSDocTagInfo(quickInfo.tags, project, /*richResponse*/ false) as JSDocTagInfo[] }; } } @@ -1857,7 +1857,7 @@ namespace ts.server { return res; } - private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, fullResult: boolean, richDocumentation?: boolean): readonly protocol.CompletionEntryDetails[] | readonly CompletionEntryDetails[] { + private getCompletionEntryDetails(args: protocol.CompletionDetailsRequestArgs, fullResult: boolean): readonly protocol.CompletionEntryDetails[] | readonly CompletionEntryDetails[] { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); @@ -1868,12 +1868,12 @@ namespace ts.server { return project.getLanguageService().getCompletionEntryDetails(file, position, name, formattingOptions, source, this.getPreferences(file), data ? cast(data, isCompletionEntryData) : undefined); }); return fullResult - ? (richDocumentation ? result : result.map(details => ({ ...details, tags: this.mapJSDocTagInfo(details.tags, project, /*richDocumentation*/ false) as JSDocTagInfo[] }))) + ? (args.richResponse ? result : result.map(details => ({ ...details, tags: this.mapJSDocTagInfo(details.tags, project, /*richResponse*/ false) as JSDocTagInfo[] }))) : result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)), documentation: this.mapDisplayParts(details.documentation, project), - tags: this.mapJSDocTagInfo(details.tags, project, !!richDocumentation), + tags: this.mapJSDocTagInfo(details.tags, project, !!args.richResponse), })); } @@ -1929,7 +1929,7 @@ namespace ts.server { !emitSkipped; } - private getSignatureHelpItems(args: protocol.SignatureHelpRequestArgs, simplifiedResult: boolean, richDocumentation?: boolean): protocol.SignatureHelpItems | SignatureHelpItems | undefined { + private getSignatureHelpItems(args: protocol.SignatureHelpRequestArgs, simplifiedResult: boolean): protocol.SignatureHelpItems | SignatureHelpItems | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); @@ -1942,16 +1942,16 @@ namespace ts.server { start: scriptInfo.positionToLineOffset(span.start), end: scriptInfo.positionToLineOffset(span.start + span.length) }, - items: this.mapSignatureHelpItems(helpItems.items, project, !!richDocumentation), + items: this.mapSignatureHelpItems(helpItems.items, project, !!args.richResponse), }; } - else if (richDocumentation || !helpItems) { + else if (args.richResponse || !helpItems) { return helpItems; } else { return { ...helpItems, - items: helpItems.items.map(item => ({ ...item, tags: this.mapJSDocTagInfo(item.tags, project, /*richDocumentation*/ false) as JSDocTagInfo[] })) + items: helpItems.items.map(item => ({ ...item, tags: this.mapJSDocTagInfo(item.tags, project, /*richResponse*/ false) as JSDocTagInfo[] })) }; } } @@ -2669,10 +2669,10 @@ namespace ts.server { return this.notRequired(); }, [CommandNames.Quickinfo]: (request: protocol.QuickInfoRequest) => { - return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ true, request.richResponse)); + return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ true)); }, [CommandNames.QuickinfoFull]: (request: protocol.QuickInfoRequest) => { - return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ false, request.richResponse)); + return this.requiredResponse(this.getQuickInfoWorker(request.arguments, /*simplifiedResult*/ false)); }, [CommandNames.GetOutliningSpans]: (request: protocol.FileRequest) => { return this.requiredResponse(this.getOutliningSpans(request.arguments, /*simplifiedResult*/ true)); @@ -2732,10 +2732,10 @@ namespace ts.server { return this.requiredResponse(this.getCompletions(request.arguments, CommandNames.CompletionsFull)); }, [CommandNames.CompletionDetails]: (request: protocol.CompletionDetailsRequest) => { - return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ false, request.richResponse)); + return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ false)); }, [CommandNames.CompletionDetailsFull]: (request: protocol.CompletionDetailsRequest) => { - return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ true, request.richResponse)); + return this.requiredResponse(this.getCompletionEntryDetails(request.arguments, /*fullResult*/ true)); }, [CommandNames.CompileOnSaveAffectedFileList]: (request: protocol.CompileOnSaveAffectedFileListRequest) => { return this.requiredResponse(this.getCompileOnSaveAffectedFileList(request.arguments)); @@ -2744,10 +2744,10 @@ namespace ts.server { return this.requiredResponse(this.emitFile(request.arguments)); }, [CommandNames.SignatureHelp]: (request: protocol.SignatureHelpRequest) => { - return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ true, request.richResponse)); + return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ true)); }, [CommandNames.SignatureHelpFull]: (request: protocol.SignatureHelpRequest) => { - return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ false, request.richResponse)); + return this.requiredResponse(this.getSignatureHelpItems(request.arguments, /*simplifiedResult*/ false)); }, [CommandNames.CompilerOptionsDiagnosticsFull]: (request: protocol.CompilerOptionsDiagnosticsRequest) => { return this.requiredResponse(this.getCompilerOptionsDiagnostics(request.arguments)); diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 03e0218d53771..4ade19249cc03 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -24,11 +24,11 @@ namespace ts.projectSystem { const indexOfX = file.content.indexOf("x"); const quickInfo = session.executeCommandSeq({ command: command as protocol.CommandTypes.Quickinfo, - richResponse, arguments: { file: file.path, position: indexOfX, - } as protocol.FileLocationRequestArgs + richResponse, + } as protocol.QuickInfoRequestArgs }).response; const summaryAndLocation = command === protocol.CommandTypes.Quickinfo ? { displayString: "var x: number", @@ -289,13 +289,13 @@ x(1)` const indexOfX = linkInParamTag.content.lastIndexOf("1"); const signatureHelp = session.executeCommandSeq({ command: command as protocol.CommandTypes.SignatureHelp, - richResponse, arguments: { triggerReason: { kind: "invoked" }, file: linkInParamTag.path, position: indexOfX, + richResponse, } as protocol.SignatureHelpRequestArgs }).response; const applicableSpan = command === protocol.CommandTypes.SignatureHelp ? { @@ -541,11 +541,11 @@ foo` const indexOfFoo = linkInParamJSDoc.content.lastIndexOf("fo"); const completions = session.executeCommandSeq({ command: command as protocol.CommandTypes.CompletionDetails, - richResponse, arguments: { entryNames: ["foo"], file: linkInParamJSDoc.path, position: indexOfFoo, + richResponse, } as protocol.CompletionDetailsRequestArgs }).response; assert.deepEqual(completions, [{ From 67c4966365958c3d2e6d73b5c36012181962f727 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 10 Mar 2021 12:14:32 -0800 Subject: [PATCH 42/44] update API baseline --- tests/baselines/reference/api/tsserverlibrary.d.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 209717a5a75ab..53c85e23df667 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -8053,6 +8053,9 @@ declare namespace ts.server.protocol { */ interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; + arguments: QuickInfoRequestArgs; + } + interface QuickInfoRequestArgs extends FileLocationRequestArgs { /** if true - return response with documentation as display parts instead of string */ richResponse?: boolean; } @@ -8245,6 +8248,8 @@ declare namespace ts.server.protocol { * Names of one or more entries for which to obtain details. */ entryNames: (string | CompletionEntryIdentifier)[]; + /** if true - return response with documentation as display parts instead of string */ + richResponse?: boolean; } interface CompletionEntryIdentifier { name: string; @@ -8260,8 +8265,6 @@ declare namespace ts.server.protocol { interface CompletionDetailsRequest extends FileLocationRequest { command: CommandTypes.CompletionDetails; arguments: CompletionDetailsRequestArgs; - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; } /** * Part of a symbol description. @@ -8495,6 +8498,8 @@ declare namespace ts.server.protocol { * See each individual possible */ triggerReason?: SignatureHelpTriggerReason; + /** if true - return response with documentation as display parts instead of string */ + richResponse?: boolean; } type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason; /** @@ -8537,8 +8542,6 @@ declare namespace ts.server.protocol { interface SignatureHelpRequest extends FileLocationRequest { command: CommandTypes.SignatureHelp; arguments: SignatureHelpRequestArgs; - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; } /** * Response object for a SignatureHelpRequest. From d0f30486e8af14b8cd3b30df4d6afd080e5b91ab Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 16 Mar 2021 11:13:51 -0700 Subject: [PATCH 43/44] Address PR comments 1. Add a cross-file goto-def test. 2. Switch from per-message args to UserPreference. --- src/server/protocol.ts | 18 +++---- src/server/session.ts | 21 ++++---- src/services/codefixes/inferFromUsage.ts | 2 - src/testRunner/unittests/tsserver/jsdocTag.ts | 52 +++++++++---------- .../reference/api/tsserverlibrary.d.ts | 17 +++--- .../cases/fourslash/gotoDefinitionLinkTag1.ts | 8 +++ 6 files changed, 60 insertions(+), 58 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 1f5016f9e6a58..dc29f341ae30f 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -982,7 +982,10 @@ namespace ts.server.protocol { export interface JSDocTagInfo { /** Name of the JSDoc tag */ name: string; - /** Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ + /** + * Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment + * Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise. + */ text?: string | SymbolDisplayPart[]; } @@ -1958,12 +1961,7 @@ namespace ts.server.protocol { */ export interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; - arguments: QuickInfoRequestArgs; - } - - export interface QuickInfoRequestArgs extends FileLocationRequestArgs { - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; + arguments: FileLocationRequestArgs; } /** @@ -1997,6 +1995,7 @@ namespace ts.server.protocol { /** * Documentation associated with symbol. + * Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise. */ documentation: string | SymbolDisplayPart[]; @@ -2187,8 +2186,6 @@ namespace ts.server.protocol { * Names of one or more entries for which to obtain details. */ entryNames: (string | CompletionEntryIdentifier)[]; - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; } export interface CompletionEntryIdentifier { @@ -2473,8 +2470,6 @@ namespace ts.server.protocol { * See each individual possible */ triggerReason?: SignatureHelpTriggerReason; - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; } export type SignatureHelpTriggerReason = @@ -3324,6 +3319,7 @@ namespace ts.server.protocol { readonly allowRenameOfImportPath?: boolean; readonly includePackageJsonAutoImports?: "auto" | "on" | "off"; + readonly displayPartsForJSDoc?: boolean; readonly generateReturnInDocTemplate?: boolean; } diff --git a/src/server/session.ts b/src/server/session.ts index 3f95002de628b..78b9361112658 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1703,7 +1703,7 @@ namespace ts.server { return languageService.isValidBraceCompletionAtPosition(file, position, args.openingBrace.charCodeAt(0)); } - private getQuickInfoWorker(args: protocol.QuickInfoRequestArgs, simplifiedResult: boolean): protocol.QuickInfoResponseBody | QuickInfo | undefined { + private getQuickInfoWorker(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.QuickInfoResponseBody | QuickInfo | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo)); @@ -1711,6 +1711,7 @@ namespace ts.server { return undefined; } + const useDisplayParts = !!this.getPreferences(file).displayPartsForJSDoc; if (simplifiedResult) { const displayString = displayPartsToString(quickInfo.displayParts); return { @@ -1719,14 +1720,14 @@ namespace ts.server { start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), displayString, - documentation: args.richResponse ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation), - tags: this.mapJSDocTagInfo(quickInfo.tags, project, !!args.richResponse), + documentation: useDisplayParts ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation), + tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts), }; } else { - return args.richResponse ? quickInfo : { + return useDisplayParts ? quickInfo : { ...quickInfo, - tags: this.mapJSDocTagInfo(quickInfo.tags, project, /*richResponse*/ false) as JSDocTagInfo[] + tags: this.mapJSDocTagInfo(quickInfo.tags, project, /*useDisplayParts*/ false) as JSDocTagInfo[] }; } } @@ -1862,18 +1863,19 @@ namespace ts.server { const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); const formattingOptions = project.projectService.getFormatCodeOptions(file); + const useDisplayParts = !!this.getPreferences(file).displayPartsForJSDoc; const result = mapDefined(args.entryNames, entryName => { const { name, source, data } = typeof entryName === "string" ? { name: entryName, source: undefined, data: undefined } : entryName; return project.getLanguageService().getCompletionEntryDetails(file, position, name, formattingOptions, source, this.getPreferences(file), data ? cast(data, isCompletionEntryData) : undefined); }); return fullResult - ? (args.richResponse ? result : result.map(details => ({ ...details, tags: this.mapJSDocTagInfo(details.tags, project, /*richResponse*/ false) as JSDocTagInfo[] }))) + ? (useDisplayParts ? result : result.map(details => ({ ...details, tags: this.mapJSDocTagInfo(details.tags, project, /*richResponse*/ false) as JSDocTagInfo[] }))) : result.map(details => ({ ...details, codeActions: map(details.codeActions, action => this.mapCodeAction(action)), documentation: this.mapDisplayParts(details.documentation, project), - tags: this.mapJSDocTagInfo(details.tags, project, !!args.richResponse), + tags: this.mapJSDocTagInfo(details.tags, project, useDisplayParts), })); } @@ -1934,6 +1936,7 @@ namespace ts.server { const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; const position = this.getPosition(args, scriptInfo); const helpItems = project.getLanguageService().getSignatureHelpItems(file, position, args); + const useDisplayParts = !!this.getPreferences(file).displayPartsForJSDoc; if (helpItems && simplifiedResult) { const span = helpItems.applicableSpan; return { @@ -1942,10 +1945,10 @@ namespace ts.server { start: scriptInfo.positionToLineOffset(span.start), end: scriptInfo.positionToLineOffset(span.start + span.length) }, - items: this.mapSignatureHelpItems(helpItems.items, project, !!args.richResponse), + items: this.mapSignatureHelpItems(helpItems.items, project, useDisplayParts), }; } - else if (args.richResponse || !helpItems) { + else if (useDisplayParts || !helpItems) { return helpItems; } else { diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index b35acc12dad1a..4fa07f8d836e8 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -282,8 +282,6 @@ namespace ts.codefix { program: Program, host: LanguageServiceHost, cancellationToken: CancellationToken, - - ): void { const param = firstOrUndefined(setAccessorDeclaration.parameters); if (param && isIdentifier(setAccessorDeclaration.name) && isIdentifier(param.name)) { diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 4ade19249cc03..5033a4fca7fe9 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -12,14 +12,15 @@ namespace ts.projectSystem { ` }; function assertQuickInfoJSDoc(file: File, options: { - richResponse: boolean, + displayPartsForJSDoc: boolean, command: protocol.CommandTypes, tags: string | unknown[] | undefined, documentation: string | unknown[] }) { - const { command, richResponse, tags, documentation } = options; + const { command, displayPartsForJSDoc, tags, documentation } = options; const session = createSession(createServerHost([file, config])); + session.getProjectService().setHostConfiguration({ preferences: { displayPartsForJSDoc } }); openFilesForSession([file], session); const indexOfX = file.content.indexOf("x"); const quickInfo = session.executeCommandSeq({ @@ -27,8 +28,7 @@ namespace ts.projectSystem { arguments: { file: file.path, position: indexOfX, - richResponse, - } as protocol.QuickInfoRequestArgs + } as protocol.FileLocationRequestArgs }).response; const summaryAndLocation = command === protocol.CommandTypes.Quickinfo ? { displayString: "var x: number", @@ -91,7 +91,7 @@ var x = 1 it("for quickinfo, should provide display parts plus a span for a working link in a tag", () => { assertQuickInfoJSDoc(linkInTag, { command: protocol.CommandTypes.Quickinfo, - richResponse: true, + displayPartsForJSDoc: true, documentation: [], tags: [{ name: "wat", @@ -125,7 +125,7 @@ var x = 1 it("for quickinfo, should provide a string for a working link in a tag", () => { assertQuickInfoJSDoc(linkInTag, { command: protocol.CommandTypes.Quickinfo, - richResponse: false, + displayPartsForJSDoc: false, documentation: "", tags: [{ name: "wat", @@ -136,7 +136,7 @@ var x = 1 it("for quickinfo, should provide display parts for a working link in a comment", () => { assertQuickInfoJSDoc(linkInComment, { command: protocol.CommandTypes.Quickinfo, - richResponse: true, + displayPartsForJSDoc: true, documentation: [{ kind: "text", text: "", @@ -167,7 +167,7 @@ var x = 1 it("for quickinfo, should provide a string for a working link in a comment", () => { assertQuickInfoJSDoc(linkInComment, { command: protocol.CommandTypes.Quickinfo, - richResponse: false, + displayPartsForJSDoc: false, documentation: "{@link C}", tags: [], }); @@ -176,7 +176,7 @@ var x = 1 it("for quickinfo-full, should provide display parts plus a span for a working link in a tag", () => { assertQuickInfoJSDoc(linkInTag, { command: protocol.CommandTypes.QuickinfoFull, - richResponse: true, + displayPartsForJSDoc: true, documentation: [], tags: [{ name: "wat", @@ -206,7 +206,7 @@ var x = 1 it("for quickinfo-full, should provide a string for a working link in a tag", () => { assertQuickInfoJSDoc(linkInTag, { command: protocol.CommandTypes.QuickinfoFull, - richResponse: false, + displayPartsForJSDoc: false, documentation: [], tags: [{ name: "wat", @@ -217,7 +217,7 @@ var x = 1 it("for quickinfo-full, should provide display parts plus a span for a working link in a comment", () => { assertQuickInfoJSDoc(linkInComment, { command: protocol.CommandTypes.QuickinfoFull, - richResponse: true, + displayPartsForJSDoc: true, documentation: [{ kind: "text", text: "", @@ -244,7 +244,7 @@ var x = 1 it("for quickinfo-full, should provide a string for a working link in a comment", () => { assertQuickInfoJSDoc(linkInComment, { command: protocol.CommandTypes.QuickinfoFull, - richResponse: false, + displayPartsForJSDoc: false, documentation: [{ kind: "text", text: "", @@ -270,7 +270,7 @@ var x = 1 }); function assertSignatureHelpJSDoc(options: { - richResponse: boolean, + displayPartsForJSDoc: boolean, command: protocol.CommandTypes, documentation: string | unknown[], tags: unknown[] @@ -283,8 +283,9 @@ function x(y) { } x(1)` }; - const { command, richResponse, documentation, tags } = options; + const { command, displayPartsForJSDoc, documentation, tags } = options; const session = createSession(createServerHost([linkInParamTag, config])); + session.getProjectService().setHostConfiguration({ preferences: { displayPartsForJSDoc } }); openFilesForSession([linkInParamTag], session); const indexOfX = linkInParamTag.content.lastIndexOf("1"); const signatureHelp = session.executeCommandSeq({ @@ -295,7 +296,6 @@ x(1)` }, file: linkInParamTag.path, position: indexOfX, - richResponse, } as protocol.SignatureHelpRequestArgs }).response; const applicableSpan = command === protocol.CommandTypes.SignatureHelp ? { @@ -383,7 +383,7 @@ x(1)` it("for signature help, should provide a string for a working link in a comment", () => { assertSignatureHelpJSDoc({ command: protocol.CommandTypes.SignatureHelp, - richResponse: false, + displayPartsForJSDoc: false, tags: [{ name: "param", text: "y - {@link C}" @@ -450,7 +450,7 @@ x(1)` }]; assertSignatureHelpJSDoc({ command: protocol.CommandTypes.SignatureHelp, - richResponse: true, + displayPartsForJSDoc: true, tags, documentation: tags[0].text.slice(2) }); @@ -458,7 +458,7 @@ x(1)` it("for signature help-full, should provide a string for a working link in a comment", () => { assertSignatureHelpJSDoc({ command: protocol.CommandTypes.SignatureHelpFull, - richResponse: false, + displayPartsForJSDoc: false, tags: [{ name: "param", text: "y - {@link C}" @@ -517,14 +517,14 @@ x(1)` }]; assertSignatureHelpJSDoc({ command: protocol.CommandTypes.SignatureHelpFull, - richResponse: true, + displayPartsForJSDoc: true, tags, documentation: tags[0].text.slice(2), }); }); function assertCompletionsJSDoc(options: { - richResponse: boolean, + displayPartsForJSDoc: boolean, command: protocol.CommandTypes, tags: unknown[] }) { @@ -535,8 +535,9 @@ x(1)` function foo (x) { } foo` }; - const { command, richResponse, tags } = options; + const { command, displayPartsForJSDoc, tags } = options; const session = createSession(createServerHost([linkInParamJSDoc, config])); + session.getProjectService().setHostConfiguration({ preferences: { displayPartsForJSDoc } }); openFilesForSession([linkInParamJSDoc], session); const indexOfFoo = linkInParamJSDoc.content.lastIndexOf("fo"); const completions = session.executeCommandSeq({ @@ -545,7 +546,6 @@ foo` entryNames: ["foo"], file: linkInParamJSDoc.path, position: indexOfFoo, - richResponse, } as protocol.CompletionDetailsRequestArgs }).response; assert.deepEqual(completions, [{ @@ -598,7 +598,7 @@ foo` it("for completions, should provide display parts for a working link in a comment", () => { assertCompletionsJSDoc({ command: protocol.CommandTypes.CompletionDetails, - richResponse: true, + displayPartsForJSDoc: true, tags: [{ name: "param", text: [{ @@ -637,7 +637,7 @@ foo` it("for completions, should provide a string for a working link in a comment", () => { assertCompletionsJSDoc({ command: protocol.CommandTypes.CompletionDetails, - richResponse: false, + displayPartsForJSDoc: false, tags: [{ name: "param", text: "x - see {@link C}", @@ -647,7 +647,7 @@ foo` it("for completions-full, should provide display parts for a working link in a comment", () => { assertCompletionsJSDoc({ command: protocol.CommandTypes.CompletionDetailsFull, - richResponse: true, + displayPartsForJSDoc: true, tags: [{ name: "param", text: [{ @@ -682,7 +682,7 @@ foo` it("for completions-full, should provide a string for a working link in a comment", () => { assertCompletionsJSDoc({ command: protocol.CommandTypes.CompletionDetailsFull, - richResponse: false, + displayPartsForJSDoc: false, tags: [{ name: "param", text: "x - see {@link C}", diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 73d277bb8f927..7fb3cc161c54c 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -7335,7 +7335,10 @@ declare namespace ts.server.protocol { interface JSDocTagInfo { /** Name of the JSDoc tag */ name: string; - /** Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment */ + /** + * Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment + * Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise. + */ text?: string | SymbolDisplayPart[]; } interface TextSpanWithContext extends TextSpan { @@ -8058,11 +8061,7 @@ declare namespace ts.server.protocol { */ interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; - arguments: QuickInfoRequestArgs; - } - interface QuickInfoRequestArgs extends FileLocationRequestArgs { - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; + arguments: FileLocationRequestArgs; } /** * Body of QuickInfoResponse. @@ -8090,6 +8089,7 @@ declare namespace ts.server.protocol { displayString: string; /** * Documentation associated with symbol. + * Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise. */ documentation: string | SymbolDisplayPart[]; /** @@ -8253,8 +8253,6 @@ declare namespace ts.server.protocol { * Names of one or more entries for which to obtain details. */ entryNames: (string | CompletionEntryIdentifier)[]; - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; } interface CompletionEntryIdentifier { name: string; @@ -8503,8 +8501,6 @@ declare namespace ts.server.protocol { * See each individual possible */ triggerReason?: SignatureHelpTriggerReason; - /** if true - return response with documentation as display parts instead of string */ - richResponse?: boolean; } type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason; /** @@ -9212,6 +9208,7 @@ declare namespace ts.server.protocol { readonly provideRefactorNotApplicableReason?: boolean; readonly allowRenameOfImportPath?: boolean; readonly includePackageJsonAutoImports?: "auto" | "on" | "off"; + readonly displayPartsForJSDoc?: boolean; readonly generateReturnInDocTemplate?: boolean; } interface CompilerOptions { diff --git a/tests/cases/fourslash/gotoDefinitionLinkTag1.ts b/tests/cases/fourslash/gotoDefinitionLinkTag1.ts index c7c634861feff..26033e7260753 100644 --- a/tests/cases/fourslash/gotoDefinitionLinkTag1.ts +++ b/tests/cases/fourslash/gotoDefinitionLinkTag1.ts @@ -1,5 +1,6 @@ /// +// @Filename: foo.ts //// interface [|/*def1*/Foo|] { //// foo: string //// } @@ -29,6 +30,10 @@ //// /** @param x {@link /*use6*/[|Foo|]} */ //// function foo(x) { } +// @Filename: bar.ts +//// /** {@link /*use7*/[|Foo|] }dd*/ +//// const f = "" + goTo.marker("use1"); verify.goToDefinitionIs("def1"); @@ -46,3 +51,6 @@ verify.goToDefinitionIs("def3"); goTo.marker("use6"); verify.goToDefinitionIs("def1"); + +goTo.marker("use7"); +verify.goToDefinitionIs("def1"); From 4cfdaee97195451f0a1947da5ec05f5df19f6aa8 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 16 Mar 2021 11:19:49 -0700 Subject: [PATCH 44/44] use arraysEqual from core --- src/services/jsDoc.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index d387664a4df8e..01de5d060d9b3 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -103,15 +103,7 @@ namespace ts.JsDoc { } function isIdenticalListOfDisplayParts(parts1: SymbolDisplayPart[], parts2: SymbolDisplayPart[]) { - if (parts1.length !== parts2.length) { - return false; - } - for (let i = 0; i < parts1.length; i++) { - if (parts1[i].kind !== parts2[i].kind || parts1[i].text !== parts2[i].text) { - return false; - } - } - return true; + return arraysEqual(parts1, parts2, (p1, p2) => p1.kind === p2.kind && p1.text === p2.text); } function getCommentHavingNodes(declaration: Declaration): readonly (JSDoc | JSDocTag)[] {