microsoft / microsoft/vscode-cpptools

Add support for semantic token enumMember declaration modifier

Open
#12,039 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request Feature: Colorization Language Service Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Feature Request

Right now, enums have the semantic token type enumMember but without modifiers. I'd like to distinguish between declaration and usage.

In my color theme, I have opted to use a green color for constants. I'd like it so that I could make enum usage be green but usage only. Not the enum declaration/definition.

This is what's currently possible:

image

I can apply my green color to the enumMember sematic token.

image

However, that makes the enum definition also green which I don't want. Here you can see that green is applied on both sides of the equals sign.

image

I'd like this to stay like this

image

But there's no way to accomplish this without a semantic token modifier. I've tried TextMate scope mappings and contribution points to as a workaround but it's not possible and I cannot disable semantic highlighting because it will just lead to other issues. The semantic highlighting rules takes precedence.

I would really appreciate if we could get a declaration modifier for enums, so that I can have my enum declaration appear in a my natural foreground color but when used as a literal constant value, use my green color.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the extension produces enumMember semantic tokens and how declaration-versus-usage information is represented. Done means enum declarations can receive a declaration modifier while enum usages remain distinguishable for theme coloring, without disabling semantic highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.