tree-sitter-bash icon indicating copy to clipboard operation
tree-sitter-bash copied to clipboard

After a backslash, the `#` character should not begin a comment

Open lkashef opened this issue 5 years ago • 3 comments

The problem

Everything after # on line 5 is highlighted as a comment, while it should not be allowed.

sudo dnf remove -y \
krdc \
kmail \
kgpg \
krusader \ # the old kde twinstyle file manager
kruler

Example from https://github.com/atom/language-shellscript/issues/150

The Solution

  • We could either highlight this comment as an error to warn the user that this is not allowed.
  • The quick solution would be not to scope what's after the # is a comment, thus not misleading the user and also not breaking the highlighting after the comment, since line 6 is considered a separate function call, rather than part of the sudo command.

lkashef avatar Dec 03 '19 01:12 lkashef

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.75. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Dec 03 '19 01:12 issue-label-bot[bot]

Simpler runnable example:

$ echo \ # hi

Prints:

# hi

maxbrunsfeld avatar Dec 03 '19 01:12 maxbrunsfeld

Current situation (just for clarity): image

ahlinc avatar Aug 27 '23 21:08 ahlinc