microsoft / microsoft/vscode-textmate
`begin` matching ending `\n` creates rogue `\\G` on every newline
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 678
- Forks
- 135
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
A begin/end rule will create a \\G anchor immediately after the begin match ✅
however, if the begin rule matches the ending newline \n character
it causes it to place a \\G anchor at the beginning of every single line within the begin/end rule ❌
create a grammar with the following code
"begin": "#\n",
"end": "#",
"patterns": [
{
"match": "\\G.",
"name": "invalid"
}
]
create a file and apply the grammar
#
ab
cd
#
notice how both a and c are highlighted red ❌
even tho there should not be any \\G anchors there
remove the \n newline from the grammar
notice that there is now no incorrect \\G anchors ✅
TextMate Help/TextMate.md states:
\Gmatches end of parent rule’sbegin— or end of last stackedwhile.
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
Reproduce the issue with the supplied TextMate grammar and four-line file, then trace the begin/end tokenization path that inserts the \G anchor after a begin match. Done means the newline-ending begin rule no longer causes \G to match at the start of each line, while the documented behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100