@@ -100,6 +100,8 @@ namespace FourSlash {
100100 end : number ;
101101 }
102102
103+ export import IndentStyle = ts . IndentStyle ;
104+
103105 let entityMap : ts . Map < string > = {
104106 "&" : "&" ,
105107 "\"" : """ ,
@@ -309,6 +311,7 @@ namespace FourSlash {
309311 TabSize : 4 ,
310312 NewLineCharacter : Harness . IO . newLine ( ) ,
311313 ConvertTabsToSpaces : true ,
314+ IndentStyle : ts . IndentStyle . Smart ,
312315 InsertSpaceAfterCommaDelimiter : true ,
313316 InsertSpaceAfterSemicolonInForStatements : true ,
314317 InsertSpaceBeforeAndAfterBinaryOperators : true ,
@@ -1695,24 +1698,28 @@ namespace FourSlash {
16951698 }
16961699 }
16971700
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 ) ;
17001707 }
17011708
1702- public verifyIndentationAtCurrentPosition ( numberOfSpaces : number ) {
1709+ public verifyIndentationAtCurrentPosition ( numberOfSpaces : number , indentStyle : ts . IndentStyle = ts . IndentStyle . Smart ) {
17031710 this . taoInvalidReason = "verifyIndentationAtCurrentPosition NYI" ;
17041711
1705- let actual = this . getIndentation ( this . activeFile . fileName , this . currentCaretPosition ) ;
1712+ let actual = this . getIndentation ( this . activeFile . fileName , this . currentCaretPosition , indentStyle ) ;
17061713 let lineCol = this . getLineColStringAtPosition ( this . currentCaretPosition ) ;
17071714 if ( actual !== numberOfSpaces ) {
17081715 this . raiseError ( `verifyIndentationAtCurrentPosition failed at ${ lineCol } - expected: ${ numberOfSpaces } , actual: ${ actual } ` ) ;
17091716 }
17101717 }
17111718
1712- public verifyIndentationAtPosition ( fileName : string , position : number , numberOfSpaces : number ) {
1719+ public verifyIndentationAtPosition ( fileName : string , position : number , numberOfSpaces : number , indentStyle : ts . IndentStyle = ts . IndentStyle . Smart ) {
17131720 this . taoInvalidReason = "verifyIndentationAtPosition NYI" ;
17141721
1715- let actual = this . getIndentation ( fileName , position ) ;
1722+ let actual = this . getIndentation ( fileName , position , indentStyle ) ;
17161723 let lineCol = this . getLineColStringAtPosition ( position ) ;
17171724 if ( actual !== numberOfSpaces ) {
17181725 this . raiseError ( `verifyIndentationAtPosition failed at ${ lineCol } - expected: ${ numberOfSpaces } , actual: ${ actual } ` ) ;
0 commit comments