diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt index 16dade0e21f..04ba4ebb282 100644 --- a/internal/fourslash/_scripts/failingTests.txt +++ b/internal/fourslash/_scripts/failingTests.txt @@ -3,7 +3,6 @@ TestAllowLateBoundSymbolsOverwriteEarlyBoundSymbols TestAmbientShorthandGotoDefinition TestArgumentsAreAvailableAfterEditsAtEndOfFunction TestAugmentedTypesClass1 -TestAugmentedTypesClass3Fourslash TestAutoFormattingOnPasting TestAutoImportAllowImportingTsExtensionsPackageJsonImports1 TestAutoImportCompletionAmbientMergedModule1 diff --git a/internal/fourslash/_scripts/manualTests.txt b/internal/fourslash/_scripts/manualTests.txt index ea86ffb37f8..4b7241b890a 100644 --- a/internal/fourslash/_scripts/manualTests.txt +++ b/internal/fourslash/_scripts/manualTests.txt @@ -1,3 +1,4 @@ +augmentedTypesModule2 autoCloseFragment autoCloseTag autoImportPackageRootPathTypeModule diff --git a/internal/fourslash/tests/gen/augmentedTypesModule2_test.go b/internal/fourslash/tests/manual/augmentedTypesModule2_test.go similarity index 91% rename from internal/fourslash/tests/gen/augmentedTypesModule2_test.go rename to internal/fourslash/tests/manual/augmentedTypesModule2_test.go index 38d2688d8a4..c4a40869215 100644 --- a/internal/fourslash/tests/gen/augmentedTypesModule2_test.go +++ b/internal/fourslash/tests/manual/augmentedTypesModule2_test.go @@ -9,7 +9,6 @@ import ( ) func TestAugmentedTypesModule2(t *testing.T) { - fourslash.SkipIfFailing(t) t.Parallel() defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `function /*11*/m2f(x: number) { }; @@ -18,7 +17,7 @@ var x: m2f./*1*/ var /*2*/r = m2f/*3*/;` f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) defer done() - f.VerifyQuickInfoAt(t, "11", "function m2f(x: number): void\nnamespace m2f", "") + f.VerifyQuickInfoAt(t, "11", "function m2f(x: number): void", "") f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ IsIncomplete: false, ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ diff --git a/internal/ls/hover.go b/internal/ls/hover.go index a0e2e75791f..103a70a2227 100644 --- a/internal/ls/hover.go +++ b/internal/ls/hover.go @@ -61,9 +61,6 @@ func (l *LanguageService) ProvideHover(ctx context.Context, documentURI lsproto. } func (l *LanguageService) getQuickInfoAndDocumentationForSymbol(c *checker.Checker, symbol *ast.Symbol, node *ast.Node, contentFormat lsproto.MarkupKind) (string, string) { - if symbol == nil { - return "", "" - } quickInfo, declaration := getQuickInfoAndDeclarationAtLocation(c, symbol, node) if quickInfo == "" { return "", "" @@ -175,29 +172,87 @@ func formatQuickInfo(quickInfo string) string { } func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol, node *ast.Node) (string, *ast.Node) { - var b strings.Builder - var visitedAliases collections.Set[*ast.Symbol] container := getContainerNode(node) - if node.Kind == ast.KindThisKeyword && ast.IsInExpressionContext(node) { + if node.Kind == ast.KindThisKeyword && ast.IsInExpressionContext(node) || ast.IsThisInTypeQuery(node) { return c.TypeToStringEx(c.GetTypeAtLocation(node), container, typeFormatFlags), nil } - writeSymbolMeaning := func(symbol *ast.Symbol, meaning ast.SymbolFlags, isAlias bool) *ast.Node { - flags := symbol.Flags & meaning - if flags == 0 { - return nil - } - declaration := symbol.ValueDeclaration - if flags&ast.SymbolFlagsProperty != 0 && declaration != nil && ast.IsMethodDeclaration(declaration) { - flags = ast.SymbolFlagsMethod - } + if symbol == nil { + return "", nil + } + var b strings.Builder + var visitedAliases collections.Set[*ast.Symbol] + var aliasLevel int + writeNewLine := func() { if b.Len() != 0 { b.WriteString("\n") } - if isAlias { + if aliasLevel != 0 { b.WriteString("(alias) ") } - switch { - case flags&(ast.SymbolFlagsVariable|ast.SymbolFlagsProperty|ast.SymbolFlagsAccessor) != 0: + } + writeSignatures := func(signatures []*checker.Signature, prefix string, symbol *ast.Symbol) { + for i, sig := range signatures { + writeNewLine() + if i == 3 && len(signatures) >= 5 { + b.WriteString(fmt.Sprintf("// +%v more overloads", len(signatures)-3)) + break + } + b.WriteString(prefix) + b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) + b.WriteString(c.SignatureToStringEx(sig, container, typeFormatFlags|checker.TypeFormatFlagsWriteCallStyleSignature|checker.TypeFormatFlagsWriteTypeArgumentsOfSignature)) + } + } + writeTypeParams := func(params []*checker.Type) { + if len(params) > 0 { + b.WriteString("<") + for i, tp := range params { + if i != 0 { + b.WriteString(", ") + } + b.WriteString(c.SymbolToStringEx(tp.Symbol(), nil, ast.SymbolFlagsNone, symbolFormatFlags)) + cons := c.GetConstraintOfTypeParameter(tp) + if cons != nil { + b.WriteString(" extends ") + b.WriteString(c.TypeToStringEx(cons, nil, typeFormatFlags)) + } + } + b.WriteString(">") + } + } + var writeSymbol func(*ast.Symbol) *ast.Node + writeSymbol = func(symbol *ast.Symbol) *ast.Node { + var declaration *ast.Node + // Recursively write all meanings of alias + if symbol.Flags&ast.SymbolFlagsAlias != 0 && visitedAliases.AddIfAbsent(symbol) { + if aliasedSymbol := c.GetAliasedSymbol(symbol); aliasedSymbol != c.GetUnknownSymbol() { + aliasLevel++ + declaration = writeSymbol(aliasedSymbol) + aliasLevel-- + } + } + var flags ast.SymbolFlags + switch getMeaningFromLocation(node) { + case ast.SemanticMeaningValue: + flags = symbol.Flags & (ast.SymbolFlagsValue | ast.SymbolFlagsSignature) + case ast.SemanticMeaningType: + flags = symbol.Flags & ast.SymbolFlagsType + case ast.SemanticMeaningNamespace: + flags = symbol.Flags & ast.SymbolFlagsNamespace + } + if flags == 0 { + flags = symbol.Flags & (ast.SymbolFlagsValue | ast.SymbolFlagsSignature | ast.SymbolFlagsType | ast.SymbolFlagsNamespace) + if flags == 0 { + return nil + } + } + if flags&ast.SymbolFlagsProperty != 0 && symbol.ValueDeclaration != nil && ast.IsMethodDeclaration(symbol.ValueDeclaration) { + flags = ast.SymbolFlagsMethod + } + if flags&ast.SymbolFlagsValue != 0 { + declaration = symbol.ValueDeclaration + } + if flags&(ast.SymbolFlagsVariable|ast.SymbolFlagsProperty|ast.SymbolFlagsAccessor) != 0 { + writeNewLine() switch { case flags&ast.SymbolFlagsProperty != 0: b.WriteString("(property) ") @@ -233,7 +288,9 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol } else { b.WriteString(c.TypeToStringEx(c.GetTypeOfSymbolAtLocation(symbol, node), container, typeFormatFlags)) } - case flags&ast.SymbolFlagsEnumMember != 0: + } + if flags&ast.SymbolFlagsEnumMember != 0 { + writeNewLine() b.WriteString("(enum member) ") t := c.GetTypeOfSymbol(symbol) b.WriteString(c.TypeToStringEx(t, container, typeFormatFlags)) @@ -241,12 +298,13 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol b.WriteString(" = ") b.WriteString(t.AsLiteralType().String()) } - case flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsMethod) != 0: + } + if flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsMethod) != 0 { prefix := core.IfElse(flags&ast.SymbolFlagsMethod != 0, "(method) ", "function ") 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, isAlias, prefix, symbol) + writeSignatures(signatures, prefix, symbol) } else { signatures := getSignaturesAtLocation(c, symbol, checker.SignatureKindCall, node) if len(signatures) == 1 { @@ -254,15 +312,20 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol declaration = d } } - writeSignatures(&b, c, signatures, container, isAlias, prefix, symbol) + writeSignatures(signatures, prefix, symbol) + } + } + if flags&(ast.SymbolFlagsClass|ast.SymbolFlagsInterface) != 0 { + if flags&ast.SymbolFlagsInterface != 0 && (declaration == nil || ast.IsIdentifier(node) && ast.IsInterfaceDeclaration(node.Parent)) { + declaration = core.Find(symbol.Declarations, ast.IsInterfaceDeclaration) } - case flags&(ast.SymbolFlagsClass|ast.SymbolFlagsInterface) != 0: if node.Kind == ast.KindThisKeyword || ast.IsThisInTypeQuery(node) { + writeNewLine() 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, isAlias, "constructor ", symbol) + writeSignatures(signatures, "constructor ", symbol) } else { var signatures []*checker.Signature if flags&ast.SymbolFlagsClass != 0 && getCallOrNewExpression(node) != nil { @@ -272,24 +335,34 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol if d := signatures[0].Declaration(); d != nil && d.Flags&ast.NodeFlagsJSDoc == 0 { declaration = d } - writeSignatures(&b, c, signatures, container, isAlias, "constructor ", symbol) + writeSignatures(signatures, "constructor ", symbol) } else { + writeNewLine() 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) + writeTypeParams(params) } } - if flags&ast.SymbolFlagsInterface != 0 { - declaration = core.Find(symbol.Declarations, ast.IsInterfaceDeclaration) - } - case flags&ast.SymbolFlagsEnum != 0: + } + if flags&ast.SymbolFlagsEnum != 0 { + writeNewLine() b.WriteString("enum ") b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) - case flags&ast.SymbolFlagsModule != 0: + if declaration == nil || ast.IsIdentifier(node) && ast.IsEnumDeclaration(node.Parent) { + declaration = core.Find(symbol.Declarations, ast.IsEnumDeclaration) + } + } + if flags&ast.SymbolFlagsModule != 0 { + writeNewLine() b.WriteString(core.IfElse(symbol.ValueDeclaration != nil && ast.IsSourceFile(symbol.ValueDeclaration), "module ", "namespace ")) b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) - case flags&ast.SymbolFlagsTypeParameter != 0: + if declaration == nil || ast.IsIdentifier(node) && ast.IsModuleDeclaration(node.Parent) { + declaration = core.Find(symbol.Declarations, ast.IsModuleDeclaration) + } + } + if flags&ast.SymbolFlagsTypeParameter != 0 { + writeNewLine() b.WriteString("(type parameter) ") tp := c.GetDeclaredTypeOfSymbol(symbol) b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) @@ -298,40 +371,30 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol b.WriteString(" extends ") b.WriteString(c.TypeToStringEx(cons, container, typeFormatFlags)) } - declaration = core.Find(symbol.Declarations, ast.IsTypeParameterDeclaration) - case flags&ast.SymbolFlagsTypeAlias != 0: + if declaration == nil || ast.IsIdentifier(node) && ast.IsTypeParameterDeclaration(node.Parent) { + declaration = core.Find(symbol.Declarations, ast.IsTypeParameterDeclaration) + } + } + if flags&ast.SymbolFlagsTypeAlias != 0 { + writeNewLine() b.WriteString("type ") b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) - writeTypeParams(&b, c, c.GetTypeAliasTypeParameters(symbol)) + writeTypeParams(c.GetTypeAliasTypeParameters(symbol)) if len(symbol.Declarations) != 0 { b.WriteString(" = ") b.WriteString(c.TypeToStringEx(c.GetDeclaredTypeOfSymbol(symbol), container, typeFormatFlags|checker.TypeFormatFlagsInTypeAlias)) } - declaration = core.Find(symbol.Declarations, ast.IsTypeOrJSTypeAliasDeclaration) - default: - b.WriteString(c.TypeToStringEx(c.GetTypeOfSymbol(symbol), container, typeFormatFlags)) - } - return declaration - } - var writeSymbol func(*ast.Symbol, bool) *ast.Node - writeSymbol = func(symbol *ast.Symbol, isAlias bool) *ast.Node { - var declaration *ast.Node - // Recursively write all meanings of alias - if symbol.Flags&ast.SymbolFlagsAlias != 0 && visitedAliases.AddIfAbsent(symbol) { - if aliasedSymbol := c.GetAliasedSymbol(symbol); aliasedSymbol != c.GetUnknownSymbol() { - declaration = writeSymbol(aliasedSymbol, true /*isAlias*/) + if declaration == nil || ast.IsIdentifier(node) && ast.IsTypeOrJSTypeAliasDeclaration(node.Parent) { + declaration = core.Find(symbol.Declarations, ast.IsTypeOrJSTypeAliasDeclaration) } } - // Write the value meaning, if any - declaration = core.OrElse(declaration, writeSymbolMeaning(symbol, ast.SymbolFlagsValue|ast.SymbolFlagsSignature, isAlias)) - // Write the type meaning, if any - declaration = core.OrElse(declaration, writeSymbolMeaning(symbol, ast.SymbolFlagsType&^ast.SymbolFlagsValue, isAlias)) - // Write the namespace meaning, if any - declaration = core.OrElse(declaration, writeSymbolMeaning(symbol, ast.SymbolFlagsNamespace&^ast.SymbolFlagsValue, isAlias)) - // Return the first declaration + if flags&ast.SymbolFlagsSignature != 0 { + writeNewLine() + b.WriteString(c.TypeToStringEx(c.GetTypeOfSymbol(symbol), container, typeFormatFlags)) + } return declaration } - firstDeclaration := writeSymbol(symbol, false /*isAlias*/) + firstDeclaration := writeSymbol(symbol) return b.String(), firstDeclaration } @@ -392,43 +455,6 @@ func getCallOrNewExpression(node *ast.Node) *ast.Node { return nil } -func writeTypeParams(b *strings.Builder, c *checker.Checker, params []*checker.Type) { - if len(params) > 0 { - b.WriteString("<") - for i, tp := range params { - if i != 0 { - b.WriteString(", ") - } - symbol := tp.Symbol() - b.WriteString(c.SymbolToStringEx(symbol, nil, ast.SymbolFlagsNone, symbolFormatFlags)) - cons := c.GetConstraintOfTypeParameter(tp) - if cons != nil { - b.WriteString(" extends ") - b.WriteString(c.TypeToStringEx(cons, nil, typeFormatFlags)) - } - } - b.WriteString(">") - } -} - -func writeSignatures(b *strings.Builder, c *checker.Checker, signatures []*checker.Signature, container *ast.Node, isAlias bool, prefix string, symbol *ast.Symbol) { - for i, sig := range signatures { - if i != 0 { - b.WriteString("\n") - if isAlias { - b.WriteString("(alias) ") - } - } - if i == 3 && len(signatures) >= 5 { - b.WriteString(fmt.Sprintf("// +%v more overloads", len(signatures)-3)) - break - } - b.WriteString(prefix) - b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) - b.WriteString(c.SignatureToStringEx(sig, container, typeFormatFlags|checker.TypeFormatFlagsWriteCallStyleSignature|checker.TypeFormatFlagsWriteTypeArgumentsOfSignature)) - } -} - func containsTypedefTag(jsdoc *ast.Node) bool { if jsdoc.Kind == ast.KindJSDoc { if tags := jsdoc.AsJSDoc().Tags; tags != nil { @@ -466,19 +492,29 @@ 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 && node.Parent != 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 { + if symbol := node.Symbol(); symbol != nil && node.Parent != nil { + if ast.IsFunctionDeclaration(node) || ast.IsMethodDeclaration(node) || ast.IsMethodSignatureDeclaration(node) || ast.IsConstructorDeclaration(node) || ast.IsConstructSignatureDeclaration(node) { + firstSignature := core.Find(symbol.Declarations, ast.IsFunctionLike) + if firstSignature != nil && node != firstSignature { + if jsDoc := getJSDocOrTag(c, firstSignature); jsDoc != nil { return jsDoc } } } + if 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 } diff --git a/internal/ls/utilities.go b/internal/ls/utilities.go index 4004e50ade1..8c4f5d907fc 100644 --- a/internal/ls/utilities.go +++ b/internal/ls/utilities.go @@ -998,10 +998,10 @@ func getMeaningFromLocation(node *ast.Node) ast.SemanticMeaning { if node.Kind != ast.KindQualifiedName { name = core.IfElse(node.Parent.Kind == ast.KindQualifiedName && node.Parent.AsQualifiedName().Right == node, node.Parent, nil) } - if name == nil || name.Parent.Kind == ast.KindImportEqualsDeclaration { - return ast.SemanticMeaningNamespace + if name != nil && name.Parent.Kind == ast.KindImportEqualsDeclaration { + return ast.SemanticMeaningAll } - return ast.SemanticMeaningAll + return ast.SemanticMeaningNamespace case ast.IsDeclarationName(node): return getMeaningFromDeclaration(parent) case ast.IsEntityName(node) && ast.IsJSDocNameReferenceContext(node): diff --git a/testdata/baselines/reference/fourslash/documentHighlights/qualifiedName_import_declaration_with_variable_entity_names.baseline.jsonc b/testdata/baselines/reference/fourslash/documentHighlights/qualifiedName_import_declaration_with_variable_entity_names.baseline.jsonc index 5015c6bc50b..b84fd967598 100644 --- a/testdata/baselines/reference/fourslash/documentHighlights/qualifiedName_import_declaration_with_variable_entity_names.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/documentHighlights/qualifiedName_import_declaration_with_variable_entity_names.baseline.jsonc @@ -1,11 +1,11 @@ // === documentHighlights === // === /qualifiedName_import_declaration_with_variable_entity_names.ts === // module Alpha { -// export var x = 100; +// export var [|x|] = 100; // } // // module Beta { // import p = Alpha./*HIGHLIGHTS*/[|x|]; // } // -// var x = Alpha.x \ No newline at end of file +// var x = Alpha.[|x|] \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsCommentParsing.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsCommentParsing.baseline index 0316da028af..19daa38e2fd 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsCommentParsing.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsCommentParsing.baseline @@ -315,6 +315,7 @@ // | ```tsx // | (parameter) b: string // | ``` +// | about b // | // | ---------------------------------------------------------------------- // /**@param opt optional parameter*/ @@ -338,6 +339,9 @@ // | ```tsx // | function f1(b: string): any // | ``` +// | fn f1 with number +// | +// | *@param* `b` — about b // | // | ---------------------------------------------------------------------- // @@ -1358,7 +1362,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(parameter) b: string\n```\n" + "value": "```tsx\n(parameter) b: string\n```\nabout b\n" }, "range": { "start": { @@ -1412,7 +1416,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nfunction f1(b: string): any\n```\n" + "value": "```tsx\nfunction f1(b: string): any\n```\nfn f1 with number\n\n*@param* `b` — about b\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/quickInfo/quickInfoOnThis5.baseline b/testdata/baselines/reference/fourslash/quickInfo/quickInfoOnThis5.baseline index 2d7a07ec52f..b45cd719bce 100644 --- a/testdata/baselines/reference/fourslash/quickInfo/quickInfoOnThis5.baseline +++ b/testdata/baselines/reference/fourslash/quickInfo/quickInfoOnThis5.baseline @@ -4,15 +4,18 @@ // num: 0, // f() { // type Y = typeof this; -// ^ +// ^^^^ // | ---------------------------------------------------------------------- -// | No quickinfo at /*1*/. +// | ```tsx +// | { num: number; f(): void; g(this: number): void; } +// | ``` +// | // | ---------------------------------------------------------------------- // type Z = typeof this.num; // ^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | any +// | { num: number; f(): void; g(this: number): void; } // | ``` // | // | ---------------------------------------------------------------------- @@ -22,7 +25,7 @@ // ^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | (parameter) this: number +// | number // | ``` // | // | ---------------------------------------------------------------------- @@ -53,7 +56,7 @@ // ^^^^ // | ---------------------------------------------------------------------- // | ```tsx -// | (parameter) this: number +// | number // | ``` // | // | ---------------------------------------------------------------------- @@ -70,7 +73,22 @@ "Name": "1", "Data": {} }, - "item": null + "item": { + "contents": { + "kind": "markdown", + "value": "```tsx\n{ num: number; f(): void; g(this: number): void; }\n```\n" + }, + "range": { + "start": { + "line": 3, + "character": 24 + }, + "end": { + "line": 3, + "character": 28 + } + } + } }, { "marker": { @@ -85,7 +103,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\nany\n```\n" + "value": "```tsx\n{ num: number; f(): void; g(this: number): void; }\n```\n" }, "range": { "start": { @@ -112,7 +130,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(parameter) this: number\n```\n" + "value": "```tsx\nnumber\n```\n" }, "range": { "start": { @@ -193,7 +211,7 @@ "item": { "contents": { "kind": "markdown", - "value": "```tsx\n(parameter) this: number\n```\n" + "value": "```tsx\nnumber\n```\n" }, "range": { "start": { diff --git a/testdata/baselines/reference/fourslash/signatureHelp/signatureHelpCommentsCommentParsing.baseline b/testdata/baselines/reference/fourslash/signatureHelp/signatureHelpCommentsCommentParsing.baseline index 4d24cd3db6a..8134a9dfdc2 100644 --- a/testdata/baselines/reference/fourslash/signatureHelp/signatureHelpCommentsCommentParsing.baseline +++ b/testdata/baselines/reference/fourslash/signatureHelp/signatureHelpCommentsCommentParsing.baseline @@ -237,6 +237,9 @@ // ^ // | ---------------------------------------------------------------------- // | f1(**b: string**): any +// | - `b: string`: about b + +// | fn f1 with number // | ---------------------------------------------------------------------- // // /** This is subtract function @@ -1134,9 +1137,17 @@ not aligned text about parameter will eat only one space }, { "label": "f1(b: string): any", + "documentation": { + "kind": "markdown", + "value": "fn f1 with number" + }, "parameters": [ { - "label": "b: string" + "label": "b: string", + "documentation": { + "kind": "markdown", + "value": "about b\n" + } } ], "activeParameter": 0 @@ -1172,9 +1183,17 @@ not aligned text about parameter will eat only one space }, { "label": "f1(b: string): any", + "documentation": { + "kind": "markdown", + "value": "fn f1 with number" + }, "parameters": [ { - "label": "b: string" + "label": "b: string", + "documentation": { + "kind": "markdown", + "value": "about b\n" + } } ], "activeParameter": 0 diff --git a/testdata/baselines/reference/submodule/fourslash/findAllReferences/findAllRefsImportEquals.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findAllReferences/findAllRefsImportEquals.baseline.jsonc index d1ae3b9984e..b9378e1090a 100644 --- a/testdata/baselines/reference/submodule/fourslash/findAllReferences/findAllRefsImportEquals.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findAllReferences/findAllRefsImportEquals.baseline.jsonc @@ -1,4 +1,4 @@ // === findAllReferences === // === /findAllRefsImportEquals.ts === // import j = N./*FIND ALL REFS*/[|q|]; -// namespace N { export const q = 0; } \ No newline at end of file +// namespace N { export const [|q|] = 0; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findAllReferences/findAllRefsImportEquals.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findAllReferences/findAllRefsImportEquals.baseline.jsonc.diff deleted file mode 100644 index d35f9569fdc..00000000000 --- a/testdata/baselines/reference/submodule/fourslash/findAllReferences/findAllRefsImportEquals.baseline.jsonc.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.findAllRefsImportEquals.baseline.jsonc -+++ new.findAllRefsImportEquals.baseline.jsonc -@@= skipped -0, +0 lines =@@ - // === findAllReferences === - // === /findAllRefsImportEquals.ts === - // import j = N./*FIND ALL REFS*/[|q|]; --// namespace N { export const [|q|] = 0; } -+// namespace N { export const q = 0; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations7.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations7.baseline.jsonc index b42cbb5171a..af045028fc7 100644 --- a/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations7.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations7.baseline.jsonc @@ -6,7 +6,9 @@ // export module Bar { export interface Baz { } } // export function Bar() { } // } -// --- (line: 7) skipped --- +// +// // module, value and type +// import a2 = Foo.[|Bar|]; @@ -34,7 +36,7 @@ // } // // // module, value and type -// import a2 = Foo.Bar; +// import a2 = Foo.[|Bar|]; @@ -42,9 +44,9 @@ // === /referencesForMergedDeclarations7.ts === // interface Foo { } // module Foo { -// export interface Bar { } +// export interface [|Bar|] { } // export module [|Bar|] { export interface Baz { } } -// export function Bar() { } +// export function [|Bar|]() { } // } // // // module, value and type diff --git a/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations7.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations7.baseline.jsonc.diff deleted file mode 100644 index 3ea193e8ef0..00000000000 --- a/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations7.baseline.jsonc.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.referencesForMergedDeclarations7.baseline.jsonc -+++ new.referencesForMergedDeclarations7.baseline.jsonc -@@= skipped -5, +5 lines =@@ - // export module Bar { export interface Baz { } } - // export function Bar() { } - // } --// --// // module, value and type --// import a2 = Foo.[|Bar|]; -+// --- (line: 7) skipped --- - - - -@@= skipped -30, +28 lines =@@ - // } - // - // // module, value and type --// import a2 = Foo.[|Bar|]; -+// import a2 = Foo.Bar; - - - -@@= skipped -8, +8 lines =@@ - // === /referencesForMergedDeclarations7.ts === - // interface Foo { } - // module Foo { --// export interface [|Bar|] { } -+// export interface Bar { } - // export module [|Bar|] { export interface Baz { } } --// export function [|Bar|]() { } -+// export function Bar() { } - // } - // - // // module, value and type \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc index 01b41d14f3a..5178815aa94 100644 --- a/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc @@ -30,9 +30,9 @@ // === /referencesForMergedDeclarations8.ts === // interface Foo { } // module Foo { -// export interface [|Bar|] { } +// export interface Bar { } // export module [|Bar|] { export interface Baz { } } -// export function [|Bar|]() { } +// export function Bar() { } // } // // // module diff --git a/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc.diff deleted file mode 100644 index 0fc19b2ac9d..00000000000 --- a/testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.referencesForMergedDeclarations8.baseline.jsonc -+++ new.referencesForMergedDeclarations8.baseline.jsonc -@@= skipped -29, +29 lines =@@ - // === /referencesForMergedDeclarations8.ts === - // interface Foo { } - // module Foo { --// export interface Bar { } -+// export interface [|Bar|] { } - // export module [|Bar|] { export interface Baz { } } --// export function Bar() { } -+// export function [|Bar|]() { } - // } - // - // // module \ No newline at end of file