@@ -1480,7 +1480,7 @@ namespace ts {
1480
1480
position ,
1481
1481
{ name, source } ,
1482
1482
host ,
1483
- ( formattingOptions && formatting . getFormatContext ( formattingOptions ) ) ! , // TODO: GH#18217
1483
+ ( formattingOptions && formatting . getFormatContext ( formattingOptions , host ) ) ! , // TODO: GH#18217
1484
1484
preferences ,
1485
1485
cancellationToken ,
1486
1486
) ;
@@ -1818,16 +1818,16 @@ namespace ts {
1818
1818
1819
1819
function getFormattingEditsForRange ( fileName : string , start : number , end : number , options : FormatCodeOptions | FormatCodeSettings ) : TextChange [ ] {
1820
1820
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 ) ) ;
1822
1822
}
1823
1823
1824
1824
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 ) ) ;
1826
1826
}
1827
1827
1828
1828
function getFormattingEditsAfterKeystroke ( fileName : string , position : number , key : string , options : FormatCodeOptions | FormatCodeSettings ) : TextChange [ ] {
1829
1829
const sourceFile = syntaxTreeCache . getCurrentSourceFile ( fileName ) ;
1830
- const formatContext = formatting . getFormatContext ( toEditorSettings ( options ) ) ;
1830
+ const formatContext = formatting . getFormatContext ( toEditorSettings ( options ) , host ) ;
1831
1831
1832
1832
if ( ! isInComment ( sourceFile , position ) ) {
1833
1833
switch ( key ) {
@@ -1849,7 +1849,7 @@ namespace ts {
1849
1849
synchronizeHostData ( ) ;
1850
1850
const sourceFile = getValidSourceFile ( fileName ) ;
1851
1851
const span = createTextSpanFromBounds ( start , end ) ;
1852
- const formatContext = formatting . getFormatContext ( formatOptions ) ;
1852
+ const formatContext = formatting . getFormatContext ( formatOptions , host ) ;
1853
1853
1854
1854
return flatMap ( deduplicate < number > ( errorCodes , equateValues , compareValues ) , errorCode => {
1855
1855
cancellationToken . throwIfCancellationRequested ( ) ;
@@ -1861,7 +1861,7 @@ namespace ts {
1861
1861
synchronizeHostData ( ) ;
1862
1862
Debug . assert ( scope . type === "file" ) ;
1863
1863
const sourceFile = getValidSourceFile ( scope . fileName ) ;
1864
- const formatContext = formatting . getFormatContext ( formatOptions ) ;
1864
+ const formatContext = formatting . getFormatContext ( formatOptions , host ) ;
1865
1865
1866
1866
return codefix . getAllFixes ( { fixId, sourceFile, program, host, cancellationToken, formatContext, preferences } ) ;
1867
1867
}
@@ -1870,13 +1870,13 @@ namespace ts {
1870
1870
synchronizeHostData ( ) ;
1871
1871
Debug . assert ( scope . type === "file" ) ;
1872
1872
const sourceFile = getValidSourceFile ( scope . fileName ) ;
1873
- const formatContext = formatting . getFormatContext ( formatOptions ) ;
1873
+ const formatContext = formatting . getFormatContext ( formatOptions , host ) ;
1874
1874
1875
1875
return OrganizeImports . organizeImports ( sourceFile , formatContext , host , program , preferences ) ;
1876
1876
}
1877
1877
1878
1878
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 ) ;
1880
1880
}
1881
1881
1882
1882
function applyCodeActionCommand ( action : CodeActionCommand , formatSettings ?: FormatCodeSettings ) : Promise < ApplyCodeActionCommandResult > ;
@@ -2119,7 +2119,7 @@ namespace ts {
2119
2119
endPosition,
2120
2120
program : getProgram ( ) ! ,
2121
2121
host,
2122
- formatContext : formatting . getFormatContext ( formatOptions ! ) , // TODO: GH#18217
2122
+ formatContext : formatting . getFormatContext ( formatOptions ! , host ) , // TODO: GH#18217
2123
2123
cancellationToken,
2124
2124
preferences,
2125
2125
} ;
0 commit comments