microsoft / microsoft/vscode-textmate
Option to match end before any patterns
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 678
- Forks
- 135
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
There is persistent problem with injected languages where unclosed parentheses or quotes eat whole document.
I'm proposing to add option e.g. applyEndPatternFirst. This would check such end pattern at every line before anything else. I've looked at code a bit and it seems possible, but I'm not familiar enough with engine to correctly implement this (at least without trashing performance).
Details:
- On
endmatch - everything beforeendwould be extracted and checked again with sub-patterns and merged withend's tokens, while rest of line would be checked normally. Without match - business as usual. - When multiple
endpatterns with this option will be present, they should be stored and checked from first to last, at every line until any of them matches. There shouldn't be too many of them, since this should be used mainly with injected languages. - Successful match will terminate all descendant rules, after matching "before end" part of line.
endwith option should also match in line wherebeforewas found.
Why not use while? While while (sic) is great addition, it can only exclude whole line. Proposed option would allow stopping in mid-line.
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.
Research direction
Start by locating the tokenizer engine and its handling of TextMate grammar end patterns; the issue does not name a file or test. Trace injected-language termination and performance implications, then define tests for mid-line termination, nested rules, multiple end patterns, and matching on the line containing before.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100