Sublime Forum

Build 4200 new bash syntax trailing backslash issue when followed by a comment line

#1

After upgrading to build 4200 when using bash syntax, line comments preceeded by lines with a trailing backslash are not rendered as comment unless a space is present after the trailing backslash. Please see the attached image:
Screenshot_20250623_231327

Sample lines:

a=0;
# hello
a=0; \
# hello
a=0 \ 
# hello
0 Likes

#2

This is correct behavior. Escaping the newline with a backslash results in the next line not being a comment even if it starts with a #. For example:

$ echo a\
# b

prints

a# b
0 Likes

#3

Thanks bschaaf for your reply. If before the backslash there is a commands list delimiter ‘;’ (unquoted) it doesn’t seem to be the same:

echo a;\
# b

prints

a

If I understand correctly (english is not my native language), according to manual “If a \newline pair appears (…) it is removed from the input stream and effectively ignored” (https://www.gnu.org/software/bash/manual/html_node/Escape-Character.html). With this by going back to the opening example:

a=0;
# hello
a=0; \
# hello
a=0 \ 
# hello

I’m expecting that the new syntax will render lines starting with # as comments (as the old syntax did). Am I missing something? Please correct me if I’m wrong, thanks

0 Likes

#4

this could indeed be a bug in the syntax definition. I suggest filing an issue at https://github.com/sublimehq/Packages/issues

0 Likes

#5

Thanks kingkeith, just opened a new issue here: https://github.com/sublimehq/Packages/issues/4314

0 Likes