microsoft / microsoft/vscode-cpptools
No semantic token information for macro parameters
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
OS and Version: Windows 10 22H2 19045
VS Code Version: 1.75.1
C/C++ Extension Version: 1.14.3
Bug Summary and Steps to Reproduce
Bug Summary:
The built-in textmate grammar attempts to detect macro parameters. However, it's not particularly successful. This is a place where semantic token information from the extension would help.
In this image examples 1 and 3 are incorrect.
In example 1 param is meta.preprocessor.macro.cpp.
In example 2 #param is correctly recognized as variable.other.macro.argument.cpp. I'm unsure if it should contain the # though.
In example 3 #bar is incorrectly marked as variable.other.macro.argument.cpp.

I think the desired outcome here is to mark param as semantic variable.macro and map that to syntax variable.other.macro.argument.cpp, or at least something roughly equivalent. And also to not mark bar as a variable.
Configuration and Logs
N/A
Other Extensions
No response
Additional context
No response
Contributor guide
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 reading the built-in textmate grammar and the extension's semantic token handling for C++ macro parameters. Reproduce the examples from the issue and trace how param and #bar are classified. Done means macro parameters receive the intended variable.macro semantic mapping and non-parameters such as bar are not marked as variables.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100