microsoft / microsoft/vscode-textmate
`include` grammars don't load within `captures`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 678
- Forks
- 135
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
Embedded grammars are not loaded from disk when inside a captures rule
If the embedded grammar was pre-loaded by another include in the same grammar
OR loaded via another grammar in another language in another file
then it works as expected
- Don't open a file that loads the
Cgrammar - Open a file with the following grammar loaded
- notice no syntax highlighting.
test(5);
- Close the file
- Reload VSCode
- Open a
Cfile - Reopen the file with the following grammar loaded
- notice syntax highlighting now working
{
"scopeName": "source.capture.load",
"patterns": [
{
"match": ".+",
"captures": { "0": { "patterns": [ { "include": "source.c" } ] } }
}
]
}
from my testing getExternalGrammar() is never run when directly inside captures
related:
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 tracing how includes nested directly inside a captures rule are resolved, focusing on the reported getExternalGrammar() entry point. Reproduce the issue with the provided TextMate grammar and a C grammar loaded in VS Code. Done means the embedded source.c grammar loads on first use and syntax highlighting works without preloading it elsewhere.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100