Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2201,13 +2201,13 @@ namespace ts {
let result: (JSDoc | JSDocTag)[] | undefined;
// Pull parameter comments from declaring function as well
if (isVariableLike(hostNode) && hasInitializer(hostNode) && hasJSDocNodes(hostNode.initializer!)) {
result = addRange(result, (hostNode.initializer as HasJSDoc).jsDoc!);
result = append(result, last((hostNode.initializer as HasJSDoc).jsDoc!));
}

let node: Node | undefined = hostNode;
while (node && node.parent) {
if (hasJSDocNodes(node)) {
result = addRange(result, node.jsDoc!);
result = append(result, last(node.jsDoc!));
}

if (node.kind === SyntaxKind.Parameter) {
Expand Down
4 changes: 0 additions & 4 deletions tests/baselines/reference/syntaxErrors.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ function f(x, y, skipped) {
>skipped : Symbol(skipped, Decl(badTypeArguments.js, 4, 16))

return x.t + y.t;
>x.t : Symbol(C.t, Decl(dummyType.d.ts, 0, 20))
>x : Symbol(x, Decl(badTypeArguments.js, 4, 11))
>t : Symbol(C.t, Decl(dummyType.d.ts, 0, 20))
>y.t : Symbol(C.t, Decl(dummyType.d.ts, 0, 20))
>y : Symbol(y, Decl(badTypeArguments.js, 4, 13))
>t : Symbol(C.t, Decl(dummyType.d.ts, 0, 20))
}
var x = f({ t: 1000 }, { t: 3000 }, { t: 5000 });
>x : Symbol(x, Decl(badTypeArguments.js, 7, 3))
Expand Down
16 changes: 8 additions & 8 deletions tests/baselines/reference/syntaxErrors.types
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ declare class C<T> { t: T }
// @ts-ignore
/** @param {C.<number,>} skipped */
function f(x, y, skipped) {
>f : (x: C<any>, y: C<number>, skipped: C<number>) => any
>x : C<any>
>y : C<number>
>f : (x: any, y: any, skipped: C<number>) => any
>x : any
>y : any
>skipped : C<number>

return x.t + y.t;
>x.t + y.t : any
>x.t : any
>x : C<any>
>x : any
>t : any
>y.t : any
>y : any
>t : any
>y.t : number
>y : C<number>
>t : number
}
var x = f({ t: 1000 }, { t: 3000 }, { t: 5000 });
>x : any
>f({ t: 1000 }, { t: 3000 }, { t: 5000 }) : any
>f : (x: C<any>, y: C<number>, skipped: C<number>) => any
>f : (x: any, y: any, skipped: C<number>) => any
>{ t: 1000 } : { t: number; }
>t : number
>1000 : 1000
Expand Down
40 changes: 20 additions & 20 deletions tests/cases/fourslash/commentsCommentParsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
////}
////jsDocM/*4q*/ultiLine(/*4*/);
////
/////** this is multiple line jsdoc stule comment
/////** multiple line jsdoc comments no longer merge
////*New line1
////*New Line2*/
/////** Shoul mege this line as well
Expand Down Expand Up @@ -99,13 +99,13 @@
//// return /*18*/a + b;
////}
/////*15*/s/*16q*/um(/*16*/10, /*17*/20);
/////** This is multiplication function*/
/////** @param */
/////** @param a first number*/
/////** @param b */
/////** @param c {
//// @param d @anotherTag*/
/////** @param e LastParam @anotherTag*/
/////** This is multiplication function
//// * @param
//// * @param a first number
//// * @param b
//// * @param c {
//// @param d @anotherTag
//// * @param e LastParam @anotherTag*/
////function multiply(/*19aq*/a: number, /*20aq*/b: number, /*21aq*/c?: number, /*22aq*/d?, /*23aq*/e?) {
////}
////mult/*19q*/iply(/*19*/10,/*20*/ 20,/*21*/ 30, /*22*/40, /*23*/50);
Expand Down Expand Up @@ -214,26 +214,26 @@ verify.quickInfoAt("3q", "function jsDocSingleLine(): void", "this is eg of sing
verify.signatureHelp({ marker: "4", docComment: "this is multiple line jsdoc stule comment\nNew line1\nNew Line2" });
verify.quickInfoAt("4q", "function jsDocMultiLine(): void", "this is multiple line jsdoc stule comment\nNew line1\nNew Line2");

verify.signatureHelp({ marker: "5", docComment: "this is multiple line jsdoc stule comment\nNew line1\nNew Line2\nShoul mege this line as well\nand this too\nAnother this one too" });
verify.quickInfoAt("5q", "function jsDocMultiLineMerge(): void", "this is multiple line jsdoc stule comment\nNew line1\nNew Line2\nShoul mege this line as well\nand this too\nAnother this one too");
verify.signatureHelp({ marker: "5", docComment: "Another this one too" });
verify.quickInfoAt("5q", "function jsDocMultiLineMerge(): void", "Another this one too");

verify.signatureHelp({ marker: "6", docComment: "jsdoc comment" });
verify.quickInfoAt("6q", "function jsDocMixedComments1(): void", "jsdoc comment");

verify.signatureHelp({ marker: "7", docComment: "jsdoc comment\nanother jsDocComment" });
verify.quickInfoAt("7q", "function jsDocMixedComments2(): void", "jsdoc comment\nanother jsDocComment");
verify.signatureHelp({ marker: "7", docComment: "another jsDocComment" });
verify.quickInfoAt("7q", "function jsDocMixedComments2(): void", "another jsDocComment");

verify.signatureHelp({ marker: "8", docComment: "jsdoc comment\n* triplestar jsDocComment" });
verify.quickInfoAt("8q", "function jsDocMixedComments3(): void", "jsdoc comment\n* triplestar jsDocComment");
verify.signatureHelp({ marker: "8", docComment: "* triplestar jsDocComment" });
verify.quickInfoAt("8q", "function jsDocMixedComments3(): void", "* triplestar jsDocComment");

verify.signatureHelp({ marker: "9", docComment: "jsdoc comment\nanother jsDocComment" });
verify.quickInfoAt("9q", "function jsDocMixedComments4(): void", "jsdoc comment\nanother jsDocComment");
verify.signatureHelp({ marker: "9", docComment: "another jsDocComment" });
verify.quickInfoAt("9q", "function jsDocMixedComments4(): void", "another jsDocComment");

verify.signatureHelp({ marker: "10", docComment: "jsdoc comment\nanother jsDocComment" });
verify.quickInfoAt("10q", "function jsDocMixedComments5(): void", "jsdoc comment\nanother jsDocComment");
verify.signatureHelp({ marker: "10", docComment: "another jsDocComment" });
verify.quickInfoAt("10q", "function jsDocMixedComments5(): void", "another jsDocComment");

verify.signatureHelp({ marker: "11", docComment: "another jsDocComment\njsdoc comment" });
verify.quickInfoAt("11q", "function jsDocMixedComments6(): void", "another jsDocComment\njsdoc comment");
verify.signatureHelp({ marker: "11", docComment: "jsdoc comment" });
verify.quickInfoAt("11q", "function jsDocMixedComments6(): void", "jsdoc comment");

verify.signatureHelp({ marker: "12", docComment: "" });
verify.quickInfoAt("12q", "function noHelpComment1(): void");
Expand Down
9 changes: 3 additions & 6 deletions tests/cases/fourslash/server/jsdocCallbackTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,15 @@ verify.signatureHelp({
marker: '4',
text: "t(eventName: string, eventName2: string | number, eventName3: any): number",
parameterDocComment: "- So many words",
tags: [{ name: "callback", text: "FooHandler - A kind of magic" },
{ name: "type", text: "{FooHandler} callback" }]
tags: [{ name: "type", text: "{FooHandler} callback" }]
});
verify.signatureHelp({
marker: '5',
parameterDocComment: "- Silence is golden",
tags: [{ name: "callback", text: "FooHandler - A kind of magic" },
{ name: "type", text: "{FooHandler} callback" }]
tags: [{ name: "type", text: "{FooHandler} callback" }]
});
verify.signatureHelp({
marker: '6',
parameterDocComment: "- Osterreich mos def",
tags: [{ name: "callback", text: "FooHandler - A kind of magic" },
{ name: "type", text: "{FooHandler} callback" }]
tags: [{ name: "type", text: "{FooHandler} callback" }]
});