Skip to content

[ShellScript] Fix comments after line continuation #4315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ShellScript/Bash.sublime-syntax
Original file line number Diff line number Diff line change
@@ -3321,7 +3321,7 @@ contexts:
- include: eol-pop

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

35 changes: 35 additions & 0 deletions ShellScript/Bash/tests/syntax_test_scope.bash
Original file line number Diff line number Diff line change
@@ -117,6 +117,41 @@ $((
# ^^^^^^^^^^ - comment
))

cmd \
# comment after line continuation
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell

cmd ; \
# comment after line continuation
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell

cmd | \
# comment after line continuation
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell

cmd || \
# comment after line continuation
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell

cmd & \
# comment after line continuation
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell

cmd && \
# comment after line continuation
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell

cmd arg \
# comment after line continuation
# <- comment.line.number-sign.shell punctuation.definition.comment.shell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell


###############################################################################
# Git Conflict Marker Tests