diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 93f61817ab..5afc1d43fa 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -1056,7 +1056,13 @@ func (f *FourslashTest) VerifyBaselineGoToDefinition( } else if result.Location != nil { resultAsLocations = []lsproto.Location{*result.Location} } else if result.DefinitionLinks != nil { - t.Fatalf("Unexpected definition response type at marker '%s': %T", *f.lastKnownMarkerName, result.DefinitionLinks) + // For DefinitionLinks, extract the target locations + resultAsLocations = core.Map(*result.DefinitionLinks, func(link *lsproto.LocationLink) lsproto.Location { + return lsproto.Location{ + Uri: link.TargetUri, + Range: link.TargetSelectionRange, + } + }) } f.addResultToBaseline(t, "goToDefinition", f.getBaselineForLocationsWithFileContents(resultAsLocations, baselineFourslashLocationsOptions{ diff --git a/internal/ls/definition.go b/internal/ls/definition.go index abefaf932e..fd0a55a0bb 100644 --- a/internal/ls/definition.go +++ b/internal/ls/definition.go @@ -12,7 +12,7 @@ import ( "github.com/microsoft/typescript-go/internal/scanner" ) -func (l *LanguageService) ProvideDefinition(ctx context.Context, documentURI lsproto.DocumentUri, position lsproto.Position) (lsproto.DefinitionResponse, error) { +func (l *LanguageService) ProvideDefinition(ctx context.Context, documentURI lsproto.DocumentUri, position lsproto.Position, clientCapabilities *lsproto.DefinitionClientCapabilities) (lsproto.DefinitionResponse, error) { program, file := l.getProgramAndFile(documentURI) node := astnav.GetTouchingPropertyName(file, int(l.converters.LineAndCharacterToPosition(file, position))) if node.Kind == ast.KindSourceFile { @@ -24,13 +24,13 @@ func (l *LanguageService) ProvideDefinition(ctx context.Context, documentURI lsp if node.Kind == ast.KindOverrideKeyword { if sym := getSymbolForOverriddenMember(c, node); sym != nil { - return l.createLocationsFromDeclarations(sym.Declarations), nil + return l.createDefinitionResponse(sym.Declarations, node, file, clientCapabilities), nil } } if ast.IsJumpStatementTarget(node) { if label := getTargetLabel(node.Parent, node.Text()); label != nil { - return l.createLocationsFromDeclarations([]*ast.Node{label}), nil + return l.createDefinitionResponse([]*ast.Node{label}, node, file, clientCapabilities), nil } } @@ -43,7 +43,7 @@ func (l *LanguageService) ProvideDefinition(ctx context.Context, documentURI lsp if node.Kind == ast.KindReturnKeyword || node.Kind == ast.KindYieldKeyword || node.Kind == ast.KindAwaitKeyword { if fn := ast.FindAncestor(node, ast.IsFunctionLikeDeclaration); fn != nil { - return l.createLocationsFromDeclarations([]*ast.Node{fn}), nil + return l.createDefinitionResponse([]*ast.Node{fn}, node, file, clientCapabilities), nil } } @@ -54,7 +54,7 @@ func (l *LanguageService) ProvideDefinition(ctx context.Context, documentURI lsp nonFunctionDeclarations := core.Filter(slices.Clip(declarations), func(node *ast.Node) bool { return !ast.IsFunctionLike(node) }) declarations = append(nonFunctionDeclarations, calledDeclaration) } - return l.createLocationsFromDeclarations(declarations), nil + return l.createDefinitionResponse(declarations, node, file, clientCapabilities), nil } func (l *LanguageService) ProvideTypeDefinition(ctx context.Context, documentURI lsproto.DocumentUri, position lsproto.Position) (lsproto.DefinitionResponse, error) { @@ -99,6 +99,51 @@ func getDeclarationNameForKeyword(node *ast.Node) *ast.Node { return node } +func (l *LanguageService) createDefinitionResponse(declarations []*ast.Node, originNode *ast.Node, originFile *ast.SourceFile, clientCapabilities *lsproto.DefinitionClientCapabilities) lsproto.DefinitionResponse { + // Check if client supports LocationLink + if clientCapabilities != nil && clientCapabilities.LinkSupport != nil && *clientCapabilities.LinkSupport { + return l.createLocationLinksFromDeclarations(declarations, originNode, originFile) + } + // Fall back to traditional Location response + return l.createLocationsFromDeclarations(declarations) +} + +func (l *LanguageService) createLocationLinksFromDeclarations(declarations []*ast.Node, originNode *ast.Node, originFile *ast.SourceFile) lsproto.DefinitionResponse { + someHaveBody := core.Some(declarations, func(node *ast.Node) bool { return node.Body() != nil }) + links := make([]*lsproto.LocationLink, 0, len(declarations)) + + // Calculate origin selection range (the "bound span") + originSelectionRange := l.createLspRangeFromNode(originNode, originFile) + + for _, decl := range declarations { + if !someHaveBody || decl.Body() != nil { + file := ast.GetSourceFileOfNode(decl) + name := core.OrElse(ast.GetNameOfDeclaration(decl), decl) + + // For targetRange, use the full declaration range + var targetRange *lsproto.Range + if decl.Body() != nil { + // For declarations with body, include the full declaration + targetRange = l.createLspRangeFromBounds(scanner.GetTokenPosOfNode(decl, file, false), decl.End(), file) + } else { + // For declarations without body, use the declaration itself + targetRange = l.createLspRangeFromNode(decl, file) + } + + // For targetSelectionRange, use just the name/identifier part + targetSelectionRange := l.createLspRangeFromNode(name, file) + + links = append(links, &lsproto.LocationLink{ + OriginSelectionRange: originSelectionRange, + TargetUri: FileNameToDocumentURI(file.FileName()), + TargetRange: *targetRange, + TargetSelectionRange: *targetSelectionRange, + }) + } + } + return lsproto.LocationOrLocationsOrDefinitionLinksOrNull{DefinitionLinks: &links} +} + func (l *LanguageService) createLocationsFromDeclarations(declarations []*ast.Node) lsproto.DefinitionResponse { locations := make([]lsproto.Location, 0, len(declarations)) for _, decl := range declarations { diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 275e1c92df..931951b1be 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -816,7 +816,7 @@ func (s *Server) handleSignatureHelp(ctx context.Context, languageService *ls.La } func (s *Server) handleDefinition(ctx context.Context, ls *ls.LanguageService, params *lsproto.DefinitionParams) (lsproto.DefinitionResponse, error) { - return ls.ProvideDefinition(ctx, params.TextDocument.Uri, params.Position) + return ls.ProvideDefinition(ctx, params.TextDocument.Uri, params.Position, definitionCapabilities(s.initializeParams)) } func (s *Server) handleTypeDefinition(ctx context.Context, ls *ls.LanguageService, params *lsproto.TypeDefinitionParams) (lsproto.TypeDefinitionResponse, error) { @@ -970,3 +970,30 @@ func getCompletionClientCapabilities(params *lsproto.InitializeParams) *lsproto. } return params.Capabilities.TextDocument.Completion } + +func definitionCapabilities(params *lsproto.InitializeParams) *lsproto.DefinitionClientCapabilities { + if params == nil || params.Capabilities == nil || params.Capabilities.TextDocument == nil { + // Return default capabilities with LinkSupport enabled + return &lsproto.DefinitionClientCapabilities{ + LinkSupport: ptrTo(true), + } + } + + capabilities := params.Capabilities.TextDocument.Definition + if capabilities == nil { + // Return default capabilities with LinkSupport enabled + return &lsproto.DefinitionClientCapabilities{ + LinkSupport: ptrTo(true), + } + } + + // If capabilities exist but LinkSupport is not specified, default to true + if capabilities.LinkSupport == nil { + // Copy existing capabilities and override LinkSupport + result := *capabilities + result.LinkSupport = ptrTo(true) + return &result + } + + return capabilities +} diff --git a/internal/project/untitled_test.go b/internal/project/untitled_test.go index 54d3cfa763..cd0fe90a69 100644 --- a/internal/project/untitled_test.go +++ b/internal/project/untitled_test.go @@ -87,7 +87,7 @@ x++;` assert.Assert(t, len(refs) == 3, "Expected 3 references, got %d", len(refs)) // Also test definition using ProvideDefinition - definition, err := languageService.ProvideDefinition(ctx, uri, lspPosition) + definition, err := languageService.ProvideDefinition(ctx, uri, lspPosition, nil) assert.NilError(t, err) if definition.Locations != nil { t.Logf("Definition found: %d locations", len(*definition.Locations)) diff --git a/testdata/baselines/reference/fourslash/goToDefinition/declarationMapGoToDefinition.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/declarationMapGoToDefinition.baseline.jsonc index f7a410817c..a12955d6fa 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/declarationMapGoToDefinition.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/declarationMapGoToDefinition.baseline.jsonc @@ -1,11 +1,11 @@ // === goToDefinition === -// === /index.ts === -// export class Foo { +// === /indexdef.d.ts === +// export declare class Foo { // member: string; -// [|methodName|](propName: SomeType): void {} -// otherMethod() { -// if (Math.random() > 0.5) { -// return {x: 42}; +// [|methodName|](propName: SomeType): void; +// otherMethod(): { +// x: number; +// y?: undefined; // // --- (line: 7) skipped --- // === /mymodule.ts === diff --git a/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionRelativeSourceRoot.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionRelativeSourceRoot.baseline.jsonc index 7d76808348..5a4c9e8859 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionRelativeSourceRoot.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionRelativeSourceRoot.baseline.jsonc @@ -1,11 +1,11 @@ // === goToDefinition === -// === /index.ts === -// export class Foo { +// === /out/indexdef.d.ts === +// export declare class Foo { // member: string; -// [|methodName|](propName: SomeType): void {} -// otherMethod() { -// if (Math.random() > 0.5) { -// return {x: 42}; +// [|methodName|](propName: SomeType): void; +// otherMethod(): { +// x: number; +// y?: undefined; // // --- (line: 7) skipped --- // === /mymodule.ts === diff --git a/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionSameNameDifferentDirectory.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionSameNameDifferentDirectory.baseline.jsonc index e8f7348bf6..bd7f38ec57 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionSameNameDifferentDirectory.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionSameNameDifferentDirectory.baseline.jsonc @@ -1,10 +1,11 @@ // === goToDefinition === -// === /BaseClass/Source.ts === -// class [|Control|]{ -// constructor(){ -// return; -// } -// // --- (line: 5) skipped --- +// === /BaseClass/Source.d.ts === +// declare class [|Control|] { +// constructor(); +// /** this is a super var */ +// myVar: boolean | 'yeah'; +// } +// //# sourceMappingURL=Source.d.ts.map // === /buttonClass/Source.ts === // // I cannot F12 navigate to Control @@ -18,14 +19,13 @@ // === goToDefinition === -// === /BaseClass/Source.ts === -// class Control{ -// constructor(){ -// return; -// } +// === /BaseClass/Source.d.ts === +// declare class Control { +// constructor(); // /** this is a super var */ -// public [|myVar|]: boolean | 'yeah' = true; +// [|myVar|]: boolean | 'yeah'; // } +// //# sourceMappingURL=Source.d.ts.map // === /buttonClass/Source.ts === // --- (line: 3) skipped --- diff --git a/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsOutOfDateMapping.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsOutOfDateMapping.baseline.jsonc index a7d9041f83..66e44c10de 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsOutOfDateMapping.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/declarationMapsOutOfDateMapping.baseline.jsonc @@ -1,8 +1,9 @@ // === goToDefinition === -// === /home/src/workspaces/project/node_modules/a/src/index.ts === -// export class [|Foo|] { +// === /home/src/workspaces/project/node_modules/a/dist/index.d.ts === +// export declare class [|Foo|] { +// bar: any; // } -// +// //# sourceMappingURL=index.d.ts.map // === /home/src/workspaces/project/index.ts === // import { Foo/*GOTO DEF*/ } from "a"; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionClassConstructors.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionClassConstructors.baseline.jsonc index 9d9d23db29..43c55af3e2 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionClassConstructors.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionClassConstructors.baseline.jsonc @@ -4,10 +4,8 @@ // [|constructor(protected readonly cArg: string) {}|] // } // -// export class [|Derived|] extends Base { -// readonly email = this.cArg.getByLabel('Email') -// readonly password = this.cArg.getByLabel('Password') -// } +// export class Derived extends Base { +// // --- (line: 6) skipped --- // === /main.ts === // import { Derived } from './definitions' @@ -16,14 +14,6 @@ // === goToDefinition === -// === /defInSameFile.ts === -// import { Base } from './definitions' -// class [|SameFile|] extends Base { -// readonly name: string = 'SameFile' -// } -// const SameFile = new /*GOTO DEF*/SameFile(cArg) -// const wrapper = new Base(cArg) - // === /definitions.ts === // export class Base { // [|constructor(protected readonly cArg: string) {}|] @@ -32,12 +22,20 @@ // export class Derived extends Base { // // --- (line: 6) skipped --- +// === /defInSameFile.ts === +// import { Base } from './definitions' +// class SameFile extends Base { +// readonly name: string = 'SameFile' +// } +// const SameFile = new /*GOTO DEF*/SameFile(cArg) +// const wrapper = new Base(cArg) + // === goToDefinition === // === /hasConstructor.ts === // import { Base } from './definitions' -// class [|HasConstructor|] extends Base { +// class HasConstructor extends Base { // [|constructor() {}|] // readonly name: string = ''; // } @@ -47,7 +45,7 @@ // === goToDefinition === // === /definitions.ts === -// export class [|Base|] { +// export class Base { // [|constructor(protected readonly cArg: string) {}|] // } // diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOfClassExpression01.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOfClassExpression01.baseline.jsonc index 4acbe4f97b..6e865a50c5 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOfClassExpression01.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOfClassExpression01.baseline.jsonc @@ -1,6 +1,6 @@ // === goToDefinition === // === /goToDefinitionConstructorOfClassExpression01.ts === -// var x = class [|C|] { +// var x = class C { // [|constructor() { // var other = new /*GOTO DEF*/C; // }|] @@ -13,11 +13,10 @@ // === goToDefinition === // === /goToDefinitionConstructorOfClassExpression01.ts === -// --- (line: 3) skipped --- -// } +// --- (line: 4) skipped --- // } // -// var y = class [|C|] extends x { +// var y = class C extends x { // [|constructor() { // super(); // var other = new /*GOTO DEF*/C; @@ -38,12 +37,11 @@ // } // // var y = class C extends x { -// constructor() { -// super(); -// var other = new C; -// } +// // --- (line: 8) skipped --- + +// --- (line: 11) skipped --- // } -// var z = class [|C|] extends x { +// var z = class C extends x { // m() { // return new /*GOTO DEF*/C; // } @@ -68,7 +66,7 @@ // === goToDefinition === // === /goToDefinitionConstructorOfClassExpression01.ts === -// var [|x|] = class C { +// var x = class C { // [|constructor() { // var other = new C; // }|] @@ -89,11 +87,10 @@ // === goToDefinition === // === /goToDefinitionConstructorOfClassExpression01.ts === -// --- (line: 3) skipped --- -// } +// --- (line: 4) skipped --- // } // -// var [|y|] = class C extends x { +// var y = class C extends x { // [|constructor() { // super(); // var other = new C; @@ -121,17 +118,9 @@ // } // // var y = class C extends x { -// constructor() { -// super(); -// var other = new C; -// } -// } -// var [|z|] = class C extends x { -// m() { -// return new C; -// } -// } -// +// // --- (line: 8) skipped --- + +// --- (line: 18) skipped --- // var x1 = new C(); // var x2 = new x(); // var y1 = new y(); diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOfClassWhenClassIsPrecededByNamespace01.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOfClassWhenClassIsPrecededByNamespace01.baseline.jsonc index a8830b8eaa..da186b2a57 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOfClassWhenClassIsPrecededByNamespace01.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOfClassWhenClassIsPrecededByNamespace01.baseline.jsonc @@ -4,7 +4,7 @@ // export var x; // } // -// class [|Foo|] { +// class Foo { // [|constructor() { // }|] // } diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOverloads.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOverloads.baseline.jsonc index ff9c7c772a..7711784e15 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOverloads.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionConstructorOverloads.baseline.jsonc @@ -34,8 +34,8 @@ // === goToDefinition === // === /goToDefinitionConstructorOverloads.ts === // class ConstructorOverload { -// /*GOTO DEF*/[|constructor();|] -// [|constructor(foo: string);|] +// /*GOTO DEF*/constructor(); +// constructor(foo: string); // [|constructor(foo: any) { }|] // } // diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExpandoClass2.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExpandoClass2.baseline.jsonc index aea5b85d31..d8664cb125 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExpandoClass2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExpandoClass2.baseline.jsonc @@ -2,7 +2,7 @@ // === /index.js === // const Core = {} // -// Core.[|Test|] = class { +// Core.Test = class { // [|constructor() { }|] // } // diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionFunctionOverloads.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionFunctionOverloads.baseline.jsonc index d7038b1f61..680b90fe4f 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionFunctionOverloads.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionFunctionOverloads.baseline.jsonc @@ -36,8 +36,8 @@ // === goToDefinition === // === /goToDefinitionFunctionOverloads.ts === -// function /*GOTO DEF*/[|functionOverload|](value: number); -// function [|functionOverload|](value: string); +// function /*GOTO DEF*/functionOverload(value: number); +// function functionOverload(value: string); // function [|functionOverload|]() {} // // functionOverload(123); diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionFunctionOverloadsInClass.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionFunctionOverloadsInClass.baseline.jsonc index 1acfdd2dfc..ebbeac302a 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionFunctionOverloadsInClass.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionFunctionOverloadsInClass.baseline.jsonc @@ -1,8 +1,8 @@ // === goToDefinition === // === /goToDefinitionFunctionOverloadsInClass.ts === // class clsInOverload { -// static [|fnOverload|](); -// static /*GOTO DEF*/[|fnOverload|](foo: string); +// static fnOverload(); +// static /*GOTO DEF*/fnOverload(foo: string); // static [|fnOverload|](foo: any) { } // public fnOverload(): any; // public fnOverload(foo: string); @@ -17,8 +17,8 @@ // static fnOverload(); // static fnOverload(foo: string); // static fnOverload(foo: any) { } -// public /*GOTO DEF*/[|fnOverload|](): any; -// public [|fnOverload|](foo: string); +// public /*GOTO DEF*/fnOverload(): any; +// public fnOverload(foo: string); // public [|fnOverload|](foo: any) { return "foo" } // // constructor() { } diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionMethodOverloads.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionMethodOverloads.baseline.jsonc index a7d816c66d..305d0daad5 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionMethodOverloads.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionMethodOverloads.baseline.jsonc @@ -81,8 +81,8 @@ // === goToDefinition === // === /goToDefinitionMethodOverloads.ts === // class MethodOverload { -// static /*GOTO DEF*/[|method|](); -// static [|method|](foo: string); +// static /*GOTO DEF*/method(); +// static method(foo: string); // static [|method|](foo?: any) { } // public method(): any; // public method(foo: string); @@ -97,8 +97,8 @@ // static method(); // static method(foo: string); // static method(foo?: any) { } -// public /*GOTO DEF*/[|method|](): any; -// public [|method|](foo: string); +// public /*GOTO DEF*/method(): any; +// public method(foo: string); // public [|method|](foo?: any) { return "foo" } // } // // static method diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc index 9af12dce90..3f1374b9b3 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc @@ -1,6 +1,6 @@ // === goToDefinition === // === /a.js === -// [|module.exports = function [|f|]() {}|] +// module.exports = function [|f|]() {} // === /b.js === // const f = require("./a"); @@ -10,7 +10,7 @@ // === goToDefinition === // === /a.js === -// [|module.exports = function [|f|]() {}|] +// module.exports = function [|f|]() {} // === /bar.ts === // import f = require("./a"); diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment.baseline.jsonc index 234342516d..40c84a24ac 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment.baseline.jsonc @@ -1,6 +1,6 @@ // === goToDefinition === // === /foo.js === // const Bar; -// const [|Foo|] = [|Bar|] = function () {} +// const Foo = [|Bar|] = function () {} // Foo.prototype.bar = function() {} // new Foo/*GOTO DEF*/(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment1.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment1.baseline.jsonc index 30aca9d564..624d76d664 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment1.baseline.jsonc @@ -1,5 +1,5 @@ // === goToDefinition === // === /foo.js === -// const [|Foo|] = module.[|exports|] = function () {} +// const Foo = module.[|exports|] = function () {} // Foo.prototype.bar = function() {} // new Foo/*GOTO DEF*/(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment2.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment2.baseline.jsonc index 8e94c0fc30..411954fa5d 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment2.baseline.jsonc @@ -1,6 +1,6 @@ // === goToDefinition === // === /foo.ts === // const Bar; -// const [|Foo|] = [|Bar|] = function () {} +// const Foo = [|Bar|] = function () {} // Foo.prototype.bar = function() {} // new Foo/*GOTO DEF*/(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment3.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment3.baseline.jsonc index d826f639e3..a0dcc31c6e 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment3.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionVariableAssignment3.baseline.jsonc @@ -1,5 +1,5 @@ // === goToDefinition === // === /foo.ts === -// const [|Foo|] = module.[|exports|] = function () {} +// const Foo = module.[|exports|] = function () {} // Foo.prototype.bar = function() {} // new Foo/*GOTO DEF*/(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinition_super.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinition_super.baseline.jsonc index c79dc5bd9d..cc3f970f82 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/goToDefinition_super.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToDefinition_super.baseline.jsonc @@ -4,7 +4,7 @@ // [|constructor() {}|] // x() {} // } -// class [|B|] extends A {} +// class B extends A {} // class C extends B { // constructor() { // /*GOTO DEF*/super(); diff --git a/testdata/baselines/reference/fourslash/goToDefinition/tsxGoToDefinitionUnionElementType1.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/tsxGoToDefinitionUnionElementType1.baseline.jsonc index 4ed459649f..1c8e7acd58 100644 --- a/testdata/baselines/reference/fourslash/goToDefinition/tsxGoToDefinitionUnionElementType1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/goToDefinition/tsxGoToDefinitionUnionElementType1.baseline.jsonc @@ -10,5 +10,5 @@ // function SFC2(prop: { x: boolean }) { // return