From 6f7a64905419e30f16e916403cbe539c0ff8b140 Mon Sep 17 00:00:00 2001 From: Oleksandr Tarasiuk Date: Fri, 17 Oct 2025 20:42:36 +0300 Subject: [PATCH 1/2] fix(1898): adjust location handling in find-refs --- internal/ls/documenthighlights.go | 2 +- internal/ls/findallreferences.go | 4 + ...nstructorFindAllReferences1.baseline.jsonc | 4 +- ...nstructorFindAllReferences2.baseline.jsonc | 4 +- ...nstructorFindAllReferences4.baseline.jsonc | 4 +- ...AllReferencesDynamicImport1.baseline.jsonc | 2 +- ...ndAllReferencesOfJsonModule.baseline.jsonc | 4 +- .../findAllRefsDeclareClass.baseline.jsonc | 2 +- .../findAllRefsEnumAsNamespace.baseline.jsonc | 4 +- .../findAllRefsExportEquals.baseline.jsonc | 42 +--- ...ndAllRefsForDefaultExport01.baseline.jsonc | 6 +- ...ndAllRefsForDefaultExport02.baseline.jsonc | 13 +- ...orVariableInExtendsClause01.baseline.jsonc | 4 +- ...orVariableInExtendsClause02.baseline.jsonc | 4 +- .../findAllRefsImportType.baseline.jsonc | 5 +- ...findAllRefsInsideTemplates1.baseline.jsonc | 4 +- ...findAllRefsInsideTemplates2.baseline.jsonc | 4 +- .../findAllRefsInsideWithBlock.baseline.jsonc | 7 +- .../findAllRefsOnDecorators.baseline.jsonc | 11 +- .../findAllRefsOnDefinition.baseline.jsonc | 9 +- .../findAllRefsOnDefinition2.baseline.jsonc | 8 +- ...OnPrivateParameterProperty1.baseline.jsonc | 6 +- ...AllRefsPrivateNameAccessors.baseline.jsonc | 36 ++-- ...WithLeadingUnderscoreNames1.baseline.jsonc | 4 +- ...WithLeadingUnderscoreNames2.baseline.jsonc | 4 +- ...WithLeadingUnderscoreNames3.baseline.jsonc | 4 +- ...WithLeadingUnderscoreNames4.baseline.jsonc | 4 +- ...WithLeadingUnderscoreNames5.baseline.jsonc | 8 +- ...WithLeadingUnderscoreNames6.baseline.jsonc | 9 +- ...WithLeadingUnderscoreNames7.baseline.jsonc | 4 +- ...mportType_meaningAtLocation.baseline.jsonc | 6 +- ...indAllRefs_importType_named.baseline.jsonc | 12 +- ...efs_importType_typeofImport.baseline.jsonc | 4 +- .../findAllRefs_jsEnum.baseline.jsonc | 6 +- ...encesAcrossMultipleProjects.baseline.jsonc | 10 +- .../findReferencesJSXTagName2.baseline.jsonc | 4 +- ...IsDefinitionOfArrowFunction.baseline.jsonc | 4 +- ...urrencesIsDefinitionOfClass.baseline.jsonc | 6 +- ...currencesIsDefinitionOfEnum.baseline.jsonc | 4 +- ...encesIsDefinitionOfFunction.baseline.jsonc | 4 +- ...ncesIsDefinitionOfInterface.baseline.jsonc | 4 +- ...nitionOfInterfaceClassMerge.baseline.jsonc | 39 ++-- ...ncesIsDefinitionOfNamespace.baseline.jsonc | 4 +- ...ncesIsDefinitionOfTypeAlias.baseline.jsonc | 4 +- ...encesIsDefinitionOfVariable.baseline.jsonc | 20 +- ...cTypedefTagSemanticMeaning0.baseline.jsonc | 4 +- ...cTypedefTagSemanticMeaning1.baseline.jsonc | 4 +- .../localGetReferences.baseline.jsonc | 181 +++++++++++++++++- .../referencesForAmbients.baseline.jsonc | 39 ++-- .../referencesForClassLocal.baseline.jsonc | 13 +- ...referencesForClassParameter.baseline.jsonc | 10 +- ...encesForDeclarationKeywords.baseline.jsonc | 51 ++--- ...rencesForExpressionKeywords.baseline.jsonc | 134 ++++++++----- ...encesForExternalModuleNames.baseline.jsonc | 7 +- ...erencesForFunctionOverloads.baseline.jsonc | 12 +- .../referencesForGlobals.baseline.jsonc | 20 +- .../referencesForGlobals2.baseline.jsonc | 5 +- .../referencesForGlobals3.baseline.jsonc | 5 +- .../referencesForGlobals4.baseline.jsonc | 5 +- .../referencesForGlobals5.baseline.jsonc | 5 +- ...sForGlobalsInExternalModule.baseline.jsonc | 25 +-- .../referencesForImports.baseline.jsonc | 6 +- ...rencesForMergedDeclarations.baseline.jsonc | 22 ++- ...encesForMergedDeclarations2.baseline.jsonc | 6 +- ...encesForMergedDeclarations4.baseline.jsonc | 33 +++- ...encesForMergedDeclarations6.baseline.jsonc | 7 +- ...encesForMergedDeclarations8.baseline.jsonc | 4 +- .../referencesForModifiers.baseline.jsonc | 20 +- .../referencesForStatic.baseline.jsonc | 24 ++- ...ticsAndMembersWithSameNames.baseline.jsonc | 35 +++- ...StringLiteralPropertyNames3.baseline.jsonc | 12 +- .../referencesForTypeKeywords.baseline.jsonc | 44 +---- .../remoteGetReferences.baseline.jsonc | 175 ++++++++++++++++- .../tsxFindAllReferences4.baseline.jsonc | 7 +- .../tsxFindAllReferences5.baseline.jsonc | 12 +- .../tsxFindAllReferences8.baseline.jsonc | 52 +++-- ...ReferencesUnionElementType1.baseline.jsonc | 4 +- ...ReferencesUnionElementType2.baseline.jsonc | 4 +- 78 files changed, 955 insertions(+), 389 deletions(-) diff --git a/internal/ls/documenthighlights.go b/internal/ls/documenthighlights.go index f0ed4ce0e0..bab0f63b61 100644 --- a/internal/ls/documenthighlights.go +++ b/internal/ls/documenthighlights.go @@ -51,7 +51,7 @@ func (l *LanguageService) ProvideDocumentHighlights(ctx context.Context, documen } func (l *LanguageService) getSemanticDocumentHighlights(ctx context.Context, position int, node *ast.Node, program *compiler.Program, sourceFile *ast.SourceFile) []*lsproto.DocumentHighlight { - options := refOptions{use: referenceUseReferences} + options := refOptions{use: referenceUseNone} referenceEntries := l.getReferencedSymbolsForNode(ctx, position, node, program, []*ast.SourceFile{sourceFile}, options, &collections.Set[string]{}) if referenceEntries == nil { return nil diff --git a/internal/ls/findallreferences.go b/internal/ls/findallreferences.go index 5dc45a5702..4b937d094e 100644 --- a/internal/ls/findallreferences.go +++ b/internal/ls/findallreferences.go @@ -611,6 +611,10 @@ func (l *LanguageService) getReferencedSymbolsForNode(ctx context.Context, posit } } + if options.use == referenceUseReferences || options.use == referenceUseRename { + node = getAdjustedLocation(node, options.use == referenceUseRename, ast.GetSourceFileOfNode(node)) + } + checker, done := program.GetTypeChecker(ctx) defer done() diff --git a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences1.baseline.jsonc index 360000f99d..ee50558949 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences1.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /constructorFindAllReferences1.ts === // export class C { -// /*FIND ALL REFS*/public constructor() { } +// /*FIND ALL REFS*/public [|constructor|]() { } // public foo() { } // } // -// new C().foo(); \ No newline at end of file +// new [|C|]().foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences2.baseline.jsonc index ebe82fac1e..a6c3c02e0f 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences2.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /constructorFindAllReferences2.ts === // export class C { -// /*FIND ALL REFS*/private constructor() { } +// /*FIND ALL REFS*/private [|constructor|]() { } // public foo() { } // } // -// new C().foo(); \ No newline at end of file +// new [|C|]().foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences4.baseline.jsonc index a9c98eaea2..cf4ebb836b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences4.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /constructorFindAllReferences4.ts === // export class C { -// /*FIND ALL REFS*/protected constructor() { } +// /*FIND ALL REFS*/protected [|constructor|]() { } // public foo() { } // } // -// new C().foo(); \ No newline at end of file +// new [|C|]().foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesDynamicImport1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesDynamicImport1.baseline.jsonc index cf2a41e027..af501fac1d 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesDynamicImport1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesDynamicImport1.baseline.jsonc @@ -18,7 +18,7 @@ // === /foo.ts === // export function foo() { return "foo"; } // import("./foo") -// /*FIND ALL REFS*/var x = import("./foo") +// /*FIND ALL REFS*/var [|x|] = import("./foo") diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesOfJsonModule.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesOfJsonModule.baseline.jsonc index b573d0da76..2560521003 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesOfJsonModule.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesOfJsonModule.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /foo.ts === -// /*FIND ALL REFS*/import settings from "./settings.json"; -// settings; +// /*FIND ALL REFS*/import [|settings|] from "./settings.json"; +// [|settings|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsDeclareClass.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsDeclareClass.baseline.jsonc index a0e7b903e9..4b37e613d9 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsDeclareClass.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsDeclareClass.baseline.jsonc @@ -1,6 +1,6 @@ // === findAllReferences === // === /findAllRefsDeclareClass.ts === -// /*FIND ALL REFS*/declare class C { +// /*FIND ALL REFS*/declare class [|C|] { // static m(): void; // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsEnumAsNamespace.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsEnumAsNamespace.baseline.jsonc index 459666328e..4bd7d96f89 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsEnumAsNamespace.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsEnumAsNamespace.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsEnumAsNamespace.ts === -// /*FIND ALL REFS*/enum E { A } -// let e: E.A; +// /*FIND ALL REFS*/enum [|E|] { A } +// let e: [|E|].A; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc index 3734653d91..fad3a861ed 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc @@ -1,44 +1,4 @@ // === findAllReferences === // === /a.ts === // type /*FIND ALL REFS*/[|T|] = number; -// export = T; - - - -// === findAllReferences === -// === /a.ts === -// type T = number; -// /*FIND ALL REFS*/[|export|] = T; - -// === /b.ts === -// import T = require("[|./a|]"); - - - -// === findAllReferences === -// === /a.ts === -// type T = number; -// export = /*FIND ALL REFS*/[|T|]; - -// === /b.ts === -// import [|T|] = require("./a"); - - - -// === findAllReferences === -// === /a.ts === -// type [|T|] = number; -// export = [|T|]; - -// === /b.ts === -// import /*FIND ALL REFS*/[|T|] = require("./a"); - - - -// === findAllReferences === -// === /a.ts === -// type [|T|] = number; -// [|export|] = [|T|]; - -// === /b.ts === -// import [|T|] = require("/*FIND ALL REFS*/[|./a|]"); \ No newline at end of file +// export = T; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport01.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport01.baseline.jsonc index a7e3cdedf6..f936ce1ea0 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport01.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport01.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsForDefaultExport01.ts === -// /*FIND ALL REFS*/export default class DefaultExportedClass { +// /*FIND ALL REFS*/export default class [|DefaultExportedClass|] { // } // -// var x: DefaultExportedClass; +// var x: [|DefaultExportedClass|]; // -// var y = new DefaultExportedClass; +// var y = new [|DefaultExportedClass|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport02.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport02.baseline.jsonc index 00007d570f..6f553cd654 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport02.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport02.baseline.jsonc @@ -1,10 +1,15 @@ // === findAllReferences === // === /findAllRefsForDefaultExport02.ts === -// /*FIND ALL REFS*/export default function DefaultExportedFunction() { -// return DefaultExportedFunction; +// /*FIND ALL REFS*/export default function [|DefaultExportedFunction|]() { +// return [|DefaultExportedFunction|]; // } // -// // --- (line: 5) skipped --- +// var x: typeof [|DefaultExportedFunction|]; +// +// var y = [|DefaultExportedFunction|](); +// +// namespace DefaultExportedFunction { +// } @@ -74,7 +79,7 @@ // // var y = DefaultExportedFunction(); // -// /*FIND ALL REFS*/namespace DefaultExportedFunction { +// /*FIND ALL REFS*/namespace [|DefaultExportedFunction|] { // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause01.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause01.baseline.jsonc index e63980b63d..4064c53b01 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause01.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause01.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsForVariableInExtendsClause01.ts === -// /*FIND ALL REFS*/var Base = class { }; -// class C extends Base { } +// /*FIND ALL REFS*/var [|Base|] = class { }; +// class C extends [|Base|] { } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause02.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause02.baseline.jsonc index 635f9d38cb..692886f089 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause02.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause02.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /findAllRefsForVariableInExtendsClause02.ts === -// /*FIND ALL REFS*/interface Base { } +// /*FIND ALL REFS*/interface [|Base|] { } // namespace n { // var Base = class { }; -// interface I extends Base { } +// interface I extends [|Base|] { } // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc index d7491ce03c..479db50506 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc @@ -1,7 +1,10 @@ // === findAllReferences === // === /a.js === // module.exports = 0; -// /*FIND ALL REFS*/export type N = number; +// /*FIND ALL REFS*/export type [|N|] = number; + +// === /b.js === +// type T = import("./a").[|N|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates1.baseline.jsonc index d70f81e56a..b433189590 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates1.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsInsideTemplates1.ts === -// /*FIND ALL REFS*/var x = 10; -// var y = `${ x } ${ x }` +// /*FIND ALL REFS*/var [|x|] = 10; +// var y = `${ [|x|] } ${ [|x|] }` diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates2.baseline.jsonc index 9d2e0aa91d..8ca4acea24 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates2.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsInsideTemplates2.ts === -// /*FIND ALL REFS*/function f(...rest: any[]) { } -// f `${ f } ${ f }` +// /*FIND ALL REFS*/function [|f|](...rest: any[]) { } +// [|f|] `${ [|f|] } ${ [|f|] }` diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideWithBlock.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideWithBlock.baseline.jsonc index 118d6ab98c..19b1d2ba3d 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideWithBlock.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideWithBlock.baseline.jsonc @@ -1,10 +1,13 @@ // === findAllReferences === // === /findAllRefsInsideWithBlock.ts === -// /*FIND ALL REFS*/var x = 0; +// /*FIND ALL REFS*/var [|x|] = 0; // // with ({}) { // var y = x; // Reference of x here should not be picked -// // --- (line: 5) skipped --- +// y++; // also reference for y should be ignored +// } +// +// [|x|] = [|x|] + 1; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDecorators.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDecorators.baseline.jsonc index 8cef99ffaa..a362eb779e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDecorators.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDecorators.baseline.jsonc @@ -1,9 +1,16 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/function decorator(target) { +// /*FIND ALL REFS*/function [|decorator|](target) { // return target; // } -// decorator(); +// [|decorator|](); + +// === /b.ts === +// @[|decorator|] @[|decorator|]("again") +// class C { +// @[|decorator|] +// method() {} +// } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition.baseline.jsonc index c27ee5460e..1ce9c15254 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition.baseline.jsonc @@ -4,12 +4,19 @@ // // } // -// /*FIND ALL REFS*/public start(){ +// /*FIND ALL REFS*/public [|start|](){ // return this; // } // // // --- (line: 11) skipped --- +// === /findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition2.baseline.jsonc index 97030d14d0..948c4ea942 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition2.baseline.jsonc @@ -2,11 +2,17 @@ // === /findAllRefsOnDefinition2-import.ts === // export module Test{ // -// /*FIND ALL REFS*/export interface start { } +// /*FIND ALL REFS*/export interface [|start|] { } // // export interface stop { } // } +// === /findAllRefsOnDefinition2.ts === +// import Second = require("./findAllRefsOnDefinition2-import"); +// +// var start: Second.Test.[|start|]; +// var stop: Second.Test.stop; + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnPrivateParameterProperty1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnPrivateParameterProperty1.baseline.jsonc index a353dee861..ff228b6549 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnPrivateParameterProperty1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnPrivateParameterProperty1.baseline.jsonc @@ -1,11 +1,13 @@ // === findAllReferences === // === /findAllRefsOnPrivateParameterProperty1.ts === // class ABCD { -// constructor(private x: number, public y: number, /*FIND ALL REFS*/private z: number) { +// constructor(private x: number, public y: number, /*FIND ALL REFS*/private [|z|]: number) { // } // // func() { -// // --- (line: 6) skipped --- +// return this.[|z|]; +// } +// } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsPrivateNameAccessors.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsPrivateNameAccessors.baseline.jsonc index 450a19bbe9..590bc48285 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsPrivateNameAccessors.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsPrivateNameAccessors.baseline.jsonc @@ -1,11 +1,14 @@ // === findAllReferences === // === /findAllRefsPrivateNameAccessors.ts === // class C { -// /*FIND ALL REFS*/get #foo(){ return 1; } -// set #foo(value: number){ } +// /*FIND ALL REFS*/get [|#foo|](){ return 1; } +// set [|#foo|](value: number){ } // constructor() { -// this.#foo(); -// // --- (line: 6) skipped --- +// this.[|#foo|](); +// } +// } +// class D extends C { +// // --- (line: 9) skipped --- @@ -26,12 +29,14 @@ // === findAllReferences === // === /findAllRefsPrivateNameAccessors.ts === // class C { -// get #foo(){ return 1; } -// /*FIND ALL REFS*/set #foo(value: number){ } +// get [|#foo|](){ return 1; } +// /*FIND ALL REFS*/set [|#foo|](value: number){ } // constructor() { -// this.#foo(); +// this.[|#foo|](); // } -// // --- (line: 7) skipped --- +// } +// class D extends C { +// // --- (line: 9) skipped --- @@ -69,10 +74,10 @@ // } // } // class E { -// /*FIND ALL REFS*/get #foo(){ return 1; } -// set #foo(value: number){ } +// /*FIND ALL REFS*/get [|#foo|](){ return 1; } +// set [|#foo|](value: number){ } // constructor() { -// this.#foo(); +// this.[|#foo|](); // } // } @@ -95,13 +100,14 @@ // === findAllReferences === // === /findAllRefsPrivateNameAccessors.ts === -// --- (line: 12) skipped --- +// --- (line: 11) skipped --- +// } // } // class E { -// get #foo(){ return 1; } -// /*FIND ALL REFS*/set #foo(value: number){ } +// get [|#foo|](){ return 1; } +// /*FIND ALL REFS*/set [|#foo|](value: number){ } // constructor() { -// this.#foo(); +// this.[|#foo|](); // } // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc index 275b2415e7..38bc2fe401 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames1.ts === // class Foo { -// /*FIND ALL REFS*/public _bar() { return 0; } +// /*FIND ALL REFS*/public [|_bar|]() { return 0; } // } // // var x: Foo; -// x._bar; +// x.[|_bar|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc index 0627485bd8..def74d86dd 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames2.ts === // class Foo { -// /*FIND ALL REFS*/public __bar() { return 0; } +// /*FIND ALL REFS*/public [|__bar|]() { return 0; } // } // // var x: Foo; -// x.__bar; +// x.[|__bar|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc index ba2b00295d..b1c169241e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames3.ts === // class Foo { -// /*FIND ALL REFS*/public ___bar() { return 0; } +// /*FIND ALL REFS*/public [|___bar|]() { return 0; } // } // // var x: Foo; -// x.___bar; +// x.[|___bar|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc index 4c995ceb99..ba04ab6467 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames4.ts === // class Foo { -// /*FIND ALL REFS*/public ____bar() { return 0; } +// /*FIND ALL REFS*/public [|____bar|]() { return 0; } // } // // var x: Foo; -// x.____bar; +// x.[|____bar|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc index 68b9058871..18e8118cfb 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc @@ -3,11 +3,15 @@ // class Foo { // public _bar; // public __bar; -// /*FIND ALL REFS*/public ___bar; +// /*FIND ALL REFS*/public [|___bar|]; // public ____bar; // } // -// // --- (line: 8) skipped --- +// var x: Foo; +// x._bar; +// x.__bar; +// x.[|___bar|]; +// x.____bar; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc index 5cea661dd5..371052938b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc @@ -2,11 +2,16 @@ // === /findAllRefsWithLeadingUnderscoreNames6.ts === // class Foo { // public _bar; -// /*FIND ALL REFS*/public __bar; +// /*FIND ALL REFS*/public [|__bar|]; // public ___bar; // public ____bar; // } -// // --- (line: 7) skipped --- +// +// var x: Foo; +// x._bar; +// x.[|__bar|]; +// x.___bar; +// x.____bar; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc index 761a4899a3..46abb67ad4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames7.ts === -// /*FIND ALL REFS*/function __foo() { -// __foo(); +// /*FIND ALL REFS*/function [|__foo|]() { +// [|__foo|](); // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_meaningAtLocation.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_meaningAtLocation.baseline.jsonc index 41f5903eec..a39cb0e4e4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_meaningAtLocation.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_meaningAtLocation.baseline.jsonc @@ -1,8 +1,12 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/export type T = 0; +// /*FIND ALL REFS*/export type [|T|] = 0; // export const T = 0; +// === /b.ts === +// const x: import("./a").[|T|] = 0; +// const x: typeof import("./a").T = 0; + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_named.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_named.baseline.jsonc index 55c3e1d76c..2d8b8e38a2 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_named.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_named.baseline.jsonc @@ -1,8 +1,12 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/export type T = number; +// /*FIND ALL REFS*/export type [|T|] = number; // export type U = string; +// === /b.ts === +// const x: import("./a").[|T|] = 0; +// const x: import("./a").U = 0; + // === findAllReferences === @@ -19,7 +23,11 @@ // === findAllReferences === // === /a.ts === // export type T = number; -// /*FIND ALL REFS*/export type U = string; +// /*FIND ALL REFS*/export type [|U|] = string; + +// === /b.ts === +// const x: import("./a").T = 0; +// const x: import("./a").[|U|] = 0; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_typeofImport.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_typeofImport.baseline.jsonc index 33e67cb257..b1dc44da2b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_typeofImport.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_typeofImport.baseline.jsonc @@ -1,6 +1,6 @@ // === findAllReferences === // === /b.ts === -// /*FIND ALL REFS*/const x: typeof import("./a") = { x: 0 }; +// /*FIND ALL REFS*/const [|x|]: typeof import("./a") = { x: 0 }; // const y: typeof import("./a") = { x: 0 }; @@ -15,7 +15,7 @@ // === findAllReferences === // === /b.ts === // const x: typeof import("./a") = { x: 0 }; -// /*FIND ALL REFS*/const y: typeof import("./a") = { x: 0 }; +// /*FIND ALL REFS*/const [|y|]: typeof import("./a") = { x: 0 }; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_jsEnum.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_jsEnum.baseline.jsonc index 14c23a2f5f..77cd5d46e7 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_jsEnum.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_jsEnum.baseline.jsonc @@ -1,10 +1,10 @@ // === findAllReferences === // === /a.js === // /** @enum {string} */ -// /*FIND ALL REFS*/const E = { A: "" }; -// E["A"]; +// /*FIND ALL REFS*/const [|E|] = { A: "" }; +// [|E|]["A"]; // /** @type {E} */ -// const e = E.A; +// const e = [|E|].A; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findReferencesAcrossMultipleProjects.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findReferencesAcrossMultipleProjects.baseline.jsonc index ec494e6888..2b80f1d44d 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findReferencesAcrossMultipleProjects.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findReferencesAcrossMultipleProjects.baseline.jsonc @@ -1,6 +1,14 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/var x: number; +// /*FIND ALL REFS*/var [|x|]: number; + +// === /b.ts === +// /// +// [|x|]++; + +// === /c.ts === +// /// +// [|x|]++; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findReferencesJSXTagName2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findReferencesJSXTagName2.baseline.jsonc index a3b65b722a..aac6454a10 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findReferencesJSXTagName2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findReferencesJSXTagName2.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /index.tsx === -// /*FIND ALL REFS*/const obj = {Component: () =>
}; -// const element = ; +// /*FIND ALL REFS*/const [|obj|] = {Component: () =>
}; +// const element = <[|obj|].Component/>; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc index d47a9cd615..45d4e9154c 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfArrowFunction.ts === -// /*FIND ALL REFS*/var f = x => x + 1; -// f(12); +// /*FIND ALL REFS*/var [|f|] = x => x + 1; +// [|f|](12); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfClass.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfClass.baseline.jsonc index 66aa26aa9b..250b824282 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfClass.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfClass.baseline.jsonc @@ -1,10 +1,12 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfClass.ts === -// /*FIND ALL REFS*/class C { +// /*FIND ALL REFS*/class [|C|] { // n: number; // constructor() { // this.n = 12; -// // --- (line: 5) skipped --- +// } +// } +// let c = new [|C|](); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfEnum.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfEnum.baseline.jsonc index e0b28c98c1..fc51da704e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfEnum.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfEnum.baseline.jsonc @@ -1,10 +1,10 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfEnum.ts === -// /*FIND ALL REFS*/enum E { +// /*FIND ALL REFS*/enum [|E|] { // First, // Second // } -// let first = E.First; +// let first = [|E|].First; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfFunction.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfFunction.baseline.jsonc index 93a9afb726..fb25553e8f 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfFunction.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfFunction.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfFunction.ts === -// /*FIND ALL REFS*/function func(x: number) { +// /*FIND ALL REFS*/function [|func|](x: number) { // } -// func(x) +// [|func|](x) diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterface.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterface.baseline.jsonc index 1d3cb221db..3465e29156 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterface.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterface.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfInterface.ts === -// /*FIND ALL REFS*/interface I { +// /*FIND ALL REFS*/interface [|I|] { // p: number; // } -// let i: I = { p: 12 }; +// let i: [|I|] = { p: 12 }; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc index 0482d27845..06b881e54c 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc @@ -1,10 +1,18 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === -// /*FIND ALL REFS*/interface Numbers { +// /*FIND ALL REFS*/interface [|Numbers|] { // p: number; // } -// interface Numbers { -// // --- (line: 5) skipped --- +// interface [|Numbers|] { +// m: number; +// } +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); @@ -28,14 +36,19 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === -// interface Numbers { +// interface [|Numbers|] { // p: number; // } -// /*FIND ALL REFS*/interface Numbers { +// /*FIND ALL REFS*/interface [|Numbers|] { // m: number; // } -// class Numbers { -// // --- (line: 8) skipped --- +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); @@ -59,15 +72,19 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === -// --- (line: 3) skipped --- -// interface Numbers { +// interface [|Numbers|] { +// p: number; +// } +// interface [|Numbers|] { // m: number; // } -// /*FIND ALL REFS*/class Numbers { +// /*FIND ALL REFS*/class [|Numbers|] { // f(n: number) { // return this.p + this.m + n; // } -// // --- (line: 11) skipped --- +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc index bba65c8c91..1ea8914044 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfNamespace.ts === -// /*FIND ALL REFS*/namespace Numbers { +// /*FIND ALL REFS*/namespace [|Numbers|] { // export var n = 12; // } -// let x = Numbers.n + 1; +// let x = [|Numbers|].n + 1; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc index 588c2d0769..7dfa3f7a3b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfTypeAlias.ts === -// /*FIND ALL REFS*/type Alias= number; -// let n: Alias = 12; +// /*FIND ALL REFS*/type [|Alias|]= number; +// let n: [|Alias|] = 12; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfVariable.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfVariable.baseline.jsonc index 3e18059318..9ee407ef13 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfVariable.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfVariable.baseline.jsonc @@ -1,10 +1,22 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfVariable.ts === -// /*FIND ALL REFS*/var x = 0; -// var assignmentRightHandSide = x; -// var assignmentRightHandSide2 = 1 + x; +// /*FIND ALL REFS*/var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; // -// // --- (line: 5) skipped --- +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning0.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning0.baseline.jsonc index 662ccb87d3..db5fd49cb4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning0.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning0.baseline.jsonc @@ -19,9 +19,9 @@ // === findAllReferences === // === /a.js === // /** @typedef {number} T */ -// /*FIND ALL REFS*/const T = 1; +// /*FIND ALL REFS*/const [|T|] = 1; // /** @type {T} */ -// const n = T; +// const n = [|T|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning1.baseline.jsonc index 72f2f31da3..f67cbe6091 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning1.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /a.js === // /** @typedef {number} */ -// /*FIND ALL REFS*/const T = 1; +// /*FIND ALL REFS*/const [|T|] = 1; // /** @type {T} */ -// const n = T; +// const n = [|T|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/localGetReferences.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/localGetReferences.baseline.jsonc index 3dd7634782..11a750c0a7 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/localGetReferences.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/localGetReferences.baseline.jsonc @@ -2,11 +2,71 @@ // === /localGetReferences_1.ts === // // Comment Refence Test: globalVar // // References to a variable declared in global. -// /*FIND ALL REFS*/var globalVar: number = 2; +// /*FIND ALL REFS*/var [|globalVar|]: number = 2; // // class fooCls { // // References to static variable declared in a class. -// // --- (line: 7) skipped --- +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// // --- (line: 17) skipped --- + +// --- (line: 25) skipped --- +// +// //Increments +// fooCls.clsSVar++; +// [|globalVar|]++; +// modTest.modVar++; +// fnVar++; +// +// // --- (line: 33) skipped --- + +// --- (line: 38) skipped --- +// export var modVar:number; +// +// //Increments +// [|globalVar|]++; +// fooCls.clsSVar++; +// modVar++; +// +// // --- (line: 46) skipped --- + +// --- (line: 50) skipped --- +// static boo = foo; +// +// //Increments +// [|globalVar|]++; +// fooCls.clsSVar++; +// modVar++; +// } +// // --- (line: 58) skipped --- + +// --- (line: 65) skipped --- +// +// //Arguments +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// // --- (line: 83) skipped --- @@ -88,11 +148,59 @@ // // class fooCls { // // References to static variable declared in a class. -// /*FIND ALL REFS*/static clsSVar = 1; +// /*FIND ALL REFS*/static [|clsSVar|] = 1; // // References to a variable declared in a class. // clsVar = 1; // -// // --- (line: 11) skipped --- +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.[|clsSVar|]++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// // --- (line: 19) skipped --- + +// --- (line: 24) skipped --- +// var fnVar = 1; +// +// //Increments +// fooCls.[|clsSVar|]++; +// globalVar++; +// modTest.modVar++; +// fnVar++; +// // --- (line: 32) skipped --- + +// --- (line: 39) skipped --- +// +// //Increments +// globalVar++; +// fooCls.[|clsSVar|]++; +// modVar++; +// +// class testCls { +// // --- (line: 47) skipped --- + +// --- (line: 51) skipped --- +// +// //Increments +// globalVar++; +// fooCls.[|clsSVar|]++; +// modVar++; +// } +// +// // --- (line: 59) skipped --- + +// --- (line: 70) skipped --- +// foo(globalVar); +// +// //Increments +// fooCls.[|clsSVar|]++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// // --- (line: 78) skipped --- @@ -183,11 +291,17 @@ // // References to a variable declared in a class. // clsVar = 1; // -// constructor (/*FIND ALL REFS*/public clsParam: number) { +// constructor (/*FIND ALL REFS*/public [|clsParam|]: number) { // //Increments // globalVar++; // this.clsVar++; -// // --- (line: 15) skipped --- +// fooCls.clsSVar++; +// // References to a class parameter. +// this.[|clsParam|]++; +// modTest.modVar++; +// } +// } +// // --- (line: 21) skipped --- @@ -390,12 +504,55 @@ // } // // // References to a function parameter. -// /*FIND ALL REFS*/function foo(x: number) { +// /*FIND ALL REFS*/function [|foo|](x: number) { // // References to a variable declared in a function. // var fnVar = 1; // // // --- (line: 27) skipped --- +// --- (line: 43) skipped --- +// modVar++; +// +// class testCls { +// static boo = [|foo|]; +// } +// +// function testFn(){ +// static boo = [|foo|]; +// +// //Increments +// globalVar++; +// fooCls.clsSVar++; +// modVar++; +// } +// +// module testMod { +// var boo = [|foo|]; +// } +// } +// +// // --- (line: 64) skipped --- + +// --- (line: 67) skipped --- +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// [|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// [|foo|] = [|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// // --- (line: 85) skipped --- + // === findAllReferences === @@ -485,11 +642,17 @@ // // References to a function parameter. // function foo(x: number) { // // References to a variable declared in a function. -// /*FIND ALL REFS*/var fnVar = 1; +// /*FIND ALL REFS*/var [|fnVar|] = 1; // // //Increments // fooCls.clsSVar++; -// // --- (line: 29) skipped --- +// globalVar++; +// modTest.modVar++; +// [|fnVar|]++; +// +// //Return +// return x++; +// // --- (line: 35) skipped --- diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForAmbients.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForAmbients.baseline.jsonc index b70c6b36cd..9643fbc873 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForAmbients.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForAmbients.baseline.jsonc @@ -1,10 +1,15 @@ // === findAllReferences === // === /referencesForAmbients.ts === -// /*FIND ALL REFS*/declare module "foo" { +// /*FIND ALL REFS*/declare module "[|foo|]" { // var f: number; // } // -// // --- (line: 5) skipped --- +// declare module "bar" { +// export import foo = require("[|foo|]"); +// var f2: typeof foo.f; +// } +// +// // --- (line: 10) skipped --- @@ -26,11 +31,16 @@ // === findAllReferences === // === /referencesForAmbients.ts === // declare module "foo" { -// /*FIND ALL REFS*/var f: number; +// /*FIND ALL REFS*/var [|f|]: number; // } // // declare module "bar" { -// // --- (line: 6) skipped --- +// export import foo = require("foo"); +// var f2: typeof foo.[|f|]; +// } +// +// declare module "baz" { +// // --- (line: 11) skipped --- @@ -56,11 +66,15 @@ // var f: number; // } // -// /*FIND ALL REFS*/declare module "bar" { +// /*FIND ALL REFS*/declare module "[|bar|]" { // export import foo = require("foo"); // var f2: typeof foo.f; // } -// // --- (line: 9) skipped --- +// +// declare module "baz" { +// import bar = require("[|bar|]"); +// var f2: typeof bar.foo; +// } @@ -89,11 +103,14 @@ // } // // declare module "bar" { -// /*FIND ALL REFS*/export import foo = require("foo"); -// var f2: typeof foo.f; +// /*FIND ALL REFS*/export import [|foo|] = require("foo"); +// var f2: typeof [|foo|].f; // } // -// // --- (line: 10) skipped --- +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.[|foo|]; +// } @@ -170,8 +187,8 @@ // } // // declare module "baz" { -// /*FIND ALL REFS*/import bar = require("bar"); -// var f2: typeof bar.foo; +// /*FIND ALL REFS*/import [|bar|] = require("bar"); +// var f2: typeof [|bar|].foo; // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassLocal.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassLocal.baseline.jsonc index 6eba7c7b66..1644f2ca65 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassLocal.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassLocal.baseline.jsonc @@ -3,11 +3,18 @@ // var n = 14; // // class foo { -// /*FIND ALL REFS*/private n = 0; +// /*FIND ALL REFS*/private [|n|] = 0; // // public bar() { -// this.n = 9; -// // --- (line: 8) skipped --- +// this.[|n|] = 9; +// } +// +// constructor() { +// this.[|n|] = 4; +// } +// +// public bar2() { +// // --- (line: 15) skipped --- diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassParameter.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassParameter.baseline.jsonc index e5b662d166..b1565d329a 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassParameter.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassParameter.baseline.jsonc @@ -5,11 +5,17 @@ // class p { } // // class foo { -// constructor (/*FIND ALL REFS*/public p: any) { +// constructor (/*FIND ALL REFS*/public [|p|]: any) { // } // // public f(p) { -// // --- (line: 10) skipped --- +// this.[|p|] = p; +// } +// +// } +// +// var n = new foo(undefined); +// n.[|p|] = null; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForDeclarationKeywords.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForDeclarationKeywords.baseline.jsonc index 1eaba5ce64..f690bc1ada 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForDeclarationKeywords.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForDeclarationKeywords.baseline.jsonc @@ -2,7 +2,7 @@ // === /referencesForDeclarationKeywords.ts === // class Base {} // interface Implemented1 {} -// /*FIND ALL REFS*/class C1 extends Base implements Implemented1 { +// /*FIND ALL REFS*/class [|C1|] extends Base implements Implemented1 { // get e() { return 1; } // set e(v) {} // } @@ -12,21 +12,25 @@ // === findAllReferences === // === /referencesForDeclarationKeywords.ts === -// class Base {} +// class [|Base|] {} // interface Implemented1 {} -// class C1 /*FIND ALL REFS*/extends Base implements Implemented1 { +// class C1 /*FIND ALL REFS*/extends [|Base|] implements Implemented1 { // get e() { return 1; } // set e(v) {} // } -// // --- (line: 7) skipped --- +// interface I1 extends [|Base|] { } +// type T = { } +// enum E { } +// namespace N { } +// // --- (line: 11) skipped --- // === findAllReferences === // === /referencesForDeclarationKeywords.ts === // class Base {} -// interface Implemented1 {} -// class C1 extends Base /*FIND ALL REFS*/implements Implemented1 { +// interface [|Implemented1|] {} +// class C1 extends Base /*FIND ALL REFS*/implements [|Implemented1|] { // get e() { return 1; } // set e(v) {} // } @@ -50,11 +54,12 @@ // class Base {} // interface Implemented1 {} // class C1 extends Base implements Implemented1 { -// /*FIND ALL REFS*/get e() { return 1; } -// set e(v) {} +// /*FIND ALL REFS*/get [|e|]() { return 1; } +// set [|e|](v) {} // } // interface I1 extends Base { } -// // --- (line: 8) skipped --- +// type T = { } +// // --- (line: 9) skipped --- @@ -63,8 +68,8 @@ // class Base {} // interface Implemented1 {} // class C1 extends Base implements Implemented1 { -// get e() { return 1; } -// /*FIND ALL REFS*/set e(v) {} +// get [|e|]() { return 1; } +// /*FIND ALL REFS*/set [|e|](v) {} // } // interface I1 extends Base { } // type T = { } @@ -78,7 +83,7 @@ // get e() { return 1; } // set e(v) {} // } -// /*FIND ALL REFS*/interface I1 extends Base { } +// /*FIND ALL REFS*/interface [|I1|] extends Base { } // type T = { } // enum E { } // namespace N { } @@ -88,11 +93,13 @@ // === findAllReferences === // === /referencesForDeclarationKeywords.ts === -// --- (line: 3) skipped --- +// class [|Base|] {} +// interface Implemented1 {} +// class C1 extends [|Base|] implements Implemented1 { // get e() { return 1; } // set e(v) {} // } -// interface I1 /*FIND ALL REFS*/extends Base { } +// interface I1 /*FIND ALL REFS*/extends [|Base|] { } // type T = { } // enum E { } // namespace N { } @@ -116,7 +123,7 @@ // set e(v) {} // } // interface I1 extends Base { } -// /*FIND ALL REFS*/type T = { } +// /*FIND ALL REFS*/type [|T|] = { } // enum E { } // namespace N { } // module M { } @@ -130,7 +137,7 @@ // } // interface I1 extends Base { } // type T = { } -// /*FIND ALL REFS*/enum E { } +// /*FIND ALL REFS*/enum [|E|] { } // namespace N { } // module M { } // function fn() {} @@ -144,7 +151,7 @@ // interface I1 extends Base { } // type T = { } // enum E { } -// /*FIND ALL REFS*/namespace N { } +// /*FIND ALL REFS*/namespace [|N|] { } // module M { } // function fn() {} // var x; @@ -158,7 +165,7 @@ // type T = { } // enum E { } // namespace N { } -// /*FIND ALL REFS*/module M { } +// /*FIND ALL REFS*/module [|M|] { } // function fn() {} // var x; // let y; @@ -172,7 +179,7 @@ // enum E { } // namespace N { } // module M { } -// /*FIND ALL REFS*/function fn() {} +// /*FIND ALL REFS*/function [|fn|]() {} // var x; // let y; // const z = 1; @@ -186,7 +193,7 @@ // namespace N { } // module M { } // function fn() {} -// /*FIND ALL REFS*/var x; +// /*FIND ALL REFS*/var [|x|]; // let y; // const z = 1; // interface Implemented2 {} @@ -200,7 +207,7 @@ // module M { } // function fn() {} // var x; -// /*FIND ALL REFS*/let y; +// /*FIND ALL REFS*/let [|y|]; // const z = 1; // interface Implemented2 {} // interface Implemented3 {} @@ -215,7 +222,7 @@ // function fn() {} // var x; // let y; -// /*FIND ALL REFS*/const z = 1; +// /*FIND ALL REFS*/const [|z|] = 1; // interface Implemented2 {} // interface Implemented3 {} // class C2 implements Implemented2, Implemented3 {} diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForExpressionKeywords.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForExpressionKeywords.baseline.jsonc index 845f1c7ced..c7d0181ab8 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForExpressionKeywords.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForExpressionKeywords.baseline.jsonc @@ -1,83 +1,114 @@ // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// class C { +// class [|C|] { // static x = 1; // } -// /*FIND ALL REFS*/new C(); -// void C; -// typeof C; -// delete C.x; -// // --- (line: 8) skipped --- +// /*FIND ALL REFS*/new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; +// async function* f() { +// yield [|C|]; +// await [|C|]; +// } +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// class C { +// class [|C|] { // static x = 1; // } -// new C(); -// /*FIND ALL REFS*/void C; -// typeof C; -// delete C.x; +// new [|C|](); +// /*FIND ALL REFS*/void [|C|]; +// typeof [|C|]; +// delete [|C|].x; // async function* f() { -// // --- (line: 9) skipped --- +// yield [|C|]; +// await [|C|]; +// } +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// class C { +// class [|C|] { // static x = 1; // } -// new C(); -// void C; -// /*FIND ALL REFS*/[|typeof|] C; -// delete C.x; +// new [|C|](); +// void [|C|]; +// /*FIND ALL REFS*/typeof [|C|]; +// delete [|C|].x; // async function* f() { -// yield C; -// // --- (line: 10) skipped --- +// yield [|C|]; +// await [|C|]; +// } +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 5) skipped --- -// typeof C; -// delete C.x; +// class [|C|] { +// static x = 1; +// } +// new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; // async function* f() { -// /*FIND ALL REFS*/yield C; -// await C; +// /*FIND ALL REFS*/yield [|C|]; +// await [|C|]; // } -// "x" in C; -// undefined instanceof C; -// undefined as C; +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 6) skipped --- -// delete C.x; +// class [|C|] { +// static x = 1; +// } +// new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; // async function* f() { -// yield C; -// /*FIND ALL REFS*/await C; +// yield [|C|]; +// /*FIND ALL REFS*/await [|C|]; // } -// "x" in C; -// undefined instanceof C; -// undefined as C; +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 8) skipped --- -// yield C; -// await C; +// class [|C|] { +// static x = 1; // } -// "x" /*FIND ALL REFS*/in C; -// undefined instanceof C; -// undefined as C; +// new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; +// async function* f() { +// yield [|C|]; +// await [|C|]; +// } +// "x" /*FIND ALL REFS*/in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; @@ -102,21 +133,32 @@ // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 10) skipped --- +// class [|C|] { +// static x = 1; // } -// "x" in C; -// undefined instanceof C; -// undefined /*FIND ALL REFS*/as C; +// new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; +// async function* f() { +// yield [|C|]; +// await [|C|]; +// } +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined /*FIND ALL REFS*/as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 3) skipped --- +// class C { +// static [|x|] = 1; +// } // new C(); // void C; // typeof C; -// /*FIND ALL REFS*/delete C.x; +// /*FIND ALL REFS*/delete C.[|x|]; // async function* f() { // yield C; // await C; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForExternalModuleNames.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForExternalModuleNames.baseline.jsonc index 6f1cb201fe..cdbcdc4593 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForExternalModuleNames.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForExternalModuleNames.baseline.jsonc @@ -1,9 +1,12 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/declare module "foo" { +// /*FIND ALL REFS*/declare module "[|foo|]" { // var f: number; // } +// === /referencesForGlobals_2.ts === +// import f = require("[|foo|]"); + // === findAllReferences === @@ -19,7 +22,7 @@ // === findAllReferences === // === /referencesForGlobals_2.ts === -// /*FIND ALL REFS*/import f = require("foo"); +// /*FIND ALL REFS*/import [|f|] = require("foo"); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForFunctionOverloads.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForFunctionOverloads.baseline.jsonc index 86de4ff51c..02172bb86d 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForFunctionOverloads.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForFunctionOverloads.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /referencesForFunctionOverloads.ts === -// /*FIND ALL REFS*/function foo(x: string); -// function foo(x: string, y: number) { -// foo('', 43); +// /*FIND ALL REFS*/function [|foo|](x: string); +// function [|foo|](x: string, y: number) { +// [|foo|]('', 43); // } @@ -18,9 +18,9 @@ // === findAllReferences === // === /referencesForFunctionOverloads.ts === -// function foo(x: string); -// /*FIND ALL REFS*/function foo(x: string, y: number) { -// foo('', 43); +// function [|foo|](x: string); +// /*FIND ALL REFS*/function [|foo|](x: string, y: number) { +// [|foo|]('', 43); // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals.baseline.jsonc index 54bec186f0..7942e20845 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals.baseline.jsonc @@ -1,10 +1,26 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/var global = 2; +// /*FIND ALL REFS*/var [|global|] = 2; // // class foo { // constructor (public global) { } -// // --- (line: 5) skipped --- +// public f(global) { } +// public f2(global) { } +// } +// +// class bar { +// constructor () { +// var n = [|global|]; +// +// var f = new foo(''); +// f.global = ''; +// } +// } +// +// var k = [|global|]; + +// === /referencesForGlobals_2.ts === +// var m = [|global|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals2.baseline.jsonc index 31467511fe..d610d04261 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals2.baseline.jsonc @@ -1,9 +1,12 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/class globalClass { +// /*FIND ALL REFS*/class [|globalClass|] { // public f() { } // } +// === /referencesForGlobals_2.ts === +// var c = [|globalClass|](); + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals3.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals3.baseline.jsonc index 79f09ba209..900a8652b7 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals3.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals3.baseline.jsonc @@ -1,9 +1,12 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/interface globalInterface { +// /*FIND ALL REFS*/interface [|globalInterface|] { // f(); // } +// === /referencesForGlobals_2.ts === +// var i: [|globalInterface|]; + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals4.baseline.jsonc index 92d11768c4..0d1e16d30b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals4.baseline.jsonc @@ -1,9 +1,12 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/module globalModule { +// /*FIND ALL REFS*/module [|globalModule|] { // export f() { }; // } +// === /referencesForGlobals_2.ts === +// var m = [|globalModule|]; + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals5.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals5.baseline.jsonc index 1345e76576..1fe53ef3aa 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals5.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals5.baseline.jsonc @@ -4,7 +4,10 @@ // export var x; // } // -// /*FIND ALL REFS*/import globalAlias = globalModule; +// /*FIND ALL REFS*/import [|globalAlias|] = globalModule; + +// === /referencesForGlobals_2.ts === +// var m = [|globalAlias|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobalsInExternalModule.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobalsInExternalModule.baseline.jsonc index 73e1bc6410..f676331fc7 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobalsInExternalModule.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobalsInExternalModule.baseline.jsonc @@ -1,10 +1,11 @@ // === findAllReferences === // === /referencesForGlobalsInExternalModule.ts === -// /*FIND ALL REFS*/var topLevelVar = 2; -// var topLevelVar2 = topLevelVar; +// /*FIND ALL REFS*/var [|topLevelVar|] = 2; +// var topLevelVar2 = [|topLevelVar|]; // // class topLevelClass { } -// // --- (line: 5) skipped --- +// var c = new topLevelClass(); +// // --- (line: 6) skipped --- @@ -35,11 +36,12 @@ // var topLevelVar = 2; // var topLevelVar2 = topLevelVar; // -// /*FIND ALL REFS*/class topLevelClass { } -// var c = new topLevelClass(); +// /*FIND ALL REFS*/class [|topLevelClass|] { } +// var c = new [|topLevelClass|](); // // interface topLevelInterface { } -// // --- (line: 8) skipped --- +// var i: topLevelInterface; +// // --- (line: 9) skipped --- @@ -77,11 +79,12 @@ // class topLevelClass { } // var c = new topLevelClass(); // -// /*FIND ALL REFS*/interface topLevelInterface { } -// var i: topLevelInterface; +// /*FIND ALL REFS*/interface [|topLevelInterface|] { } +// var i: [|topLevelInterface|]; // // module topLevelModule { -// // --- (line: 11) skipped --- +// export var x; +// // --- (line: 12) skipped --- @@ -121,10 +124,10 @@ // interface topLevelInterface { } // var i: topLevelInterface; // -// /*FIND ALL REFS*/module topLevelModule { +// /*FIND ALL REFS*/module [|topLevelModule|] { // export var x; // } -// var x = topLevelModule.x; +// var x = [|topLevelModule|].x; // // export = x; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForImports.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForImports.baseline.jsonc index 81aaedb024..bd03e117e5 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForImports.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForImports.baseline.jsonc @@ -4,8 +4,8 @@ // function $(s: string): any; // export = $; // } -// /*FIND ALL REFS*/import $ = require("jquery"); -// $("a"); +// /*FIND ALL REFS*/import [|$|] = require("jquery"); +// [|$|]("a"); // import $ = require("jquery"); @@ -40,7 +40,7 @@ // } // import $ = require("jquery"); // $("a"); -// /*FIND ALL REFS*/import $ = require("jquery"); +// /*FIND ALL REFS*/import [|$|] = require("jquery"); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations.baseline.jsonc index 9a876c8f4b..d6508f7d33 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations.baseline.jsonc @@ -1,11 +1,18 @@ // === findAllReferences === // === /referencesForMergedDeclarations.ts === -// /*FIND ALL REFS*/interface Foo { +// /*FIND ALL REFS*/interface [|Foo|] { // } // // module Foo { // // --- (line: 5) skipped --- +// --- (line: 8) skipped --- +// } +// +// var f1: Foo.Bar; +// var f2: [|Foo|]; +// Foo.bind(this); + // === findAllReferences === @@ -30,11 +37,16 @@ // interface Foo { // } // -// /*FIND ALL REFS*/module Foo { +// /*FIND ALL REFS*/module [|Foo|] { // export interface Bar { } // } // -// // --- (line: 8) skipped --- +// function Foo(): void { +// } +// +// var f1: [|Foo|].Bar; +// var f2: Foo; +// Foo.bind(this); @@ -62,12 +74,12 @@ // export interface Bar { } // } // -// /*FIND ALL REFS*/function Foo(): void { +// /*FIND ALL REFS*/function [|Foo|](): void { // } // // var f1: Foo.Bar; // var f2: Foo; -// Foo.bind(this); +// [|Foo|].bind(this); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations2.baseline.jsonc index 377113b9d1..fa095d184e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations2.baseline.jsonc @@ -4,10 +4,10 @@ // // function ATest() { } // -// /*FIND ALL REFS*/import alias = ATest; // definition +// /*FIND ALL REFS*/import [|alias|] = ATest; // definition // -// var a: alias.Bar; // namespace -// alias.call(this); // value +// var a: [|alias|].Bar; // namespace +// [|alias|].call(this); // value diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations4.baseline.jsonc index fc54de7f4b..5896510ddb 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations4.baseline.jsonc @@ -1,10 +1,24 @@ // === findAllReferences === // === /referencesForMergedDeclarations4.ts === -// /*FIND ALL REFS*/class testClass { +// /*FIND ALL REFS*/class [|testClass|] { // static staticMethod() { } // method() { } // } -// // --- (line: 5) skipped --- +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); @@ -34,16 +48,25 @@ // === findAllReferences === // === /referencesForMergedDeclarations4.ts === -// class testClass { +// class [|testClass|] { // static staticMethod() { } // method() { } // } // -// /*FIND ALL REFS*/module testClass { +// /*FIND ALL REFS*/module [|testClass|] { // export interface Bar { // // } -// // --- (line: 10) skipped --- +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations6.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations6.baseline.jsonc index f7f9fd6965..7746adb1e4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations6.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations6.baseline.jsonc @@ -1,11 +1,14 @@ // === findAllReferences === // === /referencesForMergedDeclarations6.ts === // interface Foo { } -// /*FIND ALL REFS*/module Foo { +// /*FIND ALL REFS*/module [|Foo|] { // export interface Bar { } // export module Bar { export interface Baz { } } // export function Bar() { } -// // --- (line: 6) skipped --- +// } +// +// // module +// import a1 = [|Foo|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc index ce8d974534..01b41d14f3 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc @@ -3,12 +3,12 @@ // interface Foo { } // module Foo { // export interface Bar { } -// /*FIND ALL REFS*/export module Bar { export interface Baz { } } +// /*FIND ALL REFS*/export module [|Bar|] { export interface Baz { } } // export function Bar() { } // } // // // module -// import a3 = Foo.Bar.Baz; +// import a3 = Foo.[|Bar|].Baz; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForModifiers.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForModifiers.baseline.jsonc index b4505a6fce..5edfd5392f 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForModifiers.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForModifiers.baseline.jsonc @@ -1,6 +1,6 @@ // === findAllReferences === // === /referencesForModifiers.ts === -// /*FIND ALL REFS*/declare abstract class C1 { +// /*FIND ALL REFS*/declare abstract class [|C1|] { // static a; // readonly b; // public c; @@ -10,7 +10,7 @@ // === findAllReferences === // === /referencesForModifiers.ts === -// declare /*FIND ALL REFS*/abstract class C1 { +// declare /*FIND ALL REFS*/abstract class [|C1|] { // static a; // readonly b; // public c; @@ -21,7 +21,7 @@ // === findAllReferences === // === /referencesForModifiers.ts === // declare abstract class C1 { -// /*FIND ALL REFS*/static a; +// /*FIND ALL REFS*/static [|a|]; // readonly b; // public c; // protected d; @@ -33,7 +33,7 @@ // === /referencesForModifiers.ts === // declare abstract class C1 { // static a; -// /*FIND ALL REFS*/readonly b; +// /*FIND ALL REFS*/readonly [|b|]; // public c; // protected d; // private e; @@ -46,7 +46,7 @@ // declare abstract class C1 { // static a; // readonly b; -// /*FIND ALL REFS*/public c; +// /*FIND ALL REFS*/public [|c|]; // protected d; // private e; // } @@ -60,7 +60,7 @@ // static a; // readonly b; // public c; -// /*FIND ALL REFS*/protected d; +// /*FIND ALL REFS*/protected [|d|]; // private e; // } // const enum E { @@ -75,7 +75,7 @@ // readonly b; // public c; // protected d; -// /*FIND ALL REFS*/private e; +// /*FIND ALL REFS*/private [|e|]; // } // const enum E { // } @@ -90,7 +90,7 @@ // protected d; // private e; // } -// /*FIND ALL REFS*/const enum E { +// /*FIND ALL REFS*/const enum [|E|] { // } // async function fn() {} // export default class C2 {} @@ -103,7 +103,7 @@ // } // const enum E { // } -// /*FIND ALL REFS*/async function fn() {} +// /*FIND ALL REFS*/async function [|fn|]() {} // export default class C2 {} @@ -114,7 +114,7 @@ // const enum E { // } // async function fn() {} -// /*FIND ALL REFS*/export default class C2 {} +// /*FIND ALL REFS*/export default class [|C2|] {} diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatic.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatic.baseline.jsonc index d51eb433e8..05be2ced9c 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatic.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatic.baseline.jsonc @@ -3,11 +3,29 @@ // var n = 43; // // class foo { -// /*FIND ALL REFS*/static n = ''; +// /*FIND ALL REFS*/static [|n|] = ''; // // public bar() { -// foo.n = "'"; -// // --- (line: 8) skipped --- +// foo.[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +// === /referencesOnStatic_2.ts === +// var q = foo.[|n|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStaticsAndMembersWithSameNames.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStaticsAndMembersWithSameNames.baseline.jsonc index 84334b385e..98a98b58e6 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStaticsAndMembersWithSameNames.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStaticsAndMembersWithSameNames.baseline.jsonc @@ -27,12 +27,20 @@ // module MixedStaticsClassTest { // export class Foo { // bar: Foo; -// /*FIND ALL REFS*/static bar: Foo; +// /*FIND ALL REFS*/static [|bar|]: Foo; // // public foo(): void { // } // // --- (line: 9) skipped --- +// --- (line: 18) skipped --- +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo.[|bar|]; +// } +// } + // === findAllReferences === @@ -63,11 +71,21 @@ // bar: Foo; // static bar: Foo; // -// /*FIND ALL REFS*/public foo(): void { +// /*FIND ALL REFS*/public [|foo|](): void { // } // public static foo(): void { // } -// // --- (line: 11) skipped --- +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.[|foo|](); +// x.bar; +// +// // static function +// // --- (line: 21) skipped --- @@ -101,12 +119,21 @@ // // public foo(): void { // } -// /*FIND ALL REFS*/public static foo(): void { +// /*FIND ALL REFS*/public static [|foo|](): void { // } // } // } // // --- (line: 13) skipped --- +// --- (line: 17) skipped --- +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.[|foo|](); +// MixedStaticsClassTest.Foo.bar; +// } +// } + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStringLiteralPropertyNames3.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStringLiteralPropertyNames3.baseline.jsonc index 3a61f5954d..d2ff4badc6 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStringLiteralPropertyNames3.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStringLiteralPropertyNames3.baseline.jsonc @@ -1,12 +1,12 @@ // === findAllReferences === // === /referencesForStringLiteralPropertyNames3.ts === // class Foo2 { -// /*FIND ALL REFS*/get "42"() { return 0; } -// set 42(n) { } +// /*FIND ALL REFS*/get "[|42|]"() { return 0; } +// set [|42|](n) { } // } // // var y: Foo2; -// y[42]; +// y[[|42|]]; @@ -25,12 +25,12 @@ // === findAllReferences === // === /referencesForStringLiteralPropertyNames3.ts === // class Foo2 { -// get "42"() { return 0; } -// /*FIND ALL REFS*/set 42(n) { } +// get "[|42|]"() { return 0; } +// /*FIND ALL REFS*/set [|42|](n) { } // } // // var y: Foo2; -// y[42]; +// y[[|42|]]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc index e458b9c5e7..1f5d4e9c3c 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /referencesForTypeKeywords.ts === -// interface I {} -// function f() {} +// interface [|I|] {} +// function f() {} // type A1 = T extends U ? 1 : 0; // type A2 = T extends infer U ? 1 : 0; // type A3 = { [P in keyof T]: 1 }; @@ -14,7 +14,7 @@ // === /referencesForTypeKeywords.ts === // interface I {} // function f() {} -// type A1 = T /*FIND ALL REFS*/extends U ? 1 : 0; +// type A1 = T /*FIND ALL REFS*/extends [|U|] ? 1 : 0; // type A2 = T extends infer U ? 1 : 0; // type A3 = { [P in keyof T]: 1 }; // type A4 = keyof T; @@ -27,41 +27,7 @@ // interface I {} // function f() {} // type A1 = T extends U ? 1 : 0; -// type A2 = T extends /*FIND ALL REFS*/[|infer|] U ? 1 : 0; -// type A3 = { [P in keyof T]: 1 }; -// type A4 = keyof T; -// type A5 = readonly T[]; - - - -// === findAllReferences === -// === /referencesForTypeKeywords.ts === -// interface I {} -// function f() {} -// type A1 = T extends U ? 1 : 0; -// type A2 = T extends infer U ? 1 : 0; -// type A3 = { [P /*FIND ALL REFS*/in keyof T]: 1 }; -// type A4 = keyof T; -// type A5 = readonly T[]; - - - -// === findAllReferences === -// === /referencesForTypeKeywords.ts === -// interface I {} -// function f() {} -// type A1 = T extends U ? 1 : 0; -// type A2 = T extends infer U ? 1 : 0; -// type A3 = { [P in [|keyof|] T]: 1 }; -// type A4 = /*FIND ALL REFS*/[|keyof|] T; -// type A5 = readonly T[]; - - - -// === findAllReferences === -// === /referencesForTypeKeywords.ts === -// --- (line: 3) skipped --- -// type A2 = T extends infer U ? 1 : 0; +// type A2 = T extends /*FIND ALL REFS*/infer [|U|] ? 1 : 0; // type A3 = { [P in keyof T]: 1 }; // type A4 = keyof T; -// type A5 = /*FIND ALL REFS*/[|readonly|] T[]; \ No newline at end of file +// type A5 = readonly T[]; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/remoteGetReferences.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/remoteGetReferences.baseline.jsonc index 2515a755e4..3858ed4b25 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/remoteGetReferences.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/remoteGetReferences.baseline.jsonc @@ -682,12 +682,71 @@ // === findAllReferences === +// === /remoteGetReferences_1.ts === +// --- (line: 85) skipped --- +// var remoteclsTest: remotefooCls; +// +// //Arguments +// remoteclsTest = new remotefooCls([|remoteglobalVar|]); +// remotefoo([|remoteglobalVar|]); +// +// //Increments +// remotefooCls.remoteclsSVar++; +// remotemodTest.remotemodVar++; +// [|remoteglobalVar|] = [|remoteglobalVar|] + [|remoteglobalVar|]; +// +// //ETC - Other cases +// [|remoteglobalVar|] = 3; +// +// //Find References misses method param +// var +// // --- (line: 102) skipped --- + // === /remoteGetReferences_2.ts === -// /*FIND ALL REFS*/var remoteglobalVar: number = 2; +// /*FIND ALL REFS*/var [|remoteglobalVar|]: number = 2; // // class remotefooCls { // //Declare -// // --- (line: 5) skipped --- +// remoteclsVar = 1; +// static remoteclsSVar = 1; +// +// constructor(public remoteclsParam: number) { +// //Increments +// [|remoteglobalVar|]++; +// this.remoteclsVar++; +// remotefooCls.remoteclsSVar++; +// this.remoteclsParam++; +// // --- (line: 14) skipped --- + +// --- (line: 20) skipped --- +// +// //Increments +// remotefooCls.remoteclsSVar++; +// [|remoteglobalVar|]++; +// remotemodTest.remotemodVar++; +// remotefnVar++; +// +// // --- (line: 28) skipped --- + +// --- (line: 33) skipped --- +// export var remotemodVar: number; +// +// //Increments +// [|remoteglobalVar|]++; +// remotefooCls.remoteclsSVar++; +// remotemodVar++; +// +// // --- (line: 41) skipped --- + +// --- (line: 45) skipped --- +// static remoteboo = remotefoo; +// +// //Increments +// [|remoteglobalVar|]++; +// remotefooCls.remoteclsSVar++; +// remotemodVar++; +// } +// // --- (line: 53) skipped --- @@ -761,14 +820,71 @@ // === findAllReferences === +// === /remoteGetReferences_1.ts === +// --- (line: 82) skipped --- +// +// //Remotes +// //Type test +// var remoteclsTest: [|remotefooCls|]; +// +// //Arguments +// remoteclsTest = new [|remotefooCls|](remoteglobalVar); +// remotefoo(remoteglobalVar); +// +// //Increments +// [|remotefooCls|].remoteclsSVar++; +// remotemodTest.remotemodVar++; +// remoteglobalVar = remoteglobalVar + remoteglobalVar; +// +// // --- (line: 97) skipped --- + // === /remoteGetReferences_2.ts === // var remoteglobalVar: number = 2; // -// /*FIND ALL REFS*/class remotefooCls { +// /*FIND ALL REFS*/class [|remotefooCls|] { // //Declare // remoteclsVar = 1; // static remoteclsSVar = 1; -// // --- (line: 7) skipped --- +// +// constructor(public remoteclsParam: number) { +// //Increments +// remoteglobalVar++; +// this.remoteclsVar++; +// [|remotefooCls|].remoteclsSVar++; +// this.remoteclsParam++; +// remotemodTest.remotemodVar++; +// } +// // --- (line: 16) skipped --- + +// --- (line: 19) skipped --- +// var remotefnVar = 1; +// +// //Increments +// [|remotefooCls|].remoteclsSVar++; +// remoteglobalVar++; +// remotemodTest.remotemodVar++; +// remotefnVar++; +// // --- (line: 27) skipped --- + +// --- (line: 34) skipped --- +// +// //Increments +// remoteglobalVar++; +// [|remotefooCls|].remoteclsSVar++; +// remotemodVar++; +// +// class remotetestCls { +// // --- (line: 42) skipped --- + +// --- (line: 46) skipped --- +// +// //Increments +// remoteglobalVar++; +// [|remotefooCls|].remoteclsSVar++; +// remotemodVar++; +// } +// +// // --- (line: 54) skipped --- @@ -862,17 +978,64 @@ // === findAllReferences === +// === /remoteGetReferences_1.ts === +// --- (line: 89) skipped --- +// remotefoo(remoteglobalVar); +// +// //Increments +// remotefooCls.[|remoteclsSVar|]++; +// remotemodTest.remotemodVar++; +// remoteglobalVar = remoteglobalVar + remoteglobalVar; +// +// // --- (line: 97) skipped --- + // === /remoteGetReferences_2.ts === // var remoteglobalVar: number = 2; // // class remotefooCls { // //Declare // remoteclsVar = 1; -// /*FIND ALL REFS*/static remoteclsSVar = 1; +// /*FIND ALL REFS*/static [|remoteclsSVar|] = 1; // // constructor(public remoteclsParam: number) { // //Increments -// // --- (line: 10) skipped --- +// remoteglobalVar++; +// this.remoteclsVar++; +// remotefooCls.[|remoteclsSVar|]++; +// this.remoteclsParam++; +// remotemodTest.remotemodVar++; +// } +// // --- (line: 16) skipped --- + +// --- (line: 19) skipped --- +// var remotefnVar = 1; +// +// //Increments +// remotefooCls.[|remoteclsSVar|]++; +// remoteglobalVar++; +// remotemodTest.remotemodVar++; +// remotefnVar++; +// // --- (line: 27) skipped --- + +// --- (line: 34) skipped --- +// +// //Increments +// remoteglobalVar++; +// remotefooCls.[|remoteclsSVar|]++; +// remotemodVar++; +// +// class remotetestCls { +// // --- (line: 42) skipped --- + +// --- (line: 46) skipped --- +// +// //Increments +// remoteglobalVar++; +// remotefooCls.[|remoteclsSVar|]++; +// remotemodVar++; +// } +// +// // --- (line: 54) skipped --- diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences4.baseline.jsonc index a65332382e..2fb055c836 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences4.baseline.jsonc @@ -4,11 +4,14 @@ // } // interface ElementAttributesProperty { props } // } -// /*FIND ALL REFS*/class MyClass { +// /*FIND ALL REFS*/class [|MyClass|] { // props: { // name?: string; // size?: number; -// // --- (line: 11) skipped --- +// } +// +// +// var x = <[|MyClass|] name='hello'>; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences5.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences5.baseline.jsonc index 8c15f502a3..c7fa566bf2 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences5.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences5.baseline.jsonc @@ -4,12 +4,12 @@ // propString: string // optional?: boolean // } -// /*FIND ALL REFS*/declare function Opt(attributes: OptionPropBag): JSX.Element; -// let opt = ; -// let opt1 = ; -// let opt2 = ; -// let opt3 = ; -// let opt4 = ; +// /*FIND ALL REFS*/declare function [|Opt|](attributes: OptionPropBag): JSX.Element; +// let opt = <[|Opt|] />; +// let opt1 = <[|Opt|] propx={100} propString />; +// let opt2 = <[|Opt|] propx={100} optional/>; +// let opt3 = <[|Opt|] wrong />; +// let opt4 = <[|Opt|] propx={100} propString="hi" />; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences8.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences8.baseline.jsonc index 4cce5cf782..dac2cf2682 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences8.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences8.baseline.jsonc @@ -4,11 +4,15 @@ // interface LinkProps extends ClickableProps { // goTo: string; // } -// /*FIND ALL REFS*/declare function MainButton(buttonProps: ButtonProps): JSX.Element; -// declare function MainButton(linkProps: LinkProps): JSX.Element; -// declare function MainButton(props: ButtonProps | LinkProps): JSX.Element; -// let opt = ; -// // --- (line: 21) skipped --- +// /*FIND ALL REFS*/declare function [|MainButton|](buttonProps: ButtonProps): JSX.Element; +// declare function [|MainButton|](linkProps: LinkProps): JSX.Element; +// declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; @@ -32,15 +36,19 @@ // === findAllReferences === // === /file.tsx === -// --- (line: 14) skipped --- +// --- (line: 13) skipped --- +// interface LinkProps extends ClickableProps { // goTo: string; // } -// declare function MainButton(buttonProps: ButtonProps): JSX.Element; -// /*FIND ALL REFS*/declare function MainButton(linkProps: LinkProps): JSX.Element; -// declare function MainButton(props: ButtonProps | LinkProps): JSX.Element; -// let opt = ; -// let opt = ; -// // --- (line: 22) skipped --- +// declare function [|MainButton|](buttonProps: ButtonProps): JSX.Element; +// /*FIND ALL REFS*/declare function [|MainButton|](linkProps: LinkProps): JSX.Element; +// declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; @@ -64,15 +72,19 @@ // === findAllReferences === // === /file.tsx === -// --- (line: 15) skipped --- +// --- (line: 13) skipped --- +// interface LinkProps extends ClickableProps { +// goTo: string; // } -// declare function MainButton(buttonProps: ButtonProps): JSX.Element; -// declare function MainButton(linkProps: LinkProps): JSX.Element; -// /*FIND ALL REFS*/declare function MainButton(props: ButtonProps | LinkProps): JSX.Element; -// let opt = ; -// let opt = ; -// let opt = {}} />; -// // --- (line: 23) skipped --- +// declare function [|MainButton|](buttonProps: ButtonProps): JSX.Element; +// declare function [|MainButton|](linkProps: LinkProps): JSX.Element; +// /*FIND ALL REFS*/declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType1.baseline.jsonc index f93c9e0604..590e0bcf5c 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType1.baseline.jsonc @@ -4,8 +4,8 @@ // function SFC2(prop: { x: boolean }) { // return

World

; // } -// /*FIND ALL REFS*/var SFCComp = SFC1 || SFC2; -// +// /*FIND ALL REFS*/var [|SFCComp|] = SFC1 || SFC2; +// <[|SFCComp|] x={ "hi" } /> diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType2.baseline.jsonc index fa4cc25d78..b02df6df6e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType2.baseline.jsonc @@ -4,8 +4,8 @@ // } // private method() { } // } -// /*FIND ALL REFS*/var RCComp = RC1 || RC2; -// +// /*FIND ALL REFS*/var [|RCComp|] = RC1 || RC2; +// <[|RCComp|] /> From 0c30c262084e4081b620000be12c5f8a22d8e069 Mon Sep 17 00:00:00 2001 From: Oleksandr Tarasiuk Date: Sat, 18 Oct 2025 02:21:21 +0300 Subject: [PATCH 2/2] fix crash --- internal/ls/utilities.go | 2 +- .../findAllRefsExportEquals.baseline.jsonc | 42 ++++++++++++++++++- .../referencesForTypeKeywords.baseline.jsonc | 36 +++++++++++++++- 3 files changed, 77 insertions(+), 3 deletions(-) diff --git a/internal/ls/utilities.go b/internal/ls/utilities.go index 86e27a9fb7..a51d0a2fe1 100644 --- a/internal/ls/utilities.go +++ b/internal/ls/utilities.go @@ -917,7 +917,7 @@ func getAdjustedLocation(node *ast.Node, forRename bool, sourceFile *ast.SourceF // specially by `getSymbolAtLocation`. isModifier := func(node *ast.Node) bool { if ast.IsModifier(node) && (forRename || node.Kind != ast.KindDefaultKeyword) { - return ast.CanHaveModifiers(parent) && slices.Contains(parent.Modifiers().NodeList.Nodes, node) + return ast.CanHaveModifiers(parent) && parent.Modifiers() != nil && slices.Contains(parent.Modifiers().NodeList.Nodes, node) } switch node.Kind { case ast.KindClassKeyword: diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc index fad3a861ed..bc114597e4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc @@ -1,4 +1,44 @@ // === findAllReferences === // === /a.ts === // type /*FIND ALL REFS*/[|T|] = number; -// export = T; \ No newline at end of file +// export = T; + + + +// === findAllReferences === +// === /a.ts === +// type T = number; +// /*FIND ALL REFS*/export = [|T|]; + +// === /b.ts === +// import [|T|] = require("./a"); + + + +// === findAllReferences === +// === /a.ts === +// type T = number; +// export = /*FIND ALL REFS*/[|T|]; + +// === /b.ts === +// import [|T|] = require("./a"); + + + +// === findAllReferences === +// === /a.ts === +// type [|T|] = number; +// export = [|T|]; + +// === /b.ts === +// import /*FIND ALL REFS*/[|T|] = require("./a"); + + + +// === findAllReferences === +// === /a.ts === +// type [|T|] = number; +// [|export|] = [|T|]; + +// === /b.ts === +// import [|T|] = require("/*FIND ALL REFS*/[|./a|]"); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc index 1f5d4e9c3c..343a4a0883 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc @@ -30,4 +30,38 @@ // type A2 = T extends /*FIND ALL REFS*/infer [|U|] ? 1 : 0; // type A3 = { [P in keyof T]: 1 }; // type A4 = keyof T; -// type A5 = readonly T[]; \ No newline at end of file +// type A5 = readonly T[]; + + + +// === findAllReferences === +// === /referencesForTypeKeywords.ts === +// interface I {} +// function f() {} +// type A1 = T extends U ? 1 : 0; +// type A2 = T extends infer U ? 1 : 0; +// type A3 = { [[|P|] /*FIND ALL REFS*/in keyof T]: 1 }; +// type A4 = keyof T; +// type A5 = readonly T[]; + + + +// === findAllReferences === +// === /referencesForTypeKeywords.ts === +// interface I {} +// function f() {} +// type A1 = T extends U ? 1 : 0; +// type A2 = T extends infer U ? 1 : 0; +// type A3 = { [P in keyof T]: 1 }; +// type A4<[|T|]> = /*FIND ALL REFS*/keyof [|T|]; +// type A5 = readonly T[]; + + + +// === findAllReferences === +// === /referencesForTypeKeywords.ts === +// --- (line: 3) skipped --- +// type A2 = T extends infer U ? 1 : 0; +// type A3 = { [P in keyof T]: 1 }; +// type A4 = keyof T; +// type A5<[|T|]> = /*FIND ALL REFS*/readonly [|T|][]; \ No newline at end of file