@@ -1502,7 +1502,7 @@ namespace ts {
1502
1502
position ,
1503
1503
{ name, source } ,
1504
1504
host ,
1505
- ( formattingOptions && formatting . getFormatContext ( formattingOptions ) ) ! , // TODO: GH#18217
1505
+ ( formattingOptions && formatting . getFormatContext ( formattingOptions , host ) ) ! , // TODO: GH#18217
1506
1506
preferences ,
1507
1507
cancellationToken ,
1508
1508
) ;
@@ -1840,16 +1840,16 @@ namespace ts {
1840
1840
1841
1841
function getFormattingEditsForRange ( fileName : string , start : number , end : number , options : FormatCodeOptions | FormatCodeSettings ) : TextChange [ ] {
1842
1842
const sourceFile = syntaxTreeCache . getCurrentSourceFile ( fileName ) ;
1843
- return formatting . formatSelection ( start , end , sourceFile , formatting . getFormatContext ( toEditorSettings ( options ) ) ) ;
1843
+ return formatting . formatSelection ( start , end , sourceFile , formatting . getFormatContext ( toEditorSettings ( options ) , host ) ) ;
1844
1844
}
1845
1845
1846
1846
function getFormattingEditsForDocument ( fileName : string , options : FormatCodeOptions | FormatCodeSettings ) : TextChange [ ] {
1847
- return formatting . formatDocument ( syntaxTreeCache . getCurrentSourceFile ( fileName ) , formatting . getFormatContext ( toEditorSettings ( options ) ) ) ;
1847
+ return formatting . formatDocument ( syntaxTreeCache . getCurrentSourceFile ( fileName ) , formatting . getFormatContext ( toEditorSettings ( options ) , host ) ) ;
1848
1848
}
1849
1849
1850
1850
function getFormattingEditsAfterKeystroke ( fileName : string , position : number , key : string , options : FormatCodeOptions | FormatCodeSettings ) : TextChange [ ] {
1851
1851
const sourceFile = syntaxTreeCache . getCurrentSourceFile ( fileName ) ;
1852
- const formatContext = formatting . getFormatContext ( toEditorSettings ( options ) ) ;
1852
+ const formatContext = formatting . getFormatContext ( toEditorSettings ( options ) , host ) ;
1853
1853
1854
1854
if ( ! isInComment ( sourceFile , position ) ) {
1855
1855
switch ( key ) {
@@ -1871,7 +1871,7 @@ namespace ts {
1871
1871
synchronizeHostData ( ) ;
1872
1872
const sourceFile = getValidSourceFile ( fileName ) ;
1873
1873
const span = createTextSpanFromBounds ( start , end ) ;
1874
- const formatContext = formatting . getFormatContext ( formatOptions ) ;
1874
+ const formatContext = formatting . getFormatContext ( formatOptions , host ) ;
1875
1875
1876
1876
return flatMap ( deduplicate < number > ( errorCodes , equateValues , compareValues ) , errorCode => {
1877
1877
cancellationToken . throwIfCancellationRequested ( ) ;
@@ -1883,7 +1883,7 @@ namespace ts {
1883
1883
synchronizeHostData ( ) ;
1884
1884
Debug . assert ( scope . type === "file" ) ;
1885
1885
const sourceFile = getValidSourceFile ( scope . fileName ) ;
1886
- const formatContext = formatting . getFormatContext ( formatOptions ) ;
1886
+ const formatContext = formatting . getFormatContext ( formatOptions , host ) ;
1887
1887
1888
1888
return codefix . getAllFixes ( { fixId, sourceFile, program, host, cancellationToken, formatContext, preferences } ) ;
1889
1889
}
@@ -1892,13 +1892,13 @@ namespace ts {
1892
1892
synchronizeHostData ( ) ;
1893
1893
Debug . assert ( scope . type === "file" ) ;
1894
1894
const sourceFile = getValidSourceFile ( scope . fileName ) ;
1895
- const formatContext = formatting . getFormatContext ( formatOptions ) ;
1895
+ const formatContext = formatting . getFormatContext ( formatOptions , host ) ;
1896
1896
1897
1897
return OrganizeImports . organizeImports ( sourceFile , formatContext , host , program , preferences ) ;
1898
1898
}
1899
1899
1900
1900
function getEditsForFileRename ( oldFilePath : string , newFilePath : string , formatOptions : FormatCodeSettings , preferences : UserPreferences = emptyOptions ) : readonly FileTextChanges [ ] {
1901
- return ts . getEditsForFileRename ( getProgram ( ) ! , oldFilePath , newFilePath , host , formatting . getFormatContext ( formatOptions ) , preferences , sourceMapper ) ;
1901
+ return ts . getEditsForFileRename ( getProgram ( ) ! , oldFilePath , newFilePath , host , formatting . getFormatContext ( formatOptions , host ) , preferences , sourceMapper ) ;
1902
1902
}
1903
1903
1904
1904
function applyCodeActionCommand ( action : CodeActionCommand , formatSettings ?: FormatCodeSettings ) : Promise < ApplyCodeActionCommandResult > ;
@@ -2141,7 +2141,7 @@ namespace ts {
2141
2141
endPosition,
2142
2142
program : getProgram ( ) ! ,
2143
2143
host,
2144
- formatContext : formatting . getFormatContext ( formatOptions ! ) , // TODO: GH#18217
2144
+ formatContext : formatting . getFormatContext ( formatOptions ! , host ) , // TODO: GH#18217
2145
2145
cancellationToken,
2146
2146
preferences,
2147
2147
} ;
0 commit comments