@@ -1227,8 +1227,8 @@ Actual: ${stringify(fullActual)}`);
1227
1227
return this . languageService . getCompletionsAtPosition ( this . activeFile . fileName , this . currentCaretPosition , options ) ;
1228
1228
}
1229
1229
1230
- private getCompletionEntryDetails ( entryName : string , source ?: string , options ?: ts . Options ) : ts . CompletionEntryDetails {
1231
- return this . languageService . getCompletionEntryDetails ( this . activeFile . fileName , this . currentCaretPosition , entryName , this . formatCodeSettings , source , options ) ;
1230
+ private getCompletionEntryDetails ( entryName : string , source ?: string , preferences ?: ts . UserPreferences ) : ts . CompletionEntryDetails {
1231
+ return this . languageService . getCompletionEntryDetails ( this . activeFile . fileName , this . currentCaretPosition , entryName , this . formatCodeSettings , source , preferences ) ;
1232
1232
}
1233
1233
1234
1234
private getReferencesAtCaret ( ) {
@@ -1727,8 +1727,8 @@ Actual: ${stringify(fullActual)}`);
1727
1727
Harness . IO . log ( stringify ( sigHelp ) ) ;
1728
1728
}
1729
1729
1730
- public printCompletionListMembers ( options : ts . Options | undefined ) {
1731
- const completions = this . getCompletionListAtCaret ( options ) ;
1730
+ public printCompletionListMembers ( preferences : ts . UserPreferences | undefined ) {
1731
+ const completions = this . getCompletionListAtCaret ( preferences ) ;
1732
1732
this . printMembersOrCompletions ( completions ) ;
1733
1733
}
1734
1734
@@ -1826,7 +1826,7 @@ Actual: ${stringify(fullActual)}`);
1826
1826
}
1827
1827
else if ( prevChar === " " && / A - Z a - z _ / . test ( ch ) ) {
1828
1828
/* Completions */
1829
- this . languageService . getCompletionsAtPosition ( this . activeFile . fileName , offset , ts . defaultOptions ) ;
1829
+ this . languageService . getCompletionsAtPosition ( this . activeFile . fileName , offset , ts . defaultPreferences ) ;
1830
1830
}
1831
1831
1832
1832
if ( i % checkCadence === 0 ) {
@@ -2401,14 +2401,14 @@ Actual: ${stringify(fullActual)}`);
2401
2401
public applyCodeActionFromCompletion ( markerName : string , options : FourSlashInterface . VerifyCompletionActionOptions ) {
2402
2402
this . goToMarker ( markerName ) ;
2403
2403
2404
- const actualCompletion = this . getCompletionListAtCaret ( { ...ts . defaultOptions , includeCompletionsForModuleExports : true } ) . entries . find ( e =>
2404
+ const actualCompletion = this . getCompletionListAtCaret ( { ...ts . defaultPreferences , includeCompletionsForModuleExports : true } ) . entries . find ( e =>
2405
2405
e . name === options . name && e . source === options . source ) ;
2406
2406
2407
2407
if ( ! actualCompletion . hasAction ) {
2408
2408
this . raiseError ( `Completion for ${ options . name } does not have an associated action.` ) ;
2409
2409
}
2410
2410
2411
- const details = this . getCompletionEntryDetails ( options . name , actualCompletion . source , options . options ) ;
2411
+ const details = this . getCompletionEntryDetails ( options . name , actualCompletion . source , options . preferences ) ;
2412
2412
if ( details . codeActions . length !== 1 ) {
2413
2413
this . raiseError ( `Expected one code action, got ${ details . codeActions . length } ` ) ;
2414
2414
}
@@ -2453,7 +2453,7 @@ Actual: ${stringify(fullActual)}`);
2453
2453
const { fixId, newFileContent } = options ;
2454
2454
const fixIds = ts . mapDefined ( this . getCodeFixes ( this . activeFile . fileName ) , a => a . fixId ) ;
2455
2455
ts . Debug . assert ( ts . contains ( fixIds , fixId ) , "No available code fix has that group id." , ( ) => `Expected '${ fixId } '. Available action ids: ${ fixIds } ` ) ;
2456
- const { changes, commands } = this . languageService . getCombinedCodeFix ( { type : "file" , fileName : this . activeFile . fileName } , fixId , this . formatCodeSettings , ts . defaultOptions ) ;
2456
+ const { changes, commands } = this . languageService . getCombinedCodeFix ( { type : "file" , fileName : this . activeFile . fileName } , fixId , this . formatCodeSettings , ts . defaultPreferences ) ;
2457
2457
assert . deepEqual ( commands , options . commands ) ;
2458
2458
assert ( changes . every ( c => c . fileName === this . activeFile . fileName ) , "TODO: support testing codefixes that touch multiple files" ) ;
2459
2459
this . applyChanges ( changes ) ;
@@ -2482,7 +2482,7 @@ Actual: ${stringify(fullActual)}`);
2482
2482
2483
2483
public verifyCodeFix ( options : FourSlashInterface . VerifyCodeFixOptions ) {
2484
2484
const fileName = this . activeFile . fileName ;
2485
- const actions = this . getCodeFixes ( fileName , options . errorCode , options . options ) ;
2485
+ const actions = this . getCodeFixes ( fileName , options . errorCode , options . preferences ) ;
2486
2486
let index = options . index ;
2487
2487
if ( index === undefined ) {
2488
2488
if ( ! ( actions && actions . length === 1 ) ) {
@@ -2521,7 +2521,7 @@ Actual: ${stringify(fullActual)}`);
2521
2521
* Rerieves a codefix satisfying the parameters, or undefined if no such codefix is found.
2522
2522
* @param fileName Path to file where error should be retrieved from.
2523
2523
*/
2524
- private getCodeFixes ( fileName : string , errorCode ?: number , options : ts . Options = ts . defaultOptions ) : ts . CodeFixAction [ ] {
2524
+ private getCodeFixes ( fileName : string , errorCode ?: number , preferences : ts . UserPreferences = ts . defaultPreferences ) : ts . CodeFixAction [ ] {
2525
2525
const diagnosticsForCodeFix = this . getDiagnostics ( fileName , /*includeSuggestions*/ true ) . map ( diagnostic => ( {
2526
2526
start : diagnostic . start ,
2527
2527
length : diagnostic . length ,
@@ -2533,7 +2533,7 @@ Actual: ${stringify(fullActual)}`);
2533
2533
return ;
2534
2534
}
2535
2535
2536
- return this . languageService . getCodeFixesAtPosition ( fileName , diagnostic . start , diagnostic . start + diagnostic . length , [ diagnostic . code ] , this . formatCodeSettings , options ) ;
2536
+ return this . languageService . getCodeFixesAtPosition ( fileName , diagnostic . start , diagnostic . start + diagnostic . length , [ diagnostic . code ] , this . formatCodeSettings , preferences ) ;
2537
2537
} ) ;
2538
2538
}
2539
2539
@@ -2559,15 +2559,15 @@ Actual: ${stringify(fullActual)}`);
2559
2559
}
2560
2560
}
2561
2561
2562
- public verifyImportFixAtPosition ( expectedTextArray : string [ ] , errorCode : number | undefined , options : ts . Options | undefined ) {
2562
+ public verifyImportFixAtPosition ( expectedTextArray : string [ ] , errorCode : number | undefined , preferences : ts . UserPreferences | undefined ) {
2563
2563
const { fileName } = this . activeFile ;
2564
2564
const ranges = this . getRanges ( ) . filter ( r => r . fileName === fileName ) ;
2565
2565
if ( ranges . length !== 1 ) {
2566
2566
this . raiseError ( "Exactly one range should be specified in the testfile." ) ;
2567
2567
}
2568
2568
const range = ts . first ( ranges ) ;
2569
2569
2570
- const codeFixes = this . getCodeFixes ( fileName , errorCode , options ) ;
2570
+ const codeFixes = this . getCodeFixes ( fileName , errorCode , preferences ) ;
2571
2571
2572
2572
if ( codeFixes . length === 0 ) {
2573
2573
if ( expectedTextArray . length !== 0 ) {
@@ -2937,7 +2937,7 @@ Actual: ${stringify(fullActual)}`);
2937
2937
2938
2938
public verifyApplicableRefactorAvailableAtMarker ( negative : boolean , markerName : string ) {
2939
2939
const marker = this . getMarkerByName ( markerName ) ;
2940
- const applicableRefactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , marker . position , ts . defaultOptions ) ;
2940
+ const applicableRefactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , marker . position , ts . defaultPreferences ) ;
2941
2941
const isAvailable = applicableRefactors && applicableRefactors . length > 0 ;
2942
2942
if ( negative && isAvailable ) {
2943
2943
this . raiseError ( `verifyApplicableRefactorAvailableAtMarker failed - expected no refactor at marker ${ markerName } but found some.` ) ;
@@ -2957,7 +2957,7 @@ Actual: ${stringify(fullActual)}`);
2957
2957
public verifyRefactorAvailable ( negative : boolean , name : string , actionName ?: string ) {
2958
2958
const selection = this . getSelection ( ) ;
2959
2959
2960
- let refactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , selection , ts . defaultOptions ) || [ ] ;
2960
+ let refactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , selection , ts . defaultPreferences ) || [ ] ;
2961
2961
refactors = refactors . filter ( r => r . name === name && ( actionName === undefined || r . actions . some ( a => a . name === actionName ) ) ) ;
2962
2962
const isAvailable = refactors . length > 0 ;
2963
2963
@@ -2979,7 +2979,7 @@ Actual: ${stringify(fullActual)}`);
2979
2979
public verifyRefactor ( { name, actionName, refactors } : FourSlashInterface . VerifyRefactorOptions ) {
2980
2980
const selection = this . getSelection ( ) ;
2981
2981
2982
- const actualRefactors = ( this . languageService . getApplicableRefactors ( this . activeFile . fileName , selection , ts . defaultOptions ) || ts . emptyArray )
2982
+ const actualRefactors = ( this . languageService . getApplicableRefactors ( this . activeFile . fileName , selection , ts . defaultPreferences ) || ts . emptyArray )
2983
2983
. filter ( r => r . name === name && r . actions . some ( a => a . name === actionName ) ) ;
2984
2984
this . assertObjectsEqual ( actualRefactors , refactors ) ;
2985
2985
}
@@ -2990,7 +2990,7 @@ Actual: ${stringify(fullActual)}`);
2990
2990
throw new Error ( "Exactly one refactor range is allowed per test." ) ;
2991
2991
}
2992
2992
2993
- const applicableRefactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , ts . first ( ranges ) , ts . defaultOptions ) ;
2993
+ const applicableRefactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , ts . first ( ranges ) , ts . defaultPreferences ) ;
2994
2994
const isAvailable = applicableRefactors && applicableRefactors . length > 0 ;
2995
2995
if ( negative && isAvailable ) {
2996
2996
this . raiseError ( `verifyApplicableRefactorAvailableForRange failed - expected no refactor but found some.` ) ;
@@ -3002,7 +3002,7 @@ Actual: ${stringify(fullActual)}`);
3002
3002
3003
3003
public applyRefactor ( { refactorName, actionName, actionDescription, newContent : newContentWithRenameMarker } : FourSlashInterface . ApplyRefactorOptions ) {
3004
3004
const range = this . getSelection ( ) ;
3005
- const refactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , range , ts . defaultOptions ) ;
3005
+ const refactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , range , ts . defaultPreferences ) ;
3006
3006
const refactorsWithName = refactors . filter ( r => r . name === refactorName ) ;
3007
3007
if ( refactorsWithName . length === 0 ) {
3008
3008
this . raiseError ( `The expected refactor: ${ refactorName } is not available at the marker location.\nAvailable refactors: ${ refactors . map ( r => r . name ) } ` ) ;
@@ -3016,7 +3016,7 @@ Actual: ${stringify(fullActual)}`);
3016
3016
this . raiseError ( `Expected action description to be ${ JSON . stringify ( actionDescription ) } , got: ${ JSON . stringify ( action . description ) } ` ) ;
3017
3017
}
3018
3018
3019
- const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , this . formatCodeSettings , range , refactorName , actionName , ts . defaultOptions ) ;
3019
+ const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , this . formatCodeSettings , range , refactorName , actionName , ts . defaultPreferences ) ;
3020
3020
for ( const edit of editInfo . edits ) {
3021
3021
this . applyEdits ( edit . fileName , edit . textChanges , /*isFormattingEdit*/ false ) ;
3022
3022
}
@@ -3061,14 +3061,14 @@ Actual: ${stringify(fullActual)}`);
3061
3061
formattingOptions = formattingOptions || this . formatCodeSettings ;
3062
3062
const markerPos = this . getMarkerByName ( markerName ) . position ;
3063
3063
3064
- const applicableRefactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , markerPos , ts . defaultOptions ) ;
3064
+ const applicableRefactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , markerPos , ts . defaultPreferences ) ;
3065
3065
const applicableRefactorToApply = ts . find ( applicableRefactors , refactor => refactor . name === refactorNameToApply ) ;
3066
3066
3067
3067
if ( ! applicableRefactorToApply ) {
3068
3068
this . raiseError ( `The expected refactor: ${ refactorNameToApply } is not available at the marker location.` ) ;
3069
3069
}
3070
3070
3071
- const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , formattingOptions , markerPos , refactorNameToApply , actionName , ts . defaultOptions ) ;
3071
+ const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , formattingOptions , markerPos , refactorNameToApply , actionName , ts . defaultPreferences ) ;
3072
3072
3073
3073
for ( const edit of editInfo . edits ) {
3074
3074
this . applyEdits ( edit . fileName , edit . textChanges , /*isFormattingEdit*/ false ) ;
@@ -4233,7 +4233,7 @@ namespace FourSlashInterface {
4233
4233
this . state . applyCodeActionFromCompletion ( markerName , options ) ;
4234
4234
}
4235
4235
4236
- public importFixAtPosition ( expectedTextArray : string [ ] , errorCode ?: number , options ?: ts . Options ) : void {
4236
+ public importFixAtPosition ( expectedTextArray : string [ ] , errorCode ?: number , options ?: ts . UserPreferences ) : void {
4237
4237
this . state . verifyImportFixAtPosition ( expectedTextArray , errorCode , options ) ;
4238
4238
}
4239
4239
@@ -4440,7 +4440,7 @@ namespace FourSlashInterface {
4440
4440
this . state . printCurrentSignatureHelp ( ) ;
4441
4441
}
4442
4442
4443
- public printCompletionListMembers ( options : ts . Options | undefined ) {
4443
+ public printCompletionListMembers ( options : ts . UserPreferences | undefined ) {
4444
4444
this . state . printCompletionListMembers ( options ) ;
4445
4445
}
4446
4446
@@ -4637,11 +4637,11 @@ namespace FourSlashInterface {
4637
4637
}
4638
4638
4639
4639
export type ExpectedCompletionEntry = string | { name : string , insertText ?: string , replacementSpan ?: FourSlash . Range } ;
4640
- export interface CompletionsAtOptions extends Partial < ts . Options > {
4640
+ export interface CompletionsAtOptions extends Partial < ts . UserPreferences > {
4641
4641
isNewIdentifierLocation ?: boolean ;
4642
4642
}
4643
4643
4644
- export interface VerifyCompletionListContainsOptions extends ts . Options {
4644
+ export interface VerifyCompletionListContainsOptions extends ts . UserPreferences {
4645
4645
sourceDisplay : string ;
4646
4646
isRecommended ?: true ;
4647
4647
insertText ?: string ;
@@ -4662,7 +4662,7 @@ namespace FourSlashInterface {
4662
4662
description : string ;
4663
4663
errorCode ?: number ;
4664
4664
index ?: number ;
4665
- options ?: ts . Options ;
4665
+ preferences ?: ts . UserPreferences ;
4666
4666
}
4667
4667
4668
4668
export interface VerifyCodeFixAvailableOptions {
@@ -4686,7 +4686,7 @@ namespace FourSlashInterface {
4686
4686
name : string ;
4687
4687
source ?: string ;
4688
4688
description : string ;
4689
- options ?: ts . Options ;
4689
+ preferences ?: ts . UserPreferences ;
4690
4690
}
4691
4691
4692
4692
export interface Diagnostic {
0 commit comments