From 627d866500a77cb15a144704ef29a689732380ce Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 17 Nov 2025 07:05:49 -0800 Subject: [PATCH 1/5] Display inherited JSDoc documentation in quick info --- internal/checker/exports.go | 4 ++ internal/ls/hover.go | 87 ++++++++++++++++++++++--------------- 2 files changed, 57 insertions(+), 34 deletions(-) diff --git a/internal/checker/exports.go b/internal/checker/exports.go index da6d28979a..332a72569e 100644 --- a/internal/checker/exports.go +++ b/internal/checker/exports.go @@ -182,3 +182,7 @@ func (c *Checker) ResolveName(name string, location *ast.Node, meaning ast.Symbo func (c *Checker) GetSymbolFlags(symbol *ast.Symbol) ast.SymbolFlags { return c.getSymbolFlags(symbol) } + +func (c *Checker) GetBaseTypes(t *Type) []*Type { + return c.getBaseTypes(t) +} diff --git a/internal/ls/hover.go b/internal/ls/hover.go index d8bd1862a2..e5e002d539 100644 --- a/internal/ls/hover.go +++ b/internal/ls/hover.go @@ -72,7 +72,7 @@ func (l *LanguageService) getDocumentationFromDeclaration(c *checker.Checker, de } isMarkdown := contentFormat == lsproto.MarkupKindMarkdown var b strings.Builder - if jsdoc := getJSDocOrTag(declaration); jsdoc != nil && !containsTypedefTag(jsdoc) { + if jsdoc := getJSDocOrTag(c, declaration); jsdoc != nil && !containsTypedefTag(jsdoc) { l.writeComments(&b, c, jsdoc.Comments(), isMarkdown) if jsdoc.Kind == ast.KindJSDoc { if tags := jsdoc.AsJSDoc().Tags; tags != nil { @@ -143,14 +143,6 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol return "", nil } declaration := symbol.ValueDeclaration - if symbol.Flags&ast.SymbolFlagsClass != 0 && inConstructorContext(node) { - if s := symbol.Members[ast.InternalSymbolNameConstructor]; s != nil { - symbol = s - declaration = core.Find(symbol.Declarations, func(d *ast.Node) bool { - return ast.IsConstructorDeclaration(d) || ast.IsConstructSignatureDeclaration(d) - }) - } - } flags := symbol.Flags if flags&ast.SymbolFlagsProperty != 0 && declaration != nil && ast.IsMethodDeclaration(declaration) { flags = ast.SymbolFlagsMethod @@ -209,30 +201,43 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol b.WriteString(t.AsLiteralType().String()) } case flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsMethod) != 0: - signatures := getSignaturesAtLocation(c, symbol, checker.SignatureKindCall, node) - if len(signatures) == 1 { - if d := signatures[0].Declaration(); d != nil && d.Flags&ast.NodeFlagsJSDoc == 0 { - declaration = d - } - } prefix := core.IfElse(flags&ast.SymbolFlagsMethod != 0, "(method) ", "function ") - writeSignatures(&b, c, signatures, container, prefix, symbol) - case flags&ast.SymbolFlagsConstructor != 0: - signatures := getSignaturesAtLocation(c, symbol.Parent, checker.SignatureKindConstruct, node) - if len(signatures) == 1 { - if d := signatures[0].Declaration(); d != nil && d.Flags&ast.NodeFlagsJSDoc == 0 { - declaration = d + if ast.IsIdentifier(node) && ast.IsFunctionLikeDeclaration(node.Parent) && node.Parent.Name() == node { + declaration = node.Parent + signatures := []*checker.Signature{c.GetSignatureFromDeclaration(declaration)} + writeSignatures(&b, c, signatures, container, prefix, symbol) + } else { + signatures := getSignaturesAtLocation(c, symbol, checker.SignatureKindCall, node) + if len(signatures) == 1 { + if d := signatures[0].Declaration(); d != nil && d.Flags&ast.NodeFlagsJSDoc == 0 { + declaration = d + } } + writeSignatures(&b, c, signatures, container, prefix, symbol) } - writeSignatures(&b, c, signatures, container, "constructor ", symbol.Parent) case flags&(ast.SymbolFlagsClass|ast.SymbolFlagsInterface) != 0: if node.Kind == ast.KindThisKeyword || ast.IsThisInTypeQuery(node) { b.WriteString("this") + } else if node.Kind == ast.KindConstructorKeyword && (ast.IsConstructorDeclaration(node.Parent) || ast.IsConstructSignatureDeclaration(node.Parent)) { + declaration = node.Parent + signatures := []*checker.Signature{c.GetSignatureFromDeclaration(declaration)} + writeSignatures(&b, c, signatures, container, "constructor ", symbol) } else { - b.WriteString(core.IfElse(flags&ast.SymbolFlagsClass != 0, "class ", "interface ")) - b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) - params := c.GetDeclaredTypeOfSymbol(symbol).AsInterfaceType().LocalTypeParameters() - writeTypeParams(&b, c, params) + var signatures []*checker.Signature + if flags&ast.SymbolFlagsClass != 0 && getCallOrNewExpression(node) != nil { + signatures = getSignaturesAtLocation(c, symbol, checker.SignatureKindConstruct, node) + } + if len(signatures) == 1 { + if d := signatures[0].Declaration(); d != nil && d.Flags&ast.NodeFlagsJSDoc == 0 { + declaration = d + } + writeSignatures(&b, c, signatures, container, "constructor ", symbol) + } else { + b.WriteString(core.IfElse(flags&ast.SymbolFlagsClass != 0, "class ", "interface ")) + b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) + params := c.GetDeclaredTypeOfSymbol(symbol).AsInterfaceType().LocalTypeParameters() + writeTypeParams(&b, c, params) + } } if flags&ast.SymbolFlagsInterface != 0 { declaration = core.Find(symbol.Declarations, ast.IsInterfaceDeclaration) @@ -381,7 +386,7 @@ func containsTypedefTag(jsdoc *ast.Node) bool { if jsdoc.Kind == ast.KindJSDoc { if tags := jsdoc.AsJSDoc().Tags; tags != nil { for _, tag := range tags.Nodes { - if tag.Kind == ast.KindJSDocTypedefTag { + if tag.Kind == ast.KindJSDocTypedefTag || tag.Kind == ast.KindJSDocCallbackTag { return true } } @@ -398,26 +403,40 @@ func getJSDoc(node *ast.Node) *ast.Node { return core.LastOrNil(node.JSDoc(nil)) } -func getJSDocOrTag(node *ast.Node) *ast.Node { +func getJSDocOrTag(c *checker.Checker, node *ast.Node) *ast.Node { if jsdoc := getJSDoc(node); jsdoc != nil { return jsdoc } switch { case ast.IsParameter(node): - return getMatchingJSDocTag(node.Parent, node.Name().Text(), isMatchingParameterTag) + return getMatchingJSDocTag(c, node.Parent, node.Name().Text(), isMatchingParameterTag) case ast.IsTypeParameterDeclaration(node): - return getMatchingJSDocTag(node.Parent, node.Name().Text(), isMatchingTemplateTag) + return getMatchingJSDocTag(c, node.Parent, node.Name().Text(), isMatchingTemplateTag) case ast.IsVariableDeclaration(node) && ast.IsVariableDeclarationList(node.Parent) && core.FirstOrNil(node.Parent.AsVariableDeclarationList().Declarations.Nodes) == node: - return getJSDocOrTag(node.Parent.Parent) + return getJSDocOrTag(c, node.Parent.Parent) case (ast.IsFunctionExpressionOrArrowFunction(node) || ast.IsClassExpression(node)) && (ast.IsVariableDeclaration(node.Parent) || ast.IsPropertyDeclaration(node.Parent) || ast.IsPropertyAssignment(node.Parent)) && node.Parent.Initializer() == node: - return getJSDocOrTag(node.Parent) + return getJSDocOrTag(c, node.Parent) + } + if symbol := node.Symbol(); symbol != nil && ast.IsClassOrInterfaceLike(node.Parent) { + isStatic := ast.HasStaticModifier(node) + for _, baseType := range c.GetBaseTypes(c.GetDeclaredTypeOfSymbol(node.Parent.Symbol())) { + t := baseType + if isStatic { + t = c.GetTypeOfSymbol(baseType.Symbol()) + } + if prop := c.GetPropertyOfType(t, symbol.Name); prop != nil && prop.ValueDeclaration != nil { + if jsDoc := getJSDocOrTag(c, prop.ValueDeclaration); jsDoc != nil { + return jsDoc + } + } + } } return nil } -func getMatchingJSDocTag(node *ast.Node, name string, match func(*ast.Node, string) bool) *ast.Node { - if jsdoc := getJSDocOrTag(node); jsdoc != nil && jsdoc.Kind == ast.KindJSDoc { +func getMatchingJSDocTag(c *checker.Checker, node *ast.Node, name string, match func(*ast.Node, string) bool) *ast.Node { + if jsdoc := getJSDocOrTag(c, node); jsdoc != nil && jsdoc.Kind == ast.KindJSDoc { if tags := jsdoc.AsJSDoc().Tags; tags != nil { for _, tag := range tags.Nodes { if match(tag, name) { From 2f03c6bb7743a9681b8a38b7b7073e44e4aa2617 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 17 Nov 2025 07:07:26 -0800 Subject: [PATCH 2/5] Accept new baselines --- .../jsdocOnInheritedMembers1.baseline | 4 +- .../jsdocOnInheritedMembers2.baseline | 4 +- .../quickInfo/quickInfoCommentsClass.baseline | 8 +- .../quickInfoDisplayPartsClass.baseline | 4 +- ...kInfoDisplayPartsClassConstructor.baseline | 29 ++--- .../quickInfoDisplayPartsFunction.baseline | 29 ++--- ...uickInfoDisplayPartsLocalFunction.baseline | 29 ++--- .../quickInfoDisplayPartsTypeAlias.baseline | 4 +- .../quickInfoJsDocInheritage.baseline | 104 +++++++++++++++--- .../quickInfo/quickInfoJsDocTags16.baseline | 8 +- .../quickInfo/quickInfoJsDocTags4.baseline | 17 ++- .../quickInfo/quickInfoJsDocTags5.baseline | 17 ++- ...ckInfoJsDocTagsFunctionOverload01.baseline | 11 +- ...ckInfoJsDocTagsFunctionOverload03.baseline | 9 +- ...ckInfoJsDocTagsFunctionOverload05.baseline | 9 +- 15 files changed, 181 insertions(+), 105 deletions(-) diff --git a/testdata/baselines/reference/fourslash/quickInfo/jsdocOnInheritedMembers1.baseline b/testdata/baselines/reference/fourslash/quickInfo/jsdocOnInheritedMembers1.baseline index 2d56b118e9..eb80ccd6f1 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/jsdocOnInheritedMembers1.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/jsdocOnInheritedMembers1.baseline @@ -18,7 +18,7 @@ // | ```tsx // | (method) B.method(): void // | ``` -// | +// | Method documentation. // | ---------------------------------------------------------------------- [ { @@ -34,7 +34,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) B.method(): void\n```\n" + "value": "```tsx\n(method) B.method(): void\n```\nMethod documentation." }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/jsdocOnInheritedMembers2.baseline b/testdata/baselines/reference/fourslash/quickInfo/jsdocOnInheritedMembers2.baseline index ace63d1caa..e062d75099 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/jsdocOnInheritedMembers2.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/jsdocOnInheritedMembers2.baseline @@ -18,7 +18,7 @@ // | ```tsx // | (method) B.method(): void // | ``` -// | +// | Method documentation. // | ---------------------------------------------------------------------- [ { @@ -34,7 +34,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) B.method(): void\n```\n" + "value": "```tsx\n(method) B.method(): void\n```\nMethod documentation." }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsClass.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsClass.baseline index 14c8e6a842..493fc0d368 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsClass.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsClass.baseline @@ -21,7 +21,7 @@ // ^^ // | ---------------------------------------------------------------------- // | ```tsx -// | class c2 +// | constructor c2(): c2 // | ``` // | This is class c2 without constructor // | ---------------------------------------------------------------------- @@ -147,7 +147,7 @@ // ^^ // | ---------------------------------------------------------------------- // | ```tsx -// | class c5 +// | constructor c5(): c5 // | ``` // | Class with statics // | ---------------------------------------------------------------------- @@ -307,7 +307,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nclass c2\n```\nThis is class c2 without constructor" + "value": "```tsx\nconstructor c2(): c2\n```\nThis is class c2 without constructor" }, "range": { "start": { @@ -712,7 +712,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nclass c5\n```\nClass with statics" + "value": "```tsx\nconstructor c5(): c5\n```\nClass with statics" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsClass.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsClass.baseline index e23f908563..13b5962138 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsClass.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsClass.baseline @@ -20,7 +20,7 @@ // ^ // | ---------------------------------------------------------------------- // | ```tsx -// | class c +// | constructor c(): c // | ``` // | // | ---------------------------------------------------------------------- @@ -107,7 +107,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nclass c\n```\n" + "value": "```tsx\nconstructor c(): c\n```\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsClassConstructor.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsClassConstructor.baseline index e4336656ac..c863ea2792 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsClassConstructor.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsClassConstructor.baseline @@ -47,7 +47,6 @@ // | ---------------------------------------------------------------------- // | ```tsx // | constructor cWithOverloads(x: string): cWithOverloads -// | constructor cWithOverloads(x: number): cWithOverloads // | ``` // | // | ---------------------------------------------------------------------- @@ -55,7 +54,6 @@ // ^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | constructor cWithOverloads(x: string): cWithOverloads // | constructor cWithOverloads(x: number): cWithOverloads // | ``` // | @@ -64,8 +62,7 @@ // ^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | constructor cWithOverloads(x: string): cWithOverloads -// | constructor cWithOverloads(x: number): cWithOverloads +// | constructor cWithOverloads(x: any): cWithOverloads // | ``` // | // | ---------------------------------------------------------------------- @@ -122,8 +119,6 @@ // | ---------------------------------------------------------------------- // | ```tsx // | constructor cWithMultipleOverloads(x: string): cWithMultipleOverloads -// | constructor cWithMultipleOverloads(x: number): cWithMultipleOverloads -// | constructor cWithMultipleOverloads(x: boolean): cWithMultipleOverloads // | ``` // | // | ---------------------------------------------------------------------- @@ -131,9 +126,7 @@ // ^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | constructor cWithMultipleOverloads(x: string): cWithMultipleOverloads // | constructor cWithMultipleOverloads(x: number): cWithMultipleOverloads -// | constructor cWithMultipleOverloads(x: boolean): cWithMultipleOverloads // | ``` // | // | ---------------------------------------------------------------------- @@ -141,8 +134,6 @@ // ^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | constructor cWithMultipleOverloads(x: string): cWithMultipleOverloads -// | constructor cWithMultipleOverloads(x: number): cWithMultipleOverloads // | constructor cWithMultipleOverloads(x: boolean): cWithMultipleOverloads // | ``` // | @@ -151,9 +142,7 @@ // ^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | constructor cWithMultipleOverloads(x: string): cWithMultipleOverloads -// | constructor cWithMultipleOverloads(x: number): cWithMultipleOverloads -// | constructor cWithMultipleOverloads(x: boolean): cWithMultipleOverloads +// | constructor cWithMultipleOverloads(x: any): cWithMultipleOverloads // | ``` // | // | ---------------------------------------------------------------------- @@ -368,7 +357,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nconstructor cWithOverloads(x: string): cWithOverloads\nconstructor cWithOverloads(x: number): cWithOverloads\n```\n" + "value": "```tsx\nconstructor cWithOverloads(x: string): cWithOverloads\n```\n" }, "range": { "start": { @@ -395,7 +384,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nconstructor cWithOverloads(x: string): cWithOverloads\nconstructor cWithOverloads(x: number): cWithOverloads\n```\n" + "value": "```tsx\nconstructor cWithOverloads(x: number): cWithOverloads\n```\n" }, "range": { "start": { @@ -422,7 +411,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nconstructor cWithOverloads(x: string): cWithOverloads\nconstructor cWithOverloads(x: number): cWithOverloads\n```\n" + "value": "```tsx\nconstructor cWithOverloads(x: any): cWithOverloads\n```\n" }, "range": { "start": { @@ -611,7 +600,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nconstructor cWithMultipleOverloads(x: string): cWithMultipleOverloads\nconstructor cWithMultipleOverloads(x: number): cWithMultipleOverloads\nconstructor cWithMultipleOverloads(x: boolean): cWithMultipleOverloads\n```\n" + "value": "```tsx\nconstructor cWithMultipleOverloads(x: string): cWithMultipleOverloads\n```\n" }, "range": { "start": { @@ -638,7 +627,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nconstructor cWithMultipleOverloads(x: string): cWithMultipleOverloads\nconstructor cWithMultipleOverloads(x: number): cWithMultipleOverloads\nconstructor cWithMultipleOverloads(x: boolean): cWithMultipleOverloads\n```\n" + "value": "```tsx\nconstructor cWithMultipleOverloads(x: number): cWithMultipleOverloads\n```\n" }, "range": { "start": { @@ -665,7 +654,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nconstructor cWithMultipleOverloads(x: string): cWithMultipleOverloads\nconstructor cWithMultipleOverloads(x: number): cWithMultipleOverloads\nconstructor cWithMultipleOverloads(x: boolean): cWithMultipleOverloads\n```\n" + "value": "```tsx\nconstructor cWithMultipleOverloads(x: boolean): cWithMultipleOverloads\n```\n" }, "range": { "start": { @@ -692,7 +681,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nconstructor cWithMultipleOverloads(x: string): cWithMultipleOverloads\nconstructor cWithMultipleOverloads(x: number): cWithMultipleOverloads\nconstructor cWithMultipleOverloads(x: boolean): cWithMultipleOverloads\n```\n" + "value": "```tsx\nconstructor cWithMultipleOverloads(x: any): cWithMultipleOverloads\n```\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsFunction.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsFunction.baseline index 973cdbfad4..bccaaa43e7 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsFunction.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsFunction.baseline @@ -14,7 +14,6 @@ // | ---------------------------------------------------------------------- // | ```tsx // | function foowithoverload(a: string): string -// | function foowithoverload(a: number): number // | ``` // | // | ---------------------------------------------------------------------- @@ -22,7 +21,6 @@ // ^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowithoverload(a: string): string // | function foowithoverload(a: number): number // | ``` // | @@ -31,8 +29,7 @@ // ^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowithoverload(a: string): string -// | function foowithoverload(a: number): number +// | function foowithoverload(a: any): any // | ``` // | // | ---------------------------------------------------------------------- @@ -43,8 +40,6 @@ // | ---------------------------------------------------------------------- // | ```tsx // | function foowith3overload(a: string): string -// | function foowith3overload(a: number): number -// | function foowith3overload(a: boolean): boolean // | ``` // | // | ---------------------------------------------------------------------- @@ -52,9 +47,7 @@ // ^^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowith3overload(a: string): string // | function foowith3overload(a: number): number -// | function foowith3overload(a: boolean): boolean // | ``` // | // | ---------------------------------------------------------------------- @@ -62,8 +55,6 @@ // ^^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowith3overload(a: string): string -// | function foowith3overload(a: number): number // | function foowith3overload(a: boolean): boolean // | ``` // | @@ -72,9 +63,7 @@ // ^^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowith3overload(a: string): string -// | function foowith3overload(a: number): number -// | function foowith3overload(a: boolean): boolean +// | function foowith3overload(a: any): any // | ``` // | // | ---------------------------------------------------------------------- @@ -169,7 +158,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowithoverload(a: string): string\nfunction foowithoverload(a: number): number\n```\n" + "value": "```tsx\nfunction foowithoverload(a: string): string\n```\n" }, "range": { "start": { @@ -196,7 +185,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowithoverload(a: string): string\nfunction foowithoverload(a: number): number\n```\n" + "value": "```tsx\nfunction foowithoverload(a: number): number\n```\n" }, "range": { "start": { @@ -223,7 +212,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowithoverload(a: string): string\nfunction foowithoverload(a: number): number\n```\n" + "value": "```tsx\nfunction foowithoverload(a: any): any\n```\n" }, "range": { "start": { @@ -250,7 +239,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowith3overload(a: string): string\nfunction foowith3overload(a: number): number\nfunction foowith3overload(a: boolean): boolean\n```\n" + "value": "```tsx\nfunction foowith3overload(a: string): string\n```\n" }, "range": { "start": { @@ -277,7 +266,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowith3overload(a: string): string\nfunction foowith3overload(a: number): number\nfunction foowith3overload(a: boolean): boolean\n```\n" + "value": "```tsx\nfunction foowith3overload(a: number): number\n```\n" }, "range": { "start": { @@ -304,7 +293,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowith3overload(a: string): string\nfunction foowith3overload(a: number): number\nfunction foowith3overload(a: boolean): boolean\n```\n" + "value": "```tsx\nfunction foowith3overload(a: boolean): boolean\n```\n" }, "range": { "start": { @@ -331,7 +320,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowith3overload(a: string): string\nfunction foowith3overload(a: number): number\nfunction foowith3overload(a: boolean): boolean\n```\n" + "value": "```tsx\nfunction foowith3overload(a: any): any\n```\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsLocalFunction.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsLocalFunction.baseline index 603b1d559b..c96c894c38 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsLocalFunction.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsLocalFunction.baseline @@ -22,7 +22,6 @@ // | ---------------------------------------------------------------------- // | ```tsx // | function foowithoverload(a: string): string -// | function foowithoverload(a: number): number // | ``` // | // | ---------------------------------------------------------------------- @@ -30,7 +29,6 @@ // ^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowithoverload(a: string): string // | function foowithoverload(a: number): number // | ``` // | @@ -39,8 +37,7 @@ // ^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowithoverload(a: string): string -// | function foowithoverload(a: number): number +// | function foowithoverload(a: any): any // | ``` // | // | ---------------------------------------------------------------------- @@ -51,8 +48,6 @@ // | ---------------------------------------------------------------------- // | ```tsx // | function foowith3overload(a: string): string -// | function foowith3overload(a: number): number -// | function foowith3overload(a: boolean): boolean // | ``` // | // | ---------------------------------------------------------------------- @@ -60,9 +55,7 @@ // ^^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowith3overload(a: string): string // | function foowith3overload(a: number): number -// | function foowith3overload(a: boolean): boolean // | ``` // | // | ---------------------------------------------------------------------- @@ -70,8 +63,6 @@ // ^^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowith3overload(a: string): string -// | function foowith3overload(a: number): number // | function foowith3overload(a: boolean): boolean // | ``` // | @@ -80,9 +71,7 @@ // ^^^^^^^^^^^^^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foowith3overload(a: string): string -// | function foowith3overload(a: number): number -// | function foowith3overload(a: boolean): boolean +// | function foowith3overload(a: any): any // | ``` // | // | ---------------------------------------------------------------------- @@ -213,7 +202,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowithoverload(a: string): string\nfunction foowithoverload(a: number): number\n```\n" + "value": "```tsx\nfunction foowithoverload(a: string): string\n```\n" }, "range": { "start": { @@ -240,7 +229,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowithoverload(a: string): string\nfunction foowithoverload(a: number): number\n```\n" + "value": "```tsx\nfunction foowithoverload(a: number): number\n```\n" }, "range": { "start": { @@ -267,7 +256,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowithoverload(a: string): string\nfunction foowithoverload(a: number): number\n```\n" + "value": "```tsx\nfunction foowithoverload(a: any): any\n```\n" }, "range": { "start": { @@ -294,7 +283,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowith3overload(a: string): string\nfunction foowith3overload(a: number): number\nfunction foowith3overload(a: boolean): boolean\n```\n" + "value": "```tsx\nfunction foowith3overload(a: string): string\n```\n" }, "range": { "start": { @@ -321,7 +310,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowith3overload(a: string): string\nfunction foowith3overload(a: number): number\nfunction foowith3overload(a: boolean): boolean\n```\n" + "value": "```tsx\nfunction foowith3overload(a: number): number\n```\n" }, "range": { "start": { @@ -348,7 +337,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowith3overload(a: string): string\nfunction foowith3overload(a: number): number\nfunction foowith3overload(a: boolean): boolean\n```\n" + "value": "```tsx\nfunction foowith3overload(a: boolean): boolean\n```\n" }, "range": { "start": { @@ -375,7 +364,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foowith3overload(a: string): string\nfunction foowith3overload(a: number): number\nfunction foowith3overload(a: boolean): boolean\n```\n" + "value": "```tsx\nfunction foowith3overload(a: any): any\n```\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsTypeAlias.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsTypeAlias.baseline index de8d7ae536..4ba0f03aed 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsTypeAlias.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoDisplayPartsTypeAlias.baseline @@ -42,7 +42,7 @@ // ^ // | ---------------------------------------------------------------------- // | ```tsx -// | class c +// | constructor c(): c // | ``` // | // | ---------------------------------------------------------------------- @@ -195,7 +195,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nclass c\n```\n" + "value": "```tsx\nconstructor c(): c\n```\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocInheritage.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocInheritage.baseline index b8d48ea63c..4e62ce9359 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocInheritage.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocInheritage.baseline @@ -121,6 +121,9 @@ // | (property) Drived1.foo1: number // | ``` // | +// | +// | *@description* — Base1.foo1 +// | // | ---------------------------------------------------------------------- // foo2(para1: string) { return 1 }; // ^^^^ @@ -129,6 +132,12 @@ // | (method) Drived1.foo2(para1: string): number // | ``` // | +// | +// | *@param* `q` — Base1.foo2 parameter +// | +// | +// | *@returns* — Base1.foo2 return +// | // | ---------------------------------------------------------------------- // } // @@ -142,6 +151,9 @@ // | (property) Drived2.foo1: number // | ``` // | +// | +// | *@description* — Base1.foo1 +// | // | ---------------------------------------------------------------------- // foo2 = (para1: string) => { return 1; }; // ^^^^ @@ -150,6 +162,12 @@ // | (property) Drived2.foo2: (para1: string) => number // | ``` // | +// | +// | *@param* `q` — Base1.foo2 parameter +// | +// | +// | *@returns* — Base1.foo2 return +// | // | ---------------------------------------------------------------------- // } // @@ -176,6 +194,9 @@ // | (property) Drived3.foo1: number // | ``` // | +// | +// | *@description* — Base2.foo1 +// | // | ---------------------------------------------------------------------- // foo2(para1: string) { return 1 }; // ^^^^ @@ -184,6 +205,12 @@ // | (method) Drived3.foo2(para1: string): number // | ``` // | +// | +// | *@param* `q` — Base2.foo2 parameter +// | +// | +// | *@returns* — Base2.foo2 return +// | // | ---------------------------------------------------------------------- // } // @@ -197,6 +224,9 @@ // | (property) Drived4.foo1: number // | ``` // | +// | +// | *@description* — Base2.foo1 +// | // | ---------------------------------------------------------------------- // foo2 = (para1: string) => { return 1; }; // ^^^^ @@ -205,6 +235,12 @@ // | (property) Drived4.foo2: (para1: string) => number // | ``` // | +// | +// | *@param* `q` — Base2.foo2 parameter +// | +// | +// | *@returns* — Base2.foo2 return +// | // | ---------------------------------------------------------------------- // } // @@ -215,6 +251,9 @@ // | (property) Drived1.foo1: number // | ``` // | +// | +// | *@description* — Base1.foo1 +// | // | ---------------------------------------------------------------------- // new Drived1().foo2; // ^^^^ @@ -223,6 +262,12 @@ // | (method) Drived1.foo2(para1: string): number // | ``` // | +// | +// | *@param* `q` — Base1.foo2 parameter +// | +// | +// | *@returns* — Base1.foo2 return +// | // | ---------------------------------------------------------------------- // new Drived2().foo1; // ^^^^ @@ -231,6 +276,9 @@ // | (property) Drived2.foo1: number // | ``` // | +// | +// | *@description* — Base1.foo1 +// | // | ---------------------------------------------------------------------- // new Drived2().foo2; // ^^^^ @@ -239,6 +287,12 @@ // | (property) Drived2.foo2: (para1: string) => number // | ``` // | +// | +// | *@param* `q` — Base1.foo2 parameter +// | +// | +// | *@returns* — Base1.foo2 return +// | // | ---------------------------------------------------------------------- // new Drived3().foo1; // ^^^^ @@ -247,6 +301,9 @@ // | (property) Drived3.foo1: number // | ``` // | +// | +// | *@description* — Base2.foo1 +// | // | ---------------------------------------------------------------------- // new Drived3().foo2; // ^^^^ @@ -255,6 +312,12 @@ // | (method) Drived3.foo2(para1: string): number // | ``` // | +// | +// | *@param* `q` — Base2.foo2 parameter +// | +// | +// | *@returns* — Base2.foo2 return +// | // | ---------------------------------------------------------------------- // new Drived4().foo1; // ^^^^ @@ -263,6 +326,9 @@ // | (property) Drived4.foo1: number // | ``` // | +// | +// | *@description* — Base2.foo1 +// | // | ---------------------------------------------------------------------- // new Drived4().foo2; // ^^^^ @@ -271,6 +337,12 @@ // | (property) Drived4.foo2: (para1: string) => number // | ``` // | +// | +// | *@param* `q` — Base2.foo2 parameter +// | +// | +// | *@returns* — Base2.foo2 return +// | // | ---------------------------------------------------------------------- [ { @@ -502,7 +574,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived1.foo1: number\n```\n" + "value": "```tsx\n(property) Drived1.foo1: number\n```\n\n\n*@description* — Base1.foo1 \n" }, "range": { "start": { @@ -529,7 +601,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) Drived1.foo2(para1: string): number\n```\n" + "value": "```tsx\n(method) Drived1.foo2(para1: string): number\n```\n\n\n*@param* `q` — Base1.foo2 parameter\n\n\n*@returns* — Base1.foo2 return\n" }, "range": { "start": { @@ -556,7 +628,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived2.foo1: number\n```\n" + "value": "```tsx\n(property) Drived2.foo1: number\n```\n\n\n*@description* — Base1.foo1 \n" }, "range": { "start": { @@ -583,7 +655,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived2.foo2: (para1: string) => number\n```\n" + "value": "```tsx\n(property) Drived2.foo2: (para1: string) => number\n```\n\n\n*@param* `q` — Base1.foo2 parameter\n\n\n*@returns* — Base1.foo2 return\n" }, "range": { "start": { @@ -610,7 +682,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived3.foo1: number\n```\n" + "value": "```tsx\n(property) Drived3.foo1: number\n```\n\n\n*@description* — Base2.foo1 \n" }, "range": { "start": { @@ -637,7 +709,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) Drived3.foo2(para1: string): number\n```\n" + "value": "```tsx\n(method) Drived3.foo2(para1: string): number\n```\n\n\n*@param* `q` — Base2.foo2 parameter\n\n\n*@returns* — Base2.foo2 return\n" }, "range": { "start": { @@ -664,7 +736,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived4.foo1: number\n```\n" + "value": "```tsx\n(property) Drived4.foo1: number\n```\n\n\n*@description* — Base2.foo1 \n" }, "range": { "start": { @@ -691,7 +763,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived4.foo2: (para1: string) => number\n```\n" + "value": "```tsx\n(property) Drived4.foo2: (para1: string) => number\n```\n\n\n*@param* `q` — Base2.foo2 parameter\n\n\n*@returns* — Base2.foo2 return\n" }, "range": { "start": { @@ -718,7 +790,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived1.foo1: number\n```\n" + "value": "```tsx\n(property) Drived1.foo1: number\n```\n\n\n*@description* — Base1.foo1 \n" }, "range": { "start": { @@ -745,7 +817,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) Drived1.foo2(para1: string): number\n```\n" + "value": "```tsx\n(method) Drived1.foo2(para1: string): number\n```\n\n\n*@param* `q` — Base1.foo2 parameter\n\n\n*@returns* — Base1.foo2 return\n" }, "range": { "start": { @@ -772,7 +844,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived2.foo1: number\n```\n" + "value": "```tsx\n(property) Drived2.foo1: number\n```\n\n\n*@description* — Base1.foo1 \n" }, "range": { "start": { @@ -799,7 +871,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived2.foo2: (para1: string) => number\n```\n" + "value": "```tsx\n(property) Drived2.foo2: (para1: string) => number\n```\n\n\n*@param* `q` — Base1.foo2 parameter\n\n\n*@returns* — Base1.foo2 return\n" }, "range": { "start": { @@ -826,7 +898,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived3.foo1: number\n```\n" + "value": "```tsx\n(property) Drived3.foo1: number\n```\n\n\n*@description* — Base2.foo1 \n" }, "range": { "start": { @@ -853,7 +925,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) Drived3.foo2(para1: string): number\n```\n" + "value": "```tsx\n(method) Drived3.foo2(para1: string): number\n```\n\n\n*@param* `q` — Base2.foo2 parameter\n\n\n*@returns* — Base2.foo2 return\n" }, "range": { "start": { @@ -880,7 +952,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived4.foo1: number\n```\n" + "value": "```tsx\n(property) Drived4.foo1: number\n```\n\n\n*@description* — Base2.foo1 \n" }, "range": { "start": { @@ -907,7 +979,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(property) Drived4.foo2: (para1: string) => number\n```\n" + "value": "```tsx\n(property) Drived4.foo2: (para1: string) => number\n```\n\n\n*@param* `q` — Base2.foo2 parameter\n\n\n*@returns* — Base2.foo2 return\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags16.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags16.baseline index 7207d867bb..e47770a431 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags16.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags16.baseline @@ -16,7 +16,9 @@ // | ```tsx // | (method) B.foo(): void // | ``` +// | Description text here. // | +// | *@virtual* // | ---------------------------------------------------------------------- // } // @@ -27,7 +29,9 @@ // | ```tsx // | (method) C.foo(): void // | ``` +// | Description text here. // | +// | *@virtual* // | ---------------------------------------------------------------------- // } [ @@ -44,7 +48,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) B.foo(): void\n```\n" + "value": "```tsx\n(method) B.foo(): void\n```\nDescription text here.\n\n*@virtual*" }, "range": { "start": { @@ -71,7 +75,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) C.foo(): void\n```\n" + "value": "```tsx\n(method) C.foo(): void\n```\nDescription text here.\n\n*@virtual*" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags4.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags4.baseline index 2892d1f230..64e87ec6b8 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags4.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags4.baseline @@ -21,6 +21,21 @@ // | ```tsx // | (method) Bar.method(x: number, y: number): number // | ``` +// | comment +// | +// | *@author* — Me +// | +// | +// | *@see* `x` — (the parameter) +// | +// | +// | *@param* `x` - x comment +// | +// | +// | *@param* `y` - y comment +// | +// | +// | *@returns* — The result // | // | ---------------------------------------------------------------------- // const res = super.method(x, y) + 100; @@ -41,7 +56,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) Bar.method(x: number, y: number): number\n```\n" + "value": "```tsx\n(method) Bar.method(x: number, y: number): number\n```\ncomment\n\n*@author* — Me \n\n\n*@see* `x` — (the parameter)\n\n\n*@param* `x` - x comment\n\n\n*@param* `y` - y comment\n\n\n*@returns* — The result\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags5.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags5.baseline index c94faf9bad..383e41d30a 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags5.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTags5.baseline @@ -21,6 +21,21 @@ // | ```tsx // | (method) Bar.method(x: any, y: any): number // | ``` +// | comment +// | +// | *@author* — Me +// | +// | +// | *@see* `x` — (the parameter) +// | +// | +// | *@param* `x` - x comment +// | +// | +// | *@param* `y` - y comment +// | +// | +// | *@returns* — The result // | // | ---------------------------------------------------------------------- // const res = super.method(x, y) + 100; @@ -41,7 +56,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(method) Bar.method(x: any, y: any): number\n```\n" + "value": "```tsx\n(method) Bar.method(x: any, y: any): number\n```\ncomment\n\n*@author* — Me \n\n\n*@see* `x` — (the parameter)\n\n\n*@param* `x` - x comment\n\n\n*@param* `y` - y comment\n\n\n*@returns* — The result\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload01.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload01.baseline index 842dcf0481..4a272576b6 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload01.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload01.baseline @@ -8,7 +8,6 @@ // | ---------------------------------------------------------------------- // | ```tsx // | function foo(): void -// | function foo(x: number): void // | ``` // | Doc foo // | ---------------------------------------------------------------------- @@ -21,10 +20,12 @@ // ^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foo(): void // | function foo(x: number): void // | ``` -// | Doc foo +// | Doc foo overloaded +// | +// | *@tag* — Tag text +// | // | ---------------------------------------------------------------------- [ { @@ -40,7 +41,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foo(): void\nfunction foo(x: number): void\n```\nDoc foo" + "value": "```tsx\nfunction foo(): void\n```\nDoc foo" }, "range": { "start": { @@ -67,7 +68,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foo(): void\nfunction foo(x: number): void\n```\nDoc foo" + "value": "```tsx\nfunction foo(x: number): void\n```\nDoc foo overloaded\n\n*@tag* — Tag text\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload03.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload03.baseline index ab0e3bf2c8..530d7887a4 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload03.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload03.baseline @@ -5,7 +5,6 @@ // | ---------------------------------------------------------------------- // | ```tsx // | function foo(): void -// | function foo(x: number): void // | ``` // | // | ---------------------------------------------------------------------- @@ -18,9 +17,11 @@ // ^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foo(): void // | function foo(x: number): void // | ``` +// | Doc foo overloaded +// | +// | *@tag* — Tag text // | // | ---------------------------------------------------------------------- [ @@ -37,7 +38,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foo(): void\nfunction foo(x: number): void\n```\n" + "value": "```tsx\nfunction foo(): void\n```\n" }, "range": { "start": { @@ -64,7 +65,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foo(): void\nfunction foo(x: number): void\n```\n" + "value": "```tsx\nfunction foo(x: number): void\n```\nDoc foo overloaded\n\n*@tag* — Tag text\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload05.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload05.baseline index af4d5156a4..7ffcd11adc 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload05.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoJsDocTagsFunctionOverload05.baseline @@ -5,7 +5,6 @@ // | ---------------------------------------------------------------------- // | ```tsx // | function foo(): void -// | function foo(x: number): void // | ``` // | // | ---------------------------------------------------------------------- @@ -17,10 +16,12 @@ // ^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | function foo(): void // | function foo(x: number): void // | ``` // | +// | +// | *@tag* — Tag text +// | // | ---------------------------------------------------------------------- [ { @@ -36,7 +37,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foo(): void\nfunction foo(x: number): void\n```\n" + "value": "```tsx\nfunction foo(): void\n```\n" }, "range": { "start": { @@ -63,7 +64,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction foo(): void\nfunction foo(x: number): void\n```\n" + "value": "```tsx\nfunction foo(x: number): void\n```\n\n\n*@tag* — Tag text\n" }, "range": { "start": { From 00febb7bdcffb27dc6c96baaaa570b75945b54d5 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 17 Nov 2025 08:03:23 -0800 Subject: [PATCH 3/5] Update fourslash test --- .../fourslash/tests/gen/quickInfoForOverloadOnConst1_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/fourslash/tests/gen/quickInfoForOverloadOnConst1_test.go b/internal/fourslash/tests/gen/quickInfoForOverloadOnConst1_test.go index 13b73259bc..765a52a878 100644 --- a/internal/fourslash/tests/gen/quickInfoForOverloadOnConst1_test.go +++ b/internal/fourslash/tests/gen/quickInfoForOverloadOnConst1_test.go @@ -31,7 +31,7 @@ c.x1(1, (x/*10*/x) => { return 1; } );` f.VerifyQuickInfoAt(t, "1", "(method) I.x1(a: number, callback: (x: \"hi\") => number): any", "") f.VerifyQuickInfoAt(t, "2", "(method) C.x1(a: number, callback: (x: \"hi\") => number): any", "") f.VerifyQuickInfoAt(t, "3", "(parameter) callback: (x: \"hi\") => number", "") - f.VerifyQuickInfoAt(t, "4", "(method) C.x1(a: number, callback: (x: \"hi\") => number): any", "") + f.VerifyQuickInfoAt(t, "4", "(method) C.x1(a: number, callback: (x: string) => number): void", "") f.VerifyQuickInfoAt(t, "5", "(parameter) callback: (x: string) => number", "") f.VerifyQuickInfoAt(t, "6", "(parameter) callback: (x: string) => number", "") f.VerifyQuickInfoAt(t, "7", "(method) C.x1(a: number, callback: (x: \"hi\") => number): any", "") From edd0e5a6169aa340fffb8e3e3aa335a1cb04456e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 17 Nov 2025 08:14:36 -0800 Subject: [PATCH 4/5] Check for nil parent --- internal/ls/hover.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/ls/hover.go b/internal/ls/hover.go index e5e002d539..5a7104167e 100644 --- a/internal/ls/hover.go +++ b/internal/ls/hover.go @@ -418,7 +418,7 @@ func getJSDocOrTag(c *checker.Checker, node *ast.Node) *ast.Node { (ast.IsVariableDeclaration(node.Parent) || ast.IsPropertyDeclaration(node.Parent) || ast.IsPropertyAssignment(node.Parent)) && node.Parent.Initializer() == node: return getJSDocOrTag(c, node.Parent) } - if symbol := node.Symbol(); symbol != nil && ast.IsClassOrInterfaceLike(node.Parent) { + if symbol := node.Symbol(); symbol != nil && node.Parent != nil && ast.IsClassOrInterfaceLike(node.Parent) { isStatic := ast.HasStaticModifier(node) for _, baseType := range c.GetBaseTypes(c.GetDeclaredTypeOfSymbol(node.Parent.Symbol())) { t := baseType From 2ff4b9de12f770710fcb683e9fe369aec418b7e9 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 17 Nov 2025 08:53:48 -0800 Subject: [PATCH 5/5] Change generated test to manual --- internal/fourslash/_scripts/manualTests.txt | 1 + .../tests/{gen => manual}/quickInfoForOverloadOnConst1_test.go | 0 2 files changed, 1 insertion(+) rename internal/fourslash/tests/{gen => manual}/quickInfoForOverloadOnConst1_test.go (100%) diff --git a/internal/fourslash/_scripts/manualTests.txt b/internal/fourslash/_scripts/manualTests.txt index 4c1c0b91fb..bc1045b9eb 100644 --- a/internal/fourslash/_scripts/manualTests.txt +++ b/internal/fourslash/_scripts/manualTests.txt @@ -3,6 +3,7 @@ completionsAtIncompleteObjectLiteralProperty completionsSelfDeclaring1 completionsWithDeprecatedTag4 parserCorruptionAfterMapInClass +quickInfoForOverloadOnConst1 renameDefaultKeyword renameForDefaultExport01 tsxCompletion12 diff --git a/internal/fourslash/tests/gen/quickInfoForOverloadOnConst1_test.go b/internal/fourslash/tests/manual/quickInfoForOverloadOnConst1_test.go similarity index 100% rename from internal/fourslash/tests/gen/quickInfoForOverloadOnConst1_test.go rename to internal/fourslash/tests/manual/quickInfoForOverloadOnConst1_test.go