Skip to content

Commit d53af50

Browse files
committed
fix(add-remove-comment): fixed line ending reg exp
1 parent 9e2a2ae commit d53af50

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/commands/addRemoveComment/addRemoveComment.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class AddRemoveCommentCommand {
5959
CRLF = `\r\n`,
6060
LF = `\n`
6161
}
62-
const lineEnding = new RegExp(LineEndings.CRLF + `$`).test(text)
62+
const lineEnding = new RegExp(LineEndings.CRLF).test(text)
6363
? LineEndings.CRLF
6464
: LineEndings.LF
6565

@@ -68,8 +68,7 @@ export class AddRemoveCommentCommand {
6868
const editedLines = lines
6969
.reduce((acc: string[], line: string, i: number) => {
7070
if (i >= start.line && i <= end.line) {
71-
// INFO: temporary removal of carriage returns (added back if relevant in join below)
72-
acc.push(this.addRemoveCommentToLine(line.replace(lineEnding, '')))
71+
acc.push(this.addRemoveCommentToLine(line))
7372
}
7473

7574
return acc

0 commit comments

Comments
 (0)