-
Notifications
You must be signed in to change notification settings - Fork 53
No way to scope a grammar capture #83
Description
Description
There is no way to scope a grammar capture for specific grammar rules, leading to very odd, buggy-looking syntax highlights.
Steps to Reproduce
- Set the language to any that has a rule that features both of the following.
language-gfmandlanguage-javascriptboth fulfill this requirement in their grammars.
- A
beginandendcapture - A
patternthat delegates to another language that also has a rule containing both abeginandendcapture. (It doesn't have to delegate, though.)
-
Create something that matches that rule. For GFM, a code block tagged with
csswould suffice, and for JS, a tagged template starting withhtmlwould work. -
Within that block, type something that would match the
beginhalf of any rule in the other language that includes both abeginandend. Do not include the end. For GFM or JS, just start a comment in CSS or HTML, respectively. -
Observe very odd syntax highlighting. It looks like a bug because it can't be contained, and repros 100% of the time.
If you followed the above repro, the code might look like this pre-syntax highlighting:
GFM -> CSS
```css
/* This is an unterminated comment
```
Some more text...JS -> HTML
html`
<!-- This is an unterminated comment
`;
someOtherCall();
Here's a few screenshots of other code.
language-gfm -> language-javascript:
language-javascript -> language-html
Versions
OS: Ubuntu GNOME 14.04 (although it's been repro'd in Windows by others)
Atom: v1.12.5 (been going on for quite a while)
Additional Information
Initially reported in atom/language-gfm#171, but I filed it here because it's language-agnostic.

