microsoft / microsoft/vscode-textmate
Scope inspector bug when extending C++ syntax highlighting through Textmate grammar
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 678
- Forks
- 135
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
- VS Code Version: 1.63.2
- OS Version: Darwin x64 21.1.0
Steps to Reproduce:
- created a vscode extension
- contributed to C++ grammar by writing the following Textmate grammar file (see snippet 1) and setting the extension's
package.jsonto contribute correctly (see snippet 2) - built the extension and ran it on Extension Development Mode
- used Inspect Editor Scopes tool to check a token that matches to a custom defined Regex within my extended Textmate grammar file
- PROBLEM: inspector doesn't show my custom textmate scope
Snippet 1)
{
"scopeName": "source.cpp",
"fileTypes": [
"cpp",
"c++",
"c"
],
"patterns": [
{
"include": "#expression"
}
],
"repository": {
"expression": {
"patterns": [
{
"include": "#clog-db"
},
{
"include": "#indent-DB"
},
{
"include": "#array-db"
},
{
"include": "#sample"
}
]
},
"clog-db": {
"begin": "^\\s*clog",
"end": "<<[^;]+;",
"name": "cpdebug.clog"
},
"indent-DB": {
"match": "^\\s*DB\\(\\);",
"name": "cpdebug.indentdb"
},
"array-db": {
"match": "^\\s*dba(2)?\\([^;]+\\);",
"name": "cpdebug.arraydb"
},
"sample": {
"match": "clog",
"name": "cpdebug.sample"
}
}
}
Snippet 2:
"contributes": {
"languages": [
{
"id": "cpp",
"extensions": [
".cpp"
]
}
],
"grammars": [
{
"language": "cpp",
"scopeName": "source.cpp.debug",
"path": "./syntaxes/cpp.tmGrammar.json",
"injectTo": [
"source.cpp"
]
}
]
},

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 using the provided TextMate grammar snippet, extension package.json contribution, and Extension Development Mode. Start with the Inspect Editor Scopes behavior for the custom regex matches and compare the injected source.cpp grammar configuration. Done means the inspector displays the custom cpdebug scopes for matching tokens.
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
- 45/100