Skip to content

Rethink sublanguages #1263

@isagalaev

Description

@isagalaev

There are many subtly different ways of embedding one syntax into another:

  • The host language clearly defines boundaries, between which we can use a completely independent highlighting process. It's the case with <script>..</script> in HTML.
  • The host language defines boundaries, but the closing boundary can only happen at the top level of the sublanguage. This the case of PHP in HTML, where ?> inside a PHP comment wouldn't end the sublanguage.
  • The sublanguage ends when it parses out a single top-level mode. This is the case of JSX.

Current implementation of subLanguage only works for the first case. And the skip attribute only fixes a few common cases.

Current idea is to implement sublanguages as sub-parsers embedded in the host parser tree.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions