@@ -1435,16 +1435,15 @@ Actual: ${stringify(fullActual)}`);
14351435 }
14361436 }
14371437
1438- public verifyNoSignatureHelp ( markers : ReadonlyArray < string > ) {
1438+ public verifyNoSignatureHelp ( triggerCharacter : ts . SignatureHelpTriggerCharacter | undefined , markers : ReadonlyArray < string > ) {
14391439 if ( markers . length ) {
14401440 for ( const marker of markers ) {
14411441 this . goToMarker ( marker ) ;
1442- this . verifyNoSignatureHelp ( ts . emptyArray ) ;
1442+ this . verifyNoSignatureHelp ( triggerCharacter , ts . emptyArray ) ;
14431443 }
14441444 return ;
14451445 }
1446-
1447- const actual = this . getSignatureHelp ( ) ;
1446+ const actual = this . getSignatureHelp ( { triggerCharacter } ) ;
14481447 if ( actual ) {
14491448 this . raiseError ( `Expected no signature help, but got "${ stringify ( actual ) } "` ) ;
14501449 }
@@ -1465,7 +1464,7 @@ Actual: ${stringify(fullActual)}`);
14651464 }
14661465
14671466 private verifySignatureHelpWorker ( options : FourSlashInterface . VerifySignatureHelpOptions ) {
1468- const help = this . getSignatureHelp ( ) ! ;
1467+ const help = this . getSignatureHelp ( { triggerCharacter : options . triggerCharacter } ) ! ;
14691468 const selectedItem = help . items [ help . selectedItemIndex ] ;
14701469 // Argument index may exceed number of parameters
14711470 const currentParameter = selectedItem . parameters [ help . argumentIndex ] as ts . SignatureHelpParameter | undefined ;
@@ -1507,6 +1506,7 @@ Actual: ${stringify(fullActual)}`);
15071506
15081507 const allKeys : ReadonlyArray < keyof FourSlashInterface . VerifySignatureHelpOptions > = [
15091508 "marker" ,
1509+ "triggerCharacter" ,
15101510 "overloadsCount" ,
15111511 "docComment" ,
15121512 "text" ,
@@ -1733,7 +1733,7 @@ Actual: ${stringify(fullActual)}`);
17331733 }
17341734
17351735 public printCurrentParameterHelp ( ) {
1736- const help = this . languageService . getSignatureHelpItems ( this . activeFile . fileName , this . currentCaretPosition ) ;
1736+ const help = this . languageService . getSignatureHelpItems ( this . activeFile . fileName , this . currentCaretPosition , /*options*/ undefined ) ;
17371737 Harness . IO . log ( stringify ( help ) ) ;
17381738 }
17391739
@@ -1774,12 +1774,14 @@ Actual: ${stringify(fullActual)}`);
17741774 }
17751775
17761776 public printCurrentSignatureHelp ( ) {
1777- const help = this . getSignatureHelp ( ) ! ;
1777+ const help = this . getSignatureHelp ( ts . emptyOptions ) ! ;
17781778 Harness . IO . log ( stringify ( help . items [ help . selectedItemIndex ] ) ) ;
17791779 }
17801780
1781- private getSignatureHelp ( ) : ts . SignatureHelpItems | undefined {
1782- return this . languageService . getSignatureHelpItems ( this . activeFile . fileName , this . currentCaretPosition ) ;
1781+ private getSignatureHelp ( { triggerCharacter } : FourSlashInterface . VerifySignatureHelpOptions ) : ts . SignatureHelpItems | undefined {
1782+ return this . languageService . getSignatureHelpItems ( this . activeFile . fileName , this . currentCaretPosition , {
1783+ triggerCharacter
1784+ } ) ;
17831785 }
17841786
17851787 public printCompletionListMembers ( preferences : ts . UserPreferences | undefined ) {
@@ -1875,13 +1877,13 @@ Actual: ${stringify(fullActual)}`);
18751877 offset ++ ;
18761878
18771879 if ( highFidelity ) {
1878- if ( ch === "(" || ch === "," ) {
1880+ if ( ch === "(" || ch === "," || ch === "<" ) {
18791881 /* Signature help*/
1880- this . languageService . getSignatureHelpItems ( this . activeFile . fileName , offset ) ;
1882+ this . languageService . getSignatureHelpItems ( this . activeFile . fileName , offset , { triggerCharacter : ch } ) ;
18811883 }
18821884 else if ( prevChar === " " && / A - Z a - z _ / . test ( ch ) ) {
18831885 /* Completions */
1884- this . languageService . getCompletionsAtPosition ( this . activeFile . fileName , offset , ts . defaultPreferences ) ;
1886+ this . languageService . getCompletionsAtPosition ( this . activeFile . fileName , offset , ts . emptyOptions ) ;
18851887 }
18861888
18871889 if ( i % checkCadence === 0 ) {
@@ -2514,7 +2516,7 @@ Actual: ${stringify(fullActual)}`);
25142516 `Expected '${ fixId } '. Available action ids: ${ ts . mapDefined ( this . getCodeFixes ( this . activeFile . fileName ) , a => a . fixId ) } ` ) ;
25152517 ts . Debug . assertEqual ( fixWithId ! . fixAllDescription , fixAllDescription ) ;
25162518
2517- const { changes, commands } = this . languageService . getCombinedCodeFix ( { type : "file" , fileName : this . activeFile . fileName } , fixId , this . formatCodeSettings , ts . defaultPreferences ) ;
2519+ const { changes, commands } = this . languageService . getCombinedCodeFix ( { type : "file" , fileName : this . activeFile . fileName } , fixId , this . formatCodeSettings , ts . emptyOptions ) ;
25182520 assert . deepEqual < ReadonlyArray < { } > | undefined > ( commands , expectedCommands ) ;
25192521 assert ( changes . every ( c => c . fileName === this . activeFile . fileName ) , "TODO: support testing codefixes that touch multiple files" ) ;
25202522 this . applyChanges ( changes ) ;
@@ -2594,7 +2596,7 @@ Actual: ${stringify(fullActual)}`);
25942596 * Rerieves a codefix satisfying the parameters, or undefined if no such codefix is found.
25952597 * @param fileName Path to file where error should be retrieved from.
25962598 */
2597- private getCodeFixes ( fileName : string , errorCode ?: number , preferences : ts . UserPreferences = ts . defaultPreferences ) : ts . CodeFixAction [ ] {
2599+ private getCodeFixes ( fileName : string , errorCode ?: number , preferences : ts . UserPreferences = ts . emptyOptions ) : ts . CodeFixAction [ ] {
25982600 const diagnosticsForCodeFix = this . getDiagnostics ( fileName , /*includeSuggestions*/ true ) . map ( diagnostic => ( {
25992601 start : diagnostic . start ,
26002602 length : diagnostic . length ,
@@ -3072,7 +3074,7 @@ Actual: ${stringify(fullActual)}`);
30723074 this . raiseError ( `Expected action description to be ${ JSON . stringify ( actionDescription ) } , got: ${ JSON . stringify ( action . description ) } ` ) ;
30733075 }
30743076
3075- const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , this . formatCodeSettings , range , refactorName , actionName , ts . defaultPreferences ) ! ;
3077+ const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , this . formatCodeSettings , range , refactorName , actionName , ts . emptyOptions ) ! ;
30763078 for ( const edit of editInfo . edits ) {
30773079 this . applyEdits ( edit . fileName , edit . textChanges , /*isFormattingEdit*/ false ) ;
30783080 }
@@ -3124,7 +3126,7 @@ Actual: ${stringify(fullActual)}`);
31243126 const action = ts . first ( refactor . actions ) ;
31253127 assert ( action . name === "Move to a new file" && action . description === "Move to a new file" ) ;
31263128
3127- const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , this . formatCodeSettings , range , refactor . name , action . name , options . preferences || ts . defaultPreferences ) ! ;
3129+ const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , this . formatCodeSettings , range , refactor . name , action . name , options . preferences || ts . emptyOptions ) ! ;
31283130 this . testNewFileContents ( editInfo . edits , options . newFileContents ) ;
31293131 }
31303132
@@ -3162,14 +3164,14 @@ Actual: ${stringify(fullActual)}`);
31623164 formattingOptions = formattingOptions || this . formatCodeSettings ;
31633165 const markerPos = this . getMarkerByName ( markerName ) . position ;
31643166
3165- const applicableRefactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , markerPos , ts . defaultPreferences ) ;
3167+ const applicableRefactors = this . languageService . getApplicableRefactors ( this . activeFile . fileName , markerPos , ts . emptyOptions ) ;
31663168 const applicableRefactorToApply = ts . find ( applicableRefactors , refactor => refactor . name === refactorNameToApply ) ;
31673169
31683170 if ( ! applicableRefactorToApply ) {
31693171 this . raiseError ( `The expected refactor: ${ refactorNameToApply } is not available at the marker location.` ) ;
31703172 }
31713173
3172- const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , formattingOptions , markerPos , refactorNameToApply , actionName , ts . defaultPreferences ) ! ;
3174+ const editInfo = this . languageService . getEditsForRefactor ( this . activeFile . fileName , formattingOptions , markerPos , refactorNameToApply , actionName , ts . emptyOptions ) ! ;
31733175
31743176 for ( const edit of editInfo . edits ) {
31753177 this . applyEdits ( edit . fileName , edit . textChanges , /*isFormattingEdit*/ false ) ;
@@ -3358,11 +3360,11 @@ Actual: ${stringify(fullActual)}`);
33583360 }
33593361
33603362 public getEditsForFileRename ( options : FourSlashInterface . GetEditsForFileRenameOptions ) : void {
3361- const changes = this . languageService . getEditsForFileRename ( options . oldPath , options . newPath , this . formatCodeSettings , ts . defaultPreferences ) ;
3363+ const changes = this . languageService . getEditsForFileRename ( options . oldPath , options . newPath , this . formatCodeSettings , ts . emptyOptions ) ;
33623364 this . testNewFileContents ( changes , options . newFileContents ) ;
33633365 }
33643366
3365- private getApplicableRefactors ( positionOrRange : number | ts . TextRange , preferences = ts . defaultPreferences ) : ReadonlyArray < ts . ApplicableRefactorInfo > {
3367+ private getApplicableRefactors ( positionOrRange : number | ts . TextRange , preferences = ts . emptyOptions ) : ReadonlyArray < ts . ApplicableRefactorInfo > {
33663368 return this . languageService . getApplicableRefactors ( this . activeFile . fileName , positionOrRange , preferences ) || ts . emptyArray ;
33673369 }
33683370 }
@@ -4038,7 +4040,11 @@ namespace FourSlashInterface {
40384040 }
40394041
40404042 public noSignatureHelp ( ...markers : string [ ] ) : void {
4041- this . state . verifyNoSignatureHelp ( markers ) ;
4043+ this . state . verifyNoSignatureHelp ( /*triggerCharacter*/ undefined , markers ) ;
4044+ }
4045+
4046+ public noSignatureHelpForTriggerCharacter ( triggerCharacter : ts . SignatureHelpTriggerCharacter , ...markers : string [ ] ) : void {
4047+ this . state . verifyNoSignatureHelp ( triggerCharacter , markers ) ;
40424048 }
40434049
40444050 public signatureHelp ( ...options : VerifySignatureHelpOptions [ ] ) : void {
@@ -4765,6 +4771,7 @@ namespace FourSlashInterface {
47654771 readonly isVariadic ?: boolean ;
47664772 /** @default ts.emptyArray */
47674773 readonly tags ?: ReadonlyArray < ts . JSDocTagInfo > ;
4774+ readonly triggerCharacter ?: ts . SignatureHelpTriggerCharacter ;
47684775 }
47694776
47704777 export type ArrayOrSingle < T > = T | ReadonlyArray < T > ;
0 commit comments