@@ -1142,32 +1142,6 @@ namespace FourSlash {
1142
1142
}
1143
1143
}
1144
1144
1145
- private verifyReferencesAre ( expectedReferences : Range [ ] ) {
1146
- const actualReferences = this . getReferencesAtCaret ( ) || [ ] ;
1147
-
1148
- if ( actualReferences . length > expectedReferences . length ) {
1149
- // Find the unaccounted-for reference.
1150
- for ( const actual of actualReferences ) {
1151
- if ( ! ts . forEach ( expectedReferences , r => r . pos === actual . textSpan . start ) ) {
1152
- this . raiseError ( `A reference ${ stringify ( actual ) } is unaccounted for.` ) ;
1153
- }
1154
- }
1155
- // Probably will never reach here.
1156
- this . raiseError ( `There are ${ actualReferences . length } references but only ${ expectedReferences . length } were expected.` ) ;
1157
- }
1158
-
1159
- for ( const reference of expectedReferences ) {
1160
- const { fileName, pos, end } = reference ;
1161
- if ( reference . marker && reference . marker . data ) {
1162
- const { isWriteAccess, isDefinition } = reference . marker . data as { isWriteAccess ?: boolean , isDefinition ?: boolean } ;
1163
- this . verifyReferencesWorker ( actualReferences , fileName , pos , end , isWriteAccess , isDefinition ) ;
1164
- }
1165
- else {
1166
- this . verifyReferencesWorker ( actualReferences , fileName , pos , end ) ;
1167
- }
1168
- }
1169
- }
1170
-
1171
1145
private verifyDocumentHighlightsRespectFilesList ( files : ReadonlyArray < string > ) : void {
1172
1146
const startFile = this . activeFile . fileName ;
1173
1147
for ( const fileName of files ) {
@@ -1179,20 +1153,6 @@ namespace FourSlash {
1179
1153
}
1180
1154
}
1181
1155
1182
- public verifyReferencesOf ( range : Range , references : Range [ ] ) {
1183
- this . goToRangeStart ( range ) ;
1184
- this . verifyDocumentHighlightsRespectFilesList ( unique ( references , e => e . fileName ) ) ;
1185
- this . verifyReferencesAre ( references ) ;
1186
- }
1187
-
1188
- public verifyRangesReferenceEachOther ( ranges ?: Range [ ] ) {
1189
- ranges = ranges || this . getRanges ( ) ;
1190
- assert ( ranges . length ) ;
1191
- for ( const range of ranges ) {
1192
- this . verifyReferencesOf ( range , ranges ) ;
1193
- }
1194
- }
1195
-
1196
1156
public verifyReferenceGroups ( starts : ArrayOrSingle < string > | ArrayOrSingle < Range > , parts : ReadonlyArray < FourSlashInterface . ReferenceGroup > | undefined ) : void {
1197
1157
interface ReferenceGroupJson {
1198
1158
definition : string | { text : string , range : ts . TextSpan } ;
@@ -1250,6 +1210,12 @@ namespace FourSlash {
1250
1210
}
1251
1211
}
1252
1212
1213
+ // Necessary to have this function since `findReferences` isn't implemented in `client.ts`
1214
+ public verifyGetReferencesForServerTest ( expected : ReadonlyArray < ts . ReferenceEntry > ) : void {
1215
+ const refs = this . getReferencesAtCaret ( ) ;
1216
+ assert . deepEqual ( refs , expected ) ;
1217
+ }
1218
+
1253
1219
public verifySingleReferenceGroup ( definition : FourSlashInterface . ReferenceGroupDefinition , ranges ?: Range [ ] ) {
1254
1220
ranges = ranges || this . getRanges ( ) ;
1255
1221
this . verifyReferenceGroups ( ranges , [ { definition, ranges } ] ) ;
@@ -1314,23 +1280,6 @@ Actual: ${stringify(fullActual)}`);
1314
1280
TestState . getDisplayPartsJson ( expected ) , this . messageAtLastKnownMarker ( "referenced symbol definition display parts" ) ) ;
1315
1281
}
1316
1282
1317
- private verifyReferencesWorker ( references : ts . ReferenceEntry [ ] , fileName : string , start : number , end : number , isWriteAccess ?: boolean , isDefinition ?: boolean ) {
1318
- for ( const reference of references ) {
1319
- if ( reference && reference . fileName === fileName && reference . textSpan . start === start && ts . textSpanEnd ( reference . textSpan ) === end ) {
1320
- if ( typeof isWriteAccess !== "undefined" && reference . isWriteAccess !== isWriteAccess ) {
1321
- this . raiseError ( `verifyReferencesAtPositionListContains failed - item isWriteAccess value does not match, actual: ${ reference . isWriteAccess } , expected: ${ isWriteAccess } .` ) ;
1322
- }
1323
- if ( typeof isDefinition !== "undefined" && reference . isDefinition !== isDefinition ) {
1324
- this . raiseError ( `verifyReferencesAtPositionListContains failed - item isDefinition value does not match, actual: ${ reference . isDefinition } , expected: ${ isDefinition } .` ) ;
1325
- }
1326
- return ;
1327
- }
1328
- }
1329
-
1330
- const missingItem = { fileName, start, end, isWriteAccess, isDefinition } ;
1331
- this . raiseError ( `verifyReferencesAtPositionListContains failed - could not find the item: ${ stringify ( missingItem ) } in the returned list: (${ stringify ( references ) } )` ) ;
1332
- }
1333
-
1334
1283
private getCompletionListAtCaret ( options ?: ts . GetCompletionsAtPositionOptions ) : ts . CompletionInfo {
1335
1284
return this . languageService . getCompletionsAtPosition ( this . activeFile . fileName , this . currentCaretPosition , options ) ;
1336
1285
}
@@ -4210,10 +4159,6 @@ namespace FourSlashInterface {
4210
4159
this . state . verifyTypeOfSymbolAtLocation ( range , symbol , expected ) ;
4211
4160
}
4212
4161
4213
- public referencesOf ( start : FourSlash . Range , references : FourSlash . Range [ ] ) {
4214
- this . state . verifyReferencesOf ( start , references ) ;
4215
- }
4216
-
4217
4162
public referenceGroups ( starts : Many < string > | Many < FourSlash . Range > , parts : ReferenceGroup [ ] ) {
4218
4163
this . state . verifyReferenceGroups ( starts , parts ) ;
4219
4164
}
@@ -4222,12 +4167,12 @@ namespace FourSlashInterface {
4222
4167
this . state . verifyNoReferences ( markerNameOrRange ) ;
4223
4168
}
4224
4169
4225
- public singleReferenceGroup ( definition : ReferenceGroupDefinition , ranges ?: FourSlash . Range [ ] ) {
4226
- this . state . verifySingleReferenceGroup ( definition , ranges ) ;
4170
+ public getReferencesForServerTest ( expected : ReadonlyArray < ts . ReferenceEntry > ) {
4171
+ this . state . verifyGetReferencesForServerTest ( expected ) ;
4227
4172
}
4228
4173
4229
- public rangesReferenceEachOther ( ranges ?: FourSlash . Range [ ] ) {
4230
- this . state . verifyRangesReferenceEachOther ( ranges ) ;
4174
+ public singleReferenceGroup ( definition : ReferenceGroupDefinition , ranges ?: FourSlash . Range [ ] ) {
4175
+ this . state . verifySingleReferenceGroup ( definition , ranges ) ;
4231
4176
}
4232
4177
4233
4178
public findReferencesDefinitionDisplayPartsAtCaretAre ( expected : ts . SymbolDisplayPart [ ] ) {
0 commit comments