Make docComment template indent whitespace-only · WebReflection/TypeScript@b7d09ef · GitHub
Skip to content

Commit b7d09ef

Browse files
author
Arthur Ozga
committed
Make docComment template indent whitespace-only
1 parent 1bf4f06 commit b7d09ef

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/harness/fourslash.ts

Lines changed: 5 additions & 4 deletions

src/services/jsDoc.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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 = "";
Lines changed: 4 additions & 4 deletions

0 commit comments

Comments
 (0)