Skip to content

Semantic tokens should distinguish static classes from instance variables #8781

@JohnKesko

Description

@JohnKesko

I wanted to create a theme but currently, both static classes like Console/Math and instance variables receive the same semantic token type variable with no modifiers, making it impossible to color them differently.

Image

Both should have the same color (light blue in this example).

Expected:
Static classes should either:

  • Have a static modifier on the variable token
  • Use a different semantic token type like staticClass or class
  • Have a readonly modifier (since static classes can't be reassigned)

var myClass = new MyClass("Test");

myClass: 7 chars
language: csharp
standard token type: Other
foreground: #D4D4D4
background: #1E1E1E
contrast ratio: 11.24
semantic token type: variable
textmate scopes: entity.name.variable.local.cs, source.cs
foreground: No theme selector


myClass.InterfaceMethod();

semantic token type variable

textmate scopes:
variable.other.object.cs
source.cs


Console.WriteLine($"Hello, {name}!");

semantic token type variable

textmate scopes:
variable.other.object.cs
source.cs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions