File tree 3 files changed +11
-9
lines changed
3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -2248,22 +2248,23 @@ namespace FourSlash {
2248
2248
2249
2249
if ( expected === undefined ) {
2250
2250
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 } }` ) ;
2252
2252
}
2253
2253
2254
2254
return ;
2255
2255
}
2256
2256
else {
2257
2257
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
+
2259
2260
}
2260
2261
2261
2262
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 ) } "` ) ;
2263
2264
}
2264
2265
2265
2266
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 } ` ) ;
2267
2268
}
2268
2269
}
2269
2270
}
Original file line number Diff line number Diff line change @@ -178,7 +178,8 @@ namespace ts.JsDoc {
178
178
const posLineAndChar = sourceFile . getLineAndCharacterOfPosition ( position ) ;
179
179
const lineStart = sourceFile . getLineStarts ( ) [ posLineAndChar . line ] ;
180
180
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, ( ) => " " ) ;
182
183
const isJavaScriptFile = hasJavaScriptFileExtension ( sourceFile . fileName ) ;
183
184
184
185
let docParams = "" ;
Original file line number Diff line number Diff line change 1
1
/// <reference path='fourslash.ts' />
2
2
3
3
// @Filename : indents.ts
4
- /////*0 */
4
+ //// a /*2 */
5
5
//// /*1*/
6
- //// /*2*/ function foo() { }
6
+ /////*0*/ function foo() { }
7
7
8
8
const noIndentEmptyScaffolding = "/**\r\n * \r\n */" ;
9
9
const oneIndentEmptyScaffolding = "/**\r\n * \r\n */" ;
10
- const twoIndentEmptyScaffolding = "/**\r\n * \r\n */\r\n " ;
10
+ const twoIndentEmptyScaffolding = "/**\r\n * \r\n */" ;
11
11
const noIndentOffset = 8 ;
12
12
const oneIndentOffset = noIndentOffset + 4 ;
13
13
const twoIndentOffset = oneIndentOffset + 4 ;
@@ -19,4 +19,4 @@ goTo.marker("1");
19
19
verify . DocCommentTemplate ( oneIndentEmptyScaffolding , oneIndentOffset ) ;
20
20
21
21
goTo . marker ( "2" ) ;
22
- verify . DocCommentTemplate ( twoIndentEmptyScaffolding , twoIndentOffset ) ;
22
+ verify . DocCommentTemplate ( twoIndentEmptyScaffolding , twoIndentOffset ) ;
You can’t perform that action at this time.
0 commit comments