File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2248,22 +2248,23 @@ namespace FourSlash {
22482248
22492249 if ( expected === undefined ) {
22502250 if ( actual ) {
2251- this . raiseError ( name + " failed - expected no template but got {newText: \"" + actual . newText + "\" caretOffset: " + actual . caretOffset + "}" ) ;
2251+ this . raiseError ( ` ${ name } failed - expected no template but got {newText: " ${ actual . newText } ", caretOffset: ${ actual . caretOffset } }` ) ;
22522252 }
22532253
22542254 return ;
22552255 }
22562256 else {
22572257 if ( actual === undefined ) {
2258- this . raiseError ( name + " failed - expected the template {newText: \"" + actual . newText + "\" caretOffset: " + actual . caretOffset + "} but got nothing instead" ) ;
2258+ this . raiseError ( `${ name } failed - expected the template {newText: "${ expected . newText } ", caretOffset: "${ expected . caretOffset } "} but got nothing instead` ) ;
2259+
22592260 }
22602261
22612262 if ( actual . newText !== expected . newText ) {
2262- this . raiseError ( name + " failed - expected insertion:\n" + this . clarifyNewlines ( expected . newText ) + "\nactual insertion:\n" + this . clarifyNewlines ( actual . newText ) ) ;
2263+ this . raiseError ( ` ${ name } failed - expected insertion:\n"${ this . clarifyNewlines ( expected . newText ) } "\nactual insertion:\n"${ this . clarifyNewlines ( actual . newText ) } "` ) ;
22632264 }
22642265
22652266 if ( actual . caretOffset !== expected . caretOffset ) {
2266- this . raiseError ( name + " failed - expected caretOffset: " + expected . caretOffset + ", \nactual caretOffset:" + actual . caretOffset ) ;
2267+ this . raiseError ( ` ${ name } failed - expected caretOffset: ${ expected . caretOffset } \nactual caretOffset:${ actual . caretOffset } ` ) ;
22672268 }
22682269 }
22692270 }
Original file line number Diff line number Diff line change @@ -178,7 +178,8 @@ namespace ts.JsDoc {
178178 const posLineAndChar = sourceFile . getLineAndCharacterOfPosition ( position ) ;
179179 const lineStart = sourceFile . getLineStarts ( ) [ posLineAndChar . line ] ;
180180
181- const indentationStr = sourceFile . text . substr ( lineStart , posLineAndChar . character ) ;
181+ // replace non-whitespace characters in prefix with spaces.
182+ const indentationStr = sourceFile . text . substr ( lineStart , posLineAndChar . character ) . replace ( / \S / i, ( ) => " " ) ;
182183 const isJavaScriptFile = hasJavaScriptFileExtension ( sourceFile . fileName ) ;
183184
184185 let docParams = "" ;
Original file line number Diff line number Diff line change 11/// <reference path='fourslash.ts' />
22
33// @Filename : indents.ts
4- /////*0 */
4+ //// a /*2 */
55//// /*1*/
6- //// /*2*/ function foo() { }
6+ /////*0*/ function foo() { }
77
88const noIndentEmptyScaffolding = "/**\r\n * \r\n */" ;
99const oneIndentEmptyScaffolding = "/**\r\n * \r\n */" ;
10- const twoIndentEmptyScaffolding = "/**\r\n * \r\n */\r\n " ;
10+ const twoIndentEmptyScaffolding = "/**\r\n * \r\n */" ;
1111const noIndentOffset = 8 ;
1212const oneIndentOffset = noIndentOffset + 4 ;
1313const twoIndentOffset = oneIndentOffset + 4 ;
@@ -19,4 +19,4 @@ goTo.marker("1");
1919verify . DocCommentTemplate ( oneIndentEmptyScaffolding , oneIndentOffset ) ;
2020
2121goTo . marker ( "2" ) ;
22- verify . DocCommentTemplate ( twoIndentEmptyScaffolding , twoIndentOffset ) ;
22+ verify . DocCommentTemplate ( twoIndentEmptyScaffolding , twoIndentOffset ) ;
You can’t perform that action at this time.
0 commit comments