@@ -97,10 +97,6 @@ export class GoTo {
97
97
this . state . goToEOF ( ) ;
98
98
}
99
99
100
- public implementation ( ) {
101
- this . state . goToImplementation ( ) ;
102
- }
103
-
104
100
public position ( positionOrLineAndCharacter : number | ts . LineAndCharacter , fileNameOrIndex ?: string | number ) : void {
105
101
if ( fileNameOrIndex !== undefined ) {
106
102
this . file ( fileNameOrIndex ) ;
@@ -173,14 +169,6 @@ export class VerifyNegatable {
173
169
this . state . verifyQuickInfoExists ( this . negative ) ;
174
170
}
175
171
176
- public typeDefinitionCountIs ( expectedCount : number ) {
177
- this . state . verifyTypeDefinitionsCount ( this . negative , expectedCount ) ;
178
- }
179
-
180
- public implementationListIsEmpty ( ) {
181
- this . state . verifyImplementationListIsEmpty ( this . negative ) ;
182
- }
183
-
184
172
public isValidBraceCompletionAtPosition ( openingBrace : string ) {
185
173
this . state . verifyBraceCompletionAtPosition ( this . negative , openingBrace ) ;
186
174
}
@@ -318,68 +306,88 @@ export class Verify extends VerifyNegatable {
318
306
this . state . verifyFormatDocumentChangesNothing ( ) ;
319
307
}
320
308
321
- public goToDefinitionIs ( endMarkers : ArrayOrSingle < string > ) {
322
- this . state . verifyGoToDefinitionIs ( endMarkers ) ;
309
+ public verifyGetEmitOutputForCurrentFile ( expected : string ) : void {
310
+ this . state . verifyGetEmitOutputForCurrentFile ( expected ) ;
311
+ }
312
+
313
+ public verifyGetEmitOutputContentsForCurrentFile ( expected : ts . OutputFile [ ] ) : void {
314
+ this . state . verifyGetEmitOutputContentsForCurrentFile ( expected ) ;
315
+ }
316
+
317
+ public symbolAtLocation ( startRange : FourSlash . Range , ...declarationRanges : FourSlash . Range [ ] ) {
318
+ this . state . verifySymbolAtLocation ( startRange , declarationRanges ) ;
323
319
}
324
320
325
- public goToDefinition ( startMarkerName : ArrayOrSingle < string > , endMarkerName : ArrayOrSingle < string > , range ?: FourSlash . Range ) : void ;
326
- public goToDefinition ( startsAndEnds : [ ArrayOrSingle < string > , ArrayOrSingle < string > ] [ ] | { [ startMarkerName : string ] : ArrayOrSingle < string > } ) : void ;
327
- public goToDefinition ( arg0 : any , endMarkerName ?: ArrayOrSingle < string > ) {
328
- this . state . verifyGoToDefinition ( arg0 , endMarkerName ) ;
321
+ public typeOfSymbolAtLocation ( range : FourSlash . Range , symbol : ts . Symbol , expected : string ) {
322
+ this . state . verifyTypeOfSymbolAtLocation ( range , symbol , expected ) ;
329
323
}
330
324
331
- public goToType ( startMarkerName : ArrayOrSingle < string > , endMarkerName : ArrayOrSingle < string > ) : void ;
332
- public goToType ( startsAndEnds : [ ArrayOrSingle < string > , ArrayOrSingle < string > ] [ ] | { [ startMarkerName : string ] : ArrayOrSingle < string > } ) : void ;
333
- public goToType ( arg0 : any , endMarkerName ?: ArrayOrSingle < string > ) {
334
- this . state . verifyGoToType ( arg0 , endMarkerName ) ;
325
+ public typeAtLocation ( range : FourSlash . Range , expected : string ) {
326
+ this . state . verifyTypeAtLocation ( range , expected ) ;
335
327
}
336
328
337
- public goToSourceDefinition ( startMarkerNames : ArrayOrSingle < string > , end : { file : string } | ArrayOrSingle < string > ) {
338
- this . state . verifyGoToSourceDefinition ( startMarkerNames , end ) ;
329
+ public baselineCommands ( ... commands : BaselineCommand [ ] ) {
330
+ this . state . verifyBaselineCommands ( ... commands ) ;
339
331
}
340
332
341
- public goToDefinitionForMarkers ( ...markerNames : string [ ] ) {
342
- this . state . verifyGoToDefinitionForMarkers ( markerNames ) ;
333
+ public baselineFindAllReferences ( ...markerOrRange : FourSlash . MarkerOrNameOrRange [ ] ) {
334
+ this . state . verifyBaselineCommands ( { type : "findAllReferences" , markerOrRange } ) ;
343
335
}
344
336
345
- public goToDefinitionName ( name : string , containerName : string ) {
346
- this . state . verifyGoToDefinitionName ( name , containerName ) ;
337
+ public baselineFindAllReferencesAtRangesWithText ( ... rangeText : string [ ] ) {
338
+ this . state . verifyBaselineCommands ( { type : "findAllReferences" , rangeText } ) ;
347
339
}
348
340
349
- public verifyGetEmitOutputForCurrentFile ( expected : string ) : void {
350
- this . state . verifyGetEmitOutputForCurrentFile ( expected ) ;
341
+ public baselineGetFileReferences ( ... fileName : string [ ] ) {
342
+ this . state . verifyBaselineCommands ( { type : "getFileReferences" , fileName } ) ;
351
343
}
352
344
353
- public verifyGetEmitOutputContentsForCurrentFile ( expected : ts . OutputFile [ ] ) : void {
354
- this . state . verifyGetEmitOutputContentsForCurrentFile ( expected ) ;
345
+ public baselineGoToDefinition ( ... markerOrRange : FourSlash . MarkerOrNameOrRange [ ] ) {
346
+ this . state . verifyBaselineCommands ( { type : "goToDefinition" , markerOrRange } ) ;
355
347
}
356
348
357
- public symbolAtLocation ( startRange : FourSlash . Range , ... declarationRanges : FourSlash . Range [ ] ) {
358
- this . state . verifySymbolAtLocation ( startRange , declarationRanges ) ;
349
+ public baselineGoToDefinitionAtRangesWithText ( ... rangeText : string [ ] ) {
350
+ this . state . verifyBaselineCommands ( { type : "goToDefinition" , rangeText } ) ;
359
351
}
360
352
361
- public typeOfSymbolAtLocation ( range : FourSlash . Range , symbol : ts . Symbol , expected : string ) {
362
- this . state . verifyTypeOfSymbolAtLocation ( range , symbol , expected ) ;
353
+ public baselineGetDefinitionAtPosition ( ... markerOrRange : FourSlash . MarkerOrNameOrRange [ ] ) {
354
+ this . state . verifyBaselineCommands ( { type : "getDefinitionAtPosition" , markerOrRange } ) ;
363
355
}
364
356
365
- public typeAtLocation ( range : FourSlash . Range , expected : string ) {
366
- this . state . verifyTypeAtLocation ( range , expected ) ;
357
+ public baselineGetDefinitionAtRangesWithText ( ... rangeText : string [ ] ) {
358
+ this . state . verifyBaselineCommands ( { type : "getDefinitionAtPosition" , rangeText } ) ;
367
359
}
368
360
369
- public baselineFindAllReferences ( ...markerNames : string [ ] ) {
370
- this . state . verifyBaselineFindAllReferences ( ... markerNames ) ;
361
+ public baselineGoToSourceDefinition ( ...markerOrRange : FourSlash . MarkerOrNameOrRange [ ] ) {
362
+ this . state . verifyBaselineCommands ( { type : "goToSourceDefinition" , markerOrRange } ) ;
371
363
}
372
364
373
- public baselineFindAllReferencesMulti ( seq : number , ...markerNames : string [ ] ) {
374
- this . state . verifyBaselineFindAllReferencesMulti ( seq , ... markerNames ) ;
365
+ public baselineGoToSourceDefinitionAtRangesWithText ( ...rangeText : string [ ] ) {
366
+ this . state . verifyBaselineCommands ( { type : "goToSourceDefinition" , rangeText } ) ;
375
367
}
376
368
377
- public baselineGetFileReferences ( fileName : string ) {
378
- this . state . verifyBaselineGetFileReferences ( fileName ) ;
369
+ public baselineGoToType ( ... markerOrRange : FourSlash . MarkerOrNameOrRange [ ] ) {
370
+ this . state . verifyBaselineCommands ( { type : "goToType" , markerOrRange } ) ;
379
371
}
380
372
381
- public findReferencesDefinitionDisplayPartsAtCaretAre ( expected : ts . SymbolDisplayPart [ ] ) {
382
- this . state . verifyDisplayPartsOfReferencedSymbol ( expected ) ;
373
+ public baselineGoToTypeAtRangesWithText ( ...rangeText : string [ ] ) {
374
+ this . state . verifyBaselineCommands ( { type : "goToType" , rangeText } ) ;
375
+ }
376
+
377
+ public baselineGoToImplementation ( ...markerOrRange : FourSlash . MarkerOrNameOrRange [ ] ) {
378
+ this . state . verifyBaselineCommands ( { type : "goToImplementation" , markerOrRange } ) ;
379
+ }
380
+
381
+ public baselineGoToImplementationAtRangesWithText ( ...rangeText : string [ ] ) {
382
+ this . state . verifyBaselineCommands ( { type : "goToImplementation" , rangeText } ) ;
383
+ }
384
+
385
+ public baselineDocumentHighlights ( markerOrRange ?: ArrayOrSingle < FourSlash . MarkerOrNameOrRange > , options ?: VerifyDocumentHighlightsOptions ) {
386
+ this . state . verifyBaselineCommands ( { type : "documentHighlights" , markerOrRange, options } ) ;
387
+ }
388
+
389
+ public baselineDocumentHighlightsAtRangesWithText ( rangeText ?: ArrayOrSingle < string > , options ?: VerifyDocumentHighlightsOptions ) {
390
+ this . state . verifyBaselineCommands ( { type : "documentHighlights" , rangeText, options } ) ;
383
391
}
384
392
385
393
public noErrors ( ) {
@@ -516,42 +524,6 @@ export class Verify extends VerifyNegatable {
516
524
this . state . verifyNavigateTo ( options ) ;
517
525
}
518
526
519
- public occurrencesAtPositionContains ( range : FourSlash . Range , isWriteAccess ?: boolean ) {
520
- this . state . verifyOccurrencesAtPositionListContains ( range . fileName , range . pos , range . end , isWriteAccess ) ;
521
- }
522
-
523
- public occurrencesAtPositionCount ( expectedCount : number ) {
524
- this . state . verifyOccurrencesAtPositionListCount ( expectedCount ) ;
525
- }
526
-
527
- public rangesAreOccurrences ( isWriteAccess ?: boolean , ranges ?: FourSlash . Range [ ] ) {
528
- this . state . verifyRangesAreOccurrences ( isWriteAccess , ranges ) ;
529
- }
530
-
531
- public rangesWithSameTextAreRenameLocations ( ...texts : string [ ] ) {
532
- this . state . verifyRangesWithSameTextAreRenameLocations ( ...texts ) ;
533
- }
534
-
535
- public rangesAreRenameLocations ( options ?: FourSlash . Range [ ] | { findInStrings ?: boolean , findInComments ?: boolean , ranges ?: FourSlash . Range [ ] , providePrefixAndSuffixTextForRename ?: boolean } ) {
536
- this . state . verifyRangesAreRenameLocations ( options ) ;
537
- }
538
-
539
- public rangesAreDocumentHighlights ( ranges ?: FourSlash . Range [ ] , options ?: VerifyDocumentHighlightsOptions ) {
540
- this . state . verifyRangesAreDocumentHighlights ( ranges , options ) ;
541
- }
542
-
543
- public rangesWithSameTextAreDocumentHighlights ( ) {
544
- this . state . verifyRangesWithSameTextAreDocumentHighlights ( ) ;
545
- }
546
-
547
- public documentHighlightsOf ( startRange : FourSlash . Range , ranges : FourSlash . Range [ ] , options ?: VerifyDocumentHighlightsOptions ) {
548
- this . state . verifyDocumentHighlightsOf ( startRange , ranges , options ) ;
549
- }
550
-
551
- public noDocumentHighlights ( startRange : FourSlash . Range ) {
552
- this . state . verifyNoDocumentHighlights ( startRange ) ;
553
- }
554
-
555
527
/**
556
528
* This method *requires* a contiguous, complete, and ordered stream of classifications for a file.
557
529
*/
@@ -593,12 +565,12 @@ export class Verify extends VerifyNegatable {
593
565
this . state . verifyRenameInfoFailed ( message , preferences ) ;
594
566
}
595
567
596
- public renameLocations ( startRanges : ArrayOrSingle < FourSlash . Range > , options : RenameLocationsOptions ) {
597
- this . state . verifyRenameLocations ( startRanges , options ) ;
568
+ public baselineRename ( markerOrRange ? : ArrayOrSingle < FourSlash . MarkerOrNameOrRange > , options ?: RenameOptions ) {
569
+ this . state . verifyBaselineCommands ( { type : "findRenameLocations" , markerOrRange , options } ) ;
598
570
}
599
571
600
- public baselineRename ( marker : string , options : RenameOptions ) {
601
- this . state . baselineRename ( marker , options ) ;
572
+ public baselineRenameAtRangesWithText ( rangeText ?: ArrayOrSingle < string > , options ? : RenameOptions ) {
573
+ this . state . verifyBaselineCommands ( { type : "findRenameLocations" , rangeText , options } ) ;
602
574
}
603
575
604
576
public verifyQuickInfoDisplayParts ( kind : string , kindModifiers : string , textSpan : FourSlash . TextSpan ,
@@ -622,10 +594,6 @@ export class Verify extends VerifyNegatable {
622
594
this . state . verifyProjectInfo ( expected ) ;
623
595
}
624
596
625
- public allRangesAppearInImplementationList ( markerName : string ) {
626
- this . state . verifyRangesInImplementationList ( markerName ) ;
627
- }
628
-
629
597
public getEditsForFileRename ( options : GetEditsForFileRenameOptions ) {
630
598
this . state . getEditsForFileRename ( options ) ;
631
599
}
@@ -650,6 +618,9 @@ export class Verify extends VerifyNegatable {
650
618
export class Edit {
651
619
constructor ( private state : FourSlash . TestState ) {
652
620
}
621
+ public caretPosition ( ) {
622
+ return this . state . caretPosition ( ) ;
623
+ }
653
624
public backspace ( count ?: number ) {
654
625
this . state . deleteCharBehindMarker ( count ) ;
655
626
}
@@ -1855,7 +1826,7 @@ export interface VerifyCompletionListContainsOptions extends ts.UserPreferences
1855
1826
}
1856
1827
1857
1828
export interface VerifyDocumentHighlightsOptions {
1858
- filesToSearch ? : readonly string [ ] ;
1829
+ filesToSearch : readonly string [ ] ;
1859
1830
}
1860
1831
1861
1832
export type NewFileContent = string | { readonly [ filename : string ] : string } ;
@@ -1936,3 +1907,25 @@ export interface RenameOptions {
1936
1907
readonly findInComments ?: boolean ;
1937
1908
readonly providePrefixAndSuffixTextForRename ?: boolean ;
1938
1909
}
1910
+ export type BaselineCommandWithMarkerOrRange = {
1911
+ type : "findAllReferences" | "goToDefinition" | "getDefinitionAtPosition" | "goToSourceDefinition" | "goToType" | "goToImplementation" ;
1912
+ markerOrRange ?: ArrayOrSingle < FourSlash . MarkerOrNameOrRange > ;
1913
+ rangeText ?: ArrayOrSingle < string > ;
1914
+ } | {
1915
+ type : "findRenameLocations" ;
1916
+ markerOrRange ?: ArrayOrSingle < FourSlash . MarkerOrNameOrRange > ;
1917
+ rangeText ?: ArrayOrSingle < string > ;
1918
+ options ?: RenameOptions ;
1919
+ } | {
1920
+ type : "documentHighlights" ;
1921
+ markerOrRange ?: ArrayOrSingle < FourSlash . MarkerOrNameOrRange > ;
1922
+ rangeText ?: ArrayOrSingle < string > ;
1923
+ options ?: VerifyDocumentHighlightsOptions ;
1924
+ } ;
1925
+ export type BaselineCommand = BaselineCommandWithMarkerOrRange | {
1926
+ type : "getFileReferences" ;
1927
+ fileName : ArrayOrSingle < string > ;
1928
+ } | {
1929
+ type : "customWork" ;
1930
+ work : ( ) => string | undefined ;
1931
+ } ;
0 commit comments