Skip to content

Commit 6dc2ba7

Browse files
committed
Take optional string of range text for singleReferenceGroup
1 parent edffcce commit 6dc2ba7

File tree

88 files changed

+101
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+101
-145
lines changed

src/harness/fourslash.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,8 +1001,8 @@ namespace FourSlash {
10011001
assert.deepEqual<ReadonlyArray<ts.ReferenceEntry> | undefined>(refs, expected);
10021002
}
10031003

1004-
public verifySingleReferenceGroup(definition: FourSlashInterface.ReferenceGroupDefinition, ranges?: Range[]) {
1005-
ranges = ranges || this.getRanges();
1004+
public verifySingleReferenceGroup(definition: FourSlashInterface.ReferenceGroupDefinition, ranges?: Range[] | string) {
1005+
ranges = ts.isString(ranges) ? this.rangesByText().get(ranges)! : ranges || this.getRanges();
10061006
this.verifyReferenceGroups(ranges, [{ definition, ranges }]);
10071007
}
10081008

@@ -3971,7 +3971,7 @@ namespace FourSlashInterface {
39713971
this.state.verifyGetReferencesForServerTest(expected);
39723972
}
39733973

3974-
public singleReferenceGroup(definition: ReferenceGroupDefinition, ranges?: FourSlash.Range[]) {
3974+
public singleReferenceGroup(definition: ReferenceGroupDefinition, ranges?: FourSlash.Range[] | string) {
39753975
this.state.verifySingleReferenceGroup(definition, ranges);
39763976
}
39773977

tests/cases/fourslash/findAllRefsOnDecorators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
//// method() {}
1414
////}
1515

16-
verify.singleReferenceGroup("function decorator(target: any): any", test.rangesByText().get("decorator"));
16+
verify.singleReferenceGroup("function decorator(target: any): any", "decorator");

tests/cases/fourslash/findAllRefsOnDefinition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
////second.[|start|]();
2424
////second.stop();
2525

26-
verify.singleReferenceGroup("(method) Test.start(): this", test.rangesByText().get("start"));
26+
verify.singleReferenceGroup("(method) Test.start(): this", "start");

tests/cases/fourslash/findAllRefsOnDefinition2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
////var start: Second.Test.[|start|];
1515
////var stop: Second.Test.stop;
1616

17-
verify.singleReferenceGroup("interface Test.start", test.rangesByText().get("start"));
17+
verify.singleReferenceGroup("interface Test.start", "start");

tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
//// }
1010
////}
1111

12-
verify.singleReferenceGroup("(property) ABCD.z: number", test.rangesByText().get("z"));
12+
verify.singleReferenceGroup("(property) ABCD.z: number", "z");

tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}a|]: "ss"|]
1818
////};
1919

20-
verify.singleReferenceGroup("(property) IFoo.a: string", test.rangesByText().get("a"));
20+
verify.singleReferenceGroup("(property) IFoo.a: string", "a");

tests/cases/fourslash/findAllRefsReExport_broken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// @Filename: /a.ts
44
////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] };|]
55

6-
verify.singleReferenceGroup("export x", test.rangesByText().get("x"));
6+
verify.singleReferenceGroup("export x", "x");

tests/cases/fourslash/findAllRefsReExport_broken2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// @Filename: /a.ts
44
////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] } from "nonsense";|]
55

6-
verify.singleReferenceGroup("export x", test.rangesByText().get("x"));
6+
verify.singleReferenceGroup("export x", "x");

tests/cases/fourslash/findAllRefsTypedef.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
////let x;
1313
////x.[|p|];
1414

15-
verify.singleReferenceGroup("(property) p: number", test.rangesByText().get("p"));
15+
verify.singleReferenceGroup("(property) p: number", "p");

tests/cases/fourslash/findAllRefsTypedef_importType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
/////** @type {import('./a').[|Foo|]} */
1212
////const x = 0;
1313

14-
verify.singleReferenceGroup("type Foo = number", test.rangesByText().get("Foo"));
14+
verify.singleReferenceGroup("type Foo = number", "Foo");

0 commit comments

Comments
 (0)