microsoft / microsoft/vscode-textmate
Consider using end pattern as bail out for embedded languages
@alexdima is already working on this.
Since May 2, 2023.
- Dominant language
- TypeScript
- Stars
- 678
- Forks
- 135
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
This started as a discussion in https://github.com/jlelong/vscode-latex-basics/issues/58.
The problem is that languages that are embedded within other languages have a high potential to not work as expected. When there's a problem in the embedded grammar it can easily escape into the primary grammar.
Key comment from @jlelong copied below:
@jlelong would this be something that you would define in your textmate grammar at the point that you embed the grammar?
@alexr00 yes exactly. For instance, embedding the Python language typically looks like
{
"begin": "some_begin_pattern",
"end": "some_end_pattern",
"contentName": "source.python",
"patterns": [
{
"include": "source.python"
}
]
}
It would be nice if the top level grammar could escape from the Python one when the end pattern is reached. I originally thought a new pattern was needed to trigger the bail out but I believe it will always be the same as the end pattern.
Currently, we provide a modified C++ grammar which includes the bail out pattern. This approach would make it useless. Embedding a grammar would much more robust.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.