Themes: Properties are not highlighted correctly for c++
Summary
In a method, properties will have the same color as local variables/method parameters, instead of their own correct color.
Description
When creating a class like this:
class Foo
{
private:
int m_x;
double m_y;
public:
Foo(int x, double y) : m_x(x), m_y(y)
{
double z = x * y;
m_y *= z;
}
};
and your theme has two different colors specified for variable and property. Any property, in this case m_y, will have the color of property when declaring the field and the color of variable when using it in a method.
Steps to reproduce:
- Open Zed
- Create new .cpp file and paste in the code above.
- Use some theme that has different colors for
variableandproperty(e.g. 0x96f Theme).
Expected Behavior:
m_y being the same color in a method or in the declaration of the type and that color being the one specified in property.
Actual Behavior:
m_y being the color of variable inside a method and property when declared in a class.
3. Click Preview to ensure everything looks right?
4. Hide videos, large images and logs in ``` inside collapsible blocks:
click to expand
Zed Version and System Specs
Zed: v0.188.3 (Zed) OS: Linux X11 linuxmint 22.1 Memory: 15.3 GiB Architecture: x86_64 GPU: Intel(R) Iris(R) Plus Graphics (ICL GT1.5) || Intel open-source Mesa driver || Mesa 24.2.8-1ubuntu1~24.04.1
I believe what you are asking for is semantic highlighting, which is being tracked in https://github.com/zed-industries/zed/issues/7450 and currently being worked on in https://github.com/zed-industries/zed/pull/27556.
I tested #27556 and it doesnt seem to fix the issue i described. Im not sure if thats just something that is not yet working correctly or if this is actually a different issue.
okay now that i looked at themes a bit more, i think you are correct, this is semantic highlighting, im going to close this
Might be that something like https://github.com/zed-industries/zed/pull/27556/files#diff-83e64292d4a57e6e47f5abb7a716bd444b0bc683c5d3ef822e2d95ae66534ff6 is missing for C++, as these tokens have to be mapped to theme highlights. Take that with a grain of skepticism please though, that's just a guess from my side. Tree-sitter alone however cannot really infer such highlights, thus let's hope that is soon solved with semantic highlighting.