@@ -99,6 +99,8 @@ module FourSlash {
99
99
end : number ;
100
100
}
101
101
102
+ export import IndentStyle = ts . IndentStyle ;
103
+
102
104
let entityMap : ts . Map < string > = {
103
105
"&" : "&" ,
104
106
"\"" : """ ,
@@ -307,6 +309,7 @@ module FourSlash {
307
309
TabSize : 4 ,
308
310
NewLineCharacter : Harness . IO . newLine ( ) ,
309
311
ConvertTabsToSpaces : true ,
312
+ IndentStyle : ts . IndentStyle . Smart ,
310
313
InsertSpaceAfterCommaDelimiter : true ,
311
314
InsertSpaceAfterSemicolonInForStatements : true ,
312
315
InsertSpaceBeforeAndAfterBinaryOperators : true ,
@@ -1678,24 +1681,28 @@ module FourSlash {
1678
1681
}
1679
1682
}
1680
1683
1681
- private getIndentation ( fileName : string , position : number ) : number {
1682
- return this . languageService . getIndentationAtPosition ( fileName , position , this . formatCodeOptions ) ;
1684
+ private getIndentation ( fileName : string , position : number , indentStyle : ts . IndentStyle ) : number {
1685
+
1686
+ let formatOptions = ts . clone ( this . formatCodeOptions ) ;
1687
+ formatOptions . IndentStyle = indentStyle ;
1688
+
1689
+ return this . languageService . getIndentationAtPosition ( fileName , position , formatOptions ) ;
1683
1690
}
1684
1691
1685
- public verifyIndentationAtCurrentPosition ( numberOfSpaces : number ) {
1692
+ public verifyIndentationAtCurrentPosition ( numberOfSpaces : number , indentStyle : ts . IndentStyle = ts . IndentStyle . Smart ) {
1686
1693
this . taoInvalidReason = "verifyIndentationAtCurrentPosition NYI" ;
1687
1694
1688
- let actual = this . getIndentation ( this . activeFile . fileName , this . currentCaretPosition ) ;
1695
+ let actual = this . getIndentation ( this . activeFile . fileName , this . currentCaretPosition , indentStyle ) ;
1689
1696
let lineCol = this . getLineColStringAtPosition ( this . currentCaretPosition ) ;
1690
1697
if ( actual !== numberOfSpaces ) {
1691
1698
this . raiseError ( `verifyIndentationAtCurrentPosition failed at ${ lineCol } - expected: ${ numberOfSpaces } , actual: ${ actual } ` ) ;
1692
1699
}
1693
1700
}
1694
1701
1695
- public verifyIndentationAtPosition ( fileName : string , position : number , numberOfSpaces : number ) {
1702
+ public verifyIndentationAtPosition ( fileName : string , position : number , numberOfSpaces : number , indentStyle : ts . IndentStyle = ts . IndentStyle . Smart ) {
1696
1703
this . taoInvalidReason = "verifyIndentationAtPosition NYI" ;
1697
1704
1698
- let actual = this . getIndentation ( fileName , position ) ;
1705
+ let actual = this . getIndentation ( fileName , position , indentStyle ) ;
1699
1706
let lineCol = this . getLineColStringAtPosition ( position ) ;
1700
1707
if ( actual !== numberOfSpaces ) {
1701
1708
this . raiseError ( `verifyIndentationAtPosition failed at ${ lineCol } - expected: ${ numberOfSpaces } , actual: ${ actual } ` ) ;
0 commit comments