Closed csuhta closed 5 years ago
Thanks for the report! Reproduced with 1.37.0-nightly12 on macOS 10.12.6.
confirmed that this is a tree-sitter
issue, so I turned this back off and no longer a zillion errors:
> apm --version
apm 2.1.3
npm 6.2.0
node 8.9.3 x64
atom 1.36.0-beta1
python 2.7.15+
git 2.19.1
> atom --version
Atom : 1.36.0-beta1
Electron: 2.0.18
Chrome : 61.0.3163.100
Node : 8.9.3
> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic
Actual behavior: Syntax highlighting breaks down for future Ruby blocks after the comment
☝️ This is a nice summary of the issue. Thanks, @csuhta.
@maxbrunsfeld and I looked into this issue yesterday. Building on the summary above, the syntax highlighting works correctly when using an ERB-style comment (i.e., <%#
), but it breaks when using an ERB statement that includes a Ruby-style comment (i.e., a <%
, <%-
, or <%=
node that contains a Ruby comment ):
We found that this issue also exists for EJS:
It seems like fixing this issue is going to be a rather substantial undertaking, so I don't yet know when we'll be able to address this issue. In the meantime, if you're able to use ERB-style comments exclusively (which I know won't be a viable solution for everyone), then you can work around this bug.
We'll likely open an issue with additional details from our findings, since the underlying issue goes beyond language-ruby and ERB.
tl;dr: https://github.com/atom/atom/pull/19291 resolves the most common cases where this issue crops us, and the fix is targeted for inclusion in Atom 1.38. 😅
In the fairly uncommon case where you have a Ruby comment in an ERB directive followed by additional ERB directives on the same line, the latter ERB directives are currently styled incorrectly:
We're tracking this bug in https://github.com/tree-sitter/tree-sitter/issues/327. As seen in the screenshot above, there are two workarounds for this bug in the meantime:
Because the problem identified in the issue body above is now resolved, and because we're tracking the remaining edge case in a separate issue, I'm going to close this issue out.
Thanks again for reporting this, @csuhta. :bow:
Prerequisites
Description
Certain kinds of ERB commenting will break the syntax highlighting flow, such as
<% # comment %>
and<%-# comment %>
Steps to Reproduce
A poorly colorized file shown below:
Expected behavior: Syntax highlighting handles the comment
Actual behavior: Syntax highlighting breaks down for future Ruby blocks after the comment
Edit by @rsese to add screenshot
Reproduces how often: Always
Versions
Edit by @rsese: also reproduced with 1.37.0-nightly12 on macOS 10.12.