@@ -100,6 +100,8 @@ namespace FourSlash {
100
100
end : number ;
101
101
}
102
102
103
+ export import IndentStyle = ts . IndentStyle ;
104
+
103
105
let entityMap : ts . Map < string > = {
104
106
"&" : "&" ,
105
107
"\"" : """ ,
@@ -309,6 +311,7 @@ namespace FourSlash {
309
311
TabSize : 4 ,
310
312
NewLineCharacter : Harness . IO . newLine ( ) ,
311
313
ConvertTabsToSpaces : true ,
314
+ IndentStyle : ts . IndentStyle . Smart ,
312
315
InsertSpaceAfterCommaDelimiter : true ,
313
316
InsertSpaceAfterSemicolonInForStatements : true ,
314
317
InsertSpaceBeforeAndAfterBinaryOperators : true ,
@@ -1695,24 +1698,28 @@ namespace FourSlash {
1695
1698
}
1696
1699
}
1697
1700
1698
- private getIndentation ( fileName : string , position : number ) : number {
1699
- return this . languageService . getIndentationAtPosition ( fileName , position , this . formatCodeOptions ) ;
1701
+ private getIndentation ( fileName : string , position : number , indentStyle : ts . IndentStyle ) : number {
1702
+
1703
+ let formatOptions = ts . clone ( this . formatCodeOptions ) ;
1704
+ formatOptions . IndentStyle = indentStyle ;
1705
+
1706
+ return this . languageService . getIndentationAtPosition ( fileName , position , formatOptions ) ;
1700
1707
}
1701
1708
1702
- public verifyIndentationAtCurrentPosition ( numberOfSpaces : number ) {
1709
+ public verifyIndentationAtCurrentPosition ( numberOfSpaces : number , indentStyle : ts . IndentStyle = ts . IndentStyle . Smart ) {
1703
1710
this . taoInvalidReason = "verifyIndentationAtCurrentPosition NYI" ;
1704
1711
1705
- let actual = this . getIndentation ( this . activeFile . fileName , this . currentCaretPosition ) ;
1712
+ let actual = this . getIndentation ( this . activeFile . fileName , this . currentCaretPosition , indentStyle ) ;
1706
1713
let lineCol = this . getLineColStringAtPosition ( this . currentCaretPosition ) ;
1707
1714
if ( actual !== numberOfSpaces ) {
1708
1715
this . raiseError ( `verifyIndentationAtCurrentPosition failed at ${ lineCol } - expected: ${ numberOfSpaces } , actual: ${ actual } ` ) ;
1709
1716
}
1710
1717
}
1711
1718
1712
- public verifyIndentationAtPosition ( fileName : string , position : number , numberOfSpaces : number ) {
1719
+ public verifyIndentationAtPosition ( fileName : string , position : number , numberOfSpaces : number , indentStyle : ts . IndentStyle = ts . IndentStyle . Smart ) {
1713
1720
this . taoInvalidReason = "verifyIndentationAtPosition NYI" ;
1714
1721
1715
- let actual = this . getIndentation ( fileName , position ) ;
1722
+ let actual = this . getIndentation ( fileName , position , indentStyle ) ;
1716
1723
let lineCol = this . getLineColStringAtPosition ( position ) ;
1717
1724
if ( actual !== numberOfSpaces ) {
1718
1725
this . raiseError ( `verifyIndentationAtPosition failed at ${ lineCol } - expected: ${ numberOfSpaces } , actual: ${ actual } ` ) ;
0 commit comments