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.

Create means of including grammar in child context #112

@dead-claudia

Description

@dead-claudia

Some grammars more or less "extend" grammars that let them:

  • C++ and Objective C already extend C and C just uses $self to recurse.
  • TypeScript really should just extend JS the same way.

But of course, with naïve inclusion, that causes problems.

  • When language-gfm includes language-c, comments and pointer dereferences get interpreted as emphasis.
  • If JS were altered to work like C, var test1 = a < b\nvar test2 = a > c (where \n represents an actual newline) could end up mishighlighted with <b var test2="a"> highlighted as an "element" of sorts that doesn't actually exist.

So I'm thinking a new {includeChild: 'scope'} pattern should exist. This would create a new "root" highlighting context for that subsection. This complements #83 (PR: #90) in that this feature isolates the matched grammar while that feature isolates the matched source. Most use cases would end up using both, so it might be worth merging the two, but I'm not sure if that's all use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions