From ef96bb1c5e0167ee26962c2032453085c2d6a650 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Tue, 24 Jun 2025 13:02:38 +0200 Subject: [PATCH] [ShellScript] Fix comments after line continuation Fixes #4314 --- ShellScript/Bash.sublime-syntax | 2 +- ShellScript/Bash/tests/syntax_test_scope.bash | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/ShellScript/Bash.sublime-syntax b/ShellScript/Bash.sublime-syntax index 0929819ffb..8c3eacd3fe 100644 --- a/ShellScript/Bash.sublime-syntax +++ b/ShellScript/Bash.sublime-syntax @@ -3321,7 +3321,7 @@ contexts: - include: eol-pop eol-pop: - - match: $|(?=\s+[#\n]) + - match: $|(?={{wspace}}[#\n]) pop: 1 - include: line-continuations diff --git a/ShellScript/Bash/tests/syntax_test_scope.bash b/ShellScript/Bash/tests/syntax_test_scope.bash index 69997b1aea..8fea5efefc 100644 --- a/ShellScript/Bash/tests/syntax_test_scope.bash +++ b/ShellScript/Bash/tests/syntax_test_scope.bash @@ -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