Skip to content

Commit a56c8d5

Browse files
committed
invalidate paren-trail if line ends inside a string (close #112)
1 parent fb8c32d commit a56c8d5

File tree

5 files changed

+174
-98
lines changed

5 files changed

+174
-98
lines changed

lib/parinfer.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,20 @@ function appendParenTrail(result) {
592592
result.parenTrail.endX++;
593593
}
594594

595+
function invalidateParenTrail(result) {
596+
result.parenTrail = {
597+
lineNo: SENTINEL_NULL,
598+
startX: SENTINEL_NULL,
599+
endX: SENTINEL_NULL,
600+
openers: []
601+
};
602+
}
603+
595604
function finishNewParenTrail(result) {
596-
if (result.mode === INDENT_MODE) {
605+
if (result.isInStr) {
606+
invalidateParenTrail(result);
607+
}
608+
else if (result.mode === INDENT_MODE) {
597609
clampParenTrailToCursor(result);
598610
popParenTrail(result);
599611
}

0 commit comments

Comments
 (0)