You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A heredoc following a comment that ends with a full-stop . is not highlighted properly.
let(:source)do# Empty lines should make no difference.<<~RUBY if #{condition}#{body} end RUBYend
Removing the full-stop . at the end of the comment allows the heredoc to be highlighted as expected:
Unfortunately, I can't think of a way to fix this in a well-performing manner as I think it would require look-behind assertions to check if the preceding dot is part of a comment.
Damn, that's a good catch. Unfortunately, I have no idea how to fix it.
To provide an explanation for the next reader, the problem is that we already do negative lookbehind to figure out if this is really a heredoc. Here's one example of something that is not a heredoc:
FOO="bar"result=[].<<FOO
And so we have a regex that checks that we don't have . (among other things) before the heredoc. Unfortunately, I don't know of any way to avoid this for comments. Maybe Doug Kearns will think of something, but I think this will likely have to be left as an open isssue.
Activity
AndrewRadev commentedon Aug 3, 2020
Damn, that's a good catch. Unfortunately, I have no idea how to fix it.
To provide an explanation for the next reader, the problem is that we already do negative lookbehind to figure out if this is really a heredoc. Here's one example of something that is not a heredoc:
And so we have a regex that checks that we don't have
.(among other things) before the heredoc. Unfortunately, I don't know of any way to avoid this for comments. Maybe Doug Kearns will think of something, but I think this will likely have to be left as an open isssue.