@@ -1480,7 +1480,7 @@ namespace ts {
14801480 position ,
14811481 { name, source } ,
14821482 host ,
1483- ( formattingOptions && formatting . getFormatContext ( formattingOptions ) ) ! , // TODO: GH#18217
1483+ ( formattingOptions && formatting . getFormatContext ( formattingOptions , host ) ) ! , // TODO: GH#18217
14841484 preferences ,
14851485 cancellationToken ,
14861486 ) ;
@@ -1818,16 +1818,16 @@ namespace ts {
18181818
18191819 function getFormattingEditsForRange ( fileName : string , start : number , end : number , options : FormatCodeOptions | FormatCodeSettings ) : TextChange [ ] {
18201820 const sourceFile = syntaxTreeCache . getCurrentSourceFile ( fileName ) ;
1821- return formatting . formatSelection ( start , end , sourceFile , formatting . getFormatContext ( toEditorSettings ( options ) ) ) ;
1821+ return formatting . formatSelection ( start , end , sourceFile , formatting . getFormatContext ( toEditorSettings ( options ) , host ) ) ;
18221822 }
18231823
18241824 function getFormattingEditsForDocument ( fileName : string , options : FormatCodeOptions | FormatCodeSettings ) : TextChange [ ] {
1825- return formatting . formatDocument ( syntaxTreeCache . getCurrentSourceFile ( fileName ) , formatting . getFormatContext ( toEditorSettings ( options ) ) ) ;
1825+ return formatting . formatDocument ( syntaxTreeCache . getCurrentSourceFile ( fileName ) , formatting . getFormatContext ( toEditorSettings ( options ) , host ) ) ;
18261826 }
18271827
18281828 function getFormattingEditsAfterKeystroke ( fileName : string , position : number , key : string , options : FormatCodeOptions | FormatCodeSettings ) : TextChange [ ] {
18291829 const sourceFile = syntaxTreeCache . getCurrentSourceFile ( fileName ) ;
1830- const formatContext = formatting . getFormatContext ( toEditorSettings ( options ) ) ;
1830+ const formatContext = formatting . getFormatContext ( toEditorSettings ( options ) , host ) ;
18311831
18321832 if ( ! isInComment ( sourceFile , position ) ) {
18331833 switch ( key ) {
@@ -1849,7 +1849,7 @@ namespace ts {
18491849 synchronizeHostData ( ) ;
18501850 const sourceFile = getValidSourceFile ( fileName ) ;
18511851 const span = createTextSpanFromBounds ( start , end ) ;
1852- const formatContext = formatting . getFormatContext ( formatOptions ) ;
1852+ const formatContext = formatting . getFormatContext ( formatOptions , host ) ;
18531853
18541854 return flatMap ( deduplicate < number > ( errorCodes , equateValues , compareValues ) , errorCode => {
18551855 cancellationToken . throwIfCancellationRequested ( ) ;
@@ -1861,7 +1861,7 @@ namespace ts {
18611861 synchronizeHostData ( ) ;
18621862 Debug . assert ( scope . type === "file" ) ;
18631863 const sourceFile = getValidSourceFile ( scope . fileName ) ;
1864- const formatContext = formatting . getFormatContext ( formatOptions ) ;
1864+ const formatContext = formatting . getFormatContext ( formatOptions , host ) ;
18651865
18661866 return codefix . getAllFixes ( { fixId, sourceFile, program, host, cancellationToken, formatContext, preferences } ) ;
18671867 }
@@ -1870,13 +1870,13 @@ namespace ts {
18701870 synchronizeHostData ( ) ;
18711871 Debug . assert ( scope . type === "file" ) ;
18721872 const sourceFile = getValidSourceFile ( scope . fileName ) ;
1873- const formatContext = formatting . getFormatContext ( formatOptions ) ;
1873+ const formatContext = formatting . getFormatContext ( formatOptions , host ) ;
18741874
18751875 return OrganizeImports . organizeImports ( sourceFile , formatContext , host , program , preferences ) ;
18761876 }
18771877
18781878 function getEditsForFileRename ( oldFilePath : string , newFilePath : string , formatOptions : FormatCodeSettings , preferences : UserPreferences = emptyOptions ) : readonly FileTextChanges [ ] {
1879- return ts . getEditsForFileRename ( getProgram ( ) ! , oldFilePath , newFilePath , host , formatting . getFormatContext ( formatOptions ) , preferences , sourceMapper ) ;
1879+ return ts . getEditsForFileRename ( getProgram ( ) ! , oldFilePath , newFilePath , host , formatting . getFormatContext ( formatOptions , host ) , preferences , sourceMapper ) ;
18801880 }
18811881
18821882 function applyCodeActionCommand ( action : CodeActionCommand , formatSettings ?: FormatCodeSettings ) : Promise < ApplyCodeActionCommandResult > ;
@@ -2119,7 +2119,7 @@ namespace ts {
21192119 endPosition,
21202120 program : getProgram ( ) ! ,
21212121 host,
2122- formatContext : formatting . getFormatContext ( formatOptions ! ) , // TODO: GH#18217
2122+ formatContext : formatting . getFormatContext ( formatOptions ! , host ) , // TODO: GH#18217
21232123 cancellationToken,
21242124 preferences,
21252125 } ;
0 commit comments