microsoft / microsoft/vscode-cpptools
Semantic highlighting - variables vs constants
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Feature Request
At the moment the semantic highlighting is rather limited. For example if you create a constant member variable with constexpr in a class it cannot be distinguished compared to a local variable.
The same applies to constants used in a function, for example.
Solution: Provide more information so users can colorize things differently. For example it would be nice to have the following:
variable.global.constvariable.local.constproperty.const(I would prefervariable.member.const, but wellpropertyis already used)
For example:
class X {
public:
int _member;
static constexpr int memberConst = 222;
void doSomething(int param) {
int localVar = 5555;
constexpr int localConst = 1234;
// I want the following to possibly have different colors:
// _member -> member variable
// memberConst -> member constant
// param -> function parameter (visualize differently)
// localVar -> local variable
// localConst -> local constant
return _member + memberConst + param + localVar + localConst;
}
};
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 with the C++ example in the issue and inspect how semantic highlighting currently classifies variables and constants. Determine where scopes for global, local, member, and parameter symbols are exposed. Done means users can distinguish the requested categories through semantic highlighting, with coverage for the example cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100