Skip to content

Commit dc37b00

Browse files
authored
[ShellScript] Fix comments after line continuation (#4315)
Fixes #4314
1 parent 8abca12 commit dc37b00

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

ShellScript/Bash.sublime-syntax

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3321,7 +3321,7 @@ contexts:
33213321
- include: eol-pop
33223322

33233323
eol-pop:
3324-
- match: $|(?=\s+[#\n])
3324+
- match: $|(?={{wspace}}[#\n])
33253325
pop: 1
33263326
- include: line-continuations
33273327

ShellScript/Bash/tests/syntax_test_scope.bash

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,41 @@ $((
117117
# ^^^^^^^^^^ - comment
118118
))
119119

120+
cmd \
121+
# comment after line continuation
122+
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
123+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell
124+
125+
cmd ; \
126+
# comment after line continuation
127+
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
128+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell
129+
130+
cmd | \
131+
# comment after line continuation
132+
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
133+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell
134+
135+
cmd || \
136+
# comment after line continuation
137+
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
138+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell
139+
140+
cmd & \
141+
# comment after line continuation
142+
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
143+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell
144+
145+
cmd && \
146+
# comment after line continuation
147+
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
148+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell
149+
150+
cmd arg \
151+
# comment after line continuation
152+
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
153+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell
154+
120155

121156
###############################################################################
122157
# Git Conflict Marker Tests

0 commit comments

Comments
 (0)