Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

No way to scope a grammar capture #83

@dead-claudia

Description

@dead-claudia

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

  1. Set the language to any that has a rule that features both of the following. language-gfm and language-javascript both fulfill this requirement in their grammars.
  • A begin and end capture
  • A pattern that delegates to another language that also has a rule containing both a begin and end capture. (It doesn't have to delegate, though.)
  1. Create something that matches that rule. For GFM, a code block tagged with css would suffice, and for JS, a tagged template starting with html would work.

  2. Within that block, type something that would match the begin half of any rule in the other language that includes both a begin and end. Do not include the end. For GFM or JS, just start a comment in CSS or HTML, respectively.

  3. 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:

screenshot from 2016-10-24 23-47-59

language-javascript -> language-html

screenshot from 2016-10-24 23-52-48

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions