fisheva / Eva-Theme

A comfortable and semantic theme.
https://marketplace.visualstudio.com/items?itemName=fisheva.eva-theme
MIT License
457 stars 38 forks source link

`bool` type and `true` and `false` in C isn't colored properly #119

Closed rababR1 closed 5 months ago

rababR1 commented 6 months ago

Screenshot

image

Code Snippet

int main()
{
    int x = 9;
    int y = x > 0;
    printf("y = %d\n", y);
    y = x == 9;
    printf("y = %d\n", y);
    y = x < 0;
    printf("y = %d\n", y);
    bool z = true;
    printf("z = %d\n", z); // Displays z as 1
    z = false;
    printf("z = %d\n", z); // Displays z as 0
    // Comparing stuff with logical operators
    int a = 7, b = 9;
}

Programming Language is C

Notes

Following settings are enabled: image image If you disable C_Cpp:Enhanced Colorization, this is what it looks like: image

I hope that more proper colorizations (if C_Cpp:Enhanced Colorization is enabled though) will come in the near future.

Thanks.

Edit: This also happens with the NULL keyword too:

image C_Cpp:Enhanced Colorization enabled.... image C_Cpp:Enhanced Colorization disabled....

Code snippet:

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int a = 10;
    int *ptr = &a;              // ptr is a pointer to the variable a
    printf("ptr = %i\n", *ptr); // Prints the ADDRESS of the variable
    // a NULL pointer
    int *ptr2 = NULL; // does not point to ANYTHING!
    // Dereferencing a pointer
    int count = 10, x;
    int *intPointer; // Making a pointer for 'count'
    intPointer = &count;
    x = *intPointer; // dereferencing the pointer, GETTING THE VALUE ITS POINTING TO, which is 10 (NOT THE ADDRESS OF count)
    printf("count= %i,x = %d\n", count, x);
fisheva commented 6 months ago

I can only guarantee the best experience of Eva Theme under the following settings now. The characters you mentioned are displayed correctly under the following settings.

    "editor.semanticHighlighting.enabled": false,
    "C_Cpp.enhancedColorization": "disabled",

The incompatibility of the plugin with the option 'C_cpp. enhancedColor': 'enabled' is due to the scope values added to some characters by the plugin. Modifying these characters‘s style may cause users to display errors if they do not install this plugin or set the option 'C_cpp. enhancedColor': 'disabled'which are contradictory to each other.

For the semantic highlighting issue, please refer to issue 54.

rababR1 commented 6 months ago

Okay. Seems like I need to manually edit those scopes. Also, I edited my comment showing proper syntax highlighting

rababR1 commented 6 months ago

Did a clean install of VS Code. Same issue. The screenshots are from Insiders.

https://github.com/fisheva/Eva-Theme/assets/65360255/a7b5a3d3-e28b-44e4-b171-aa91ef42b6e0

fisheva commented 6 months ago

Sorry, I didn't understand the meaning you wanted to convey in your two replies above. From your screenshot, it can be seen that after setting "C_Cpp.enhancedColorization": "disabled", the highlighted color of NULL is correct. Do you have any further questions that I need to answer?

If you want to overwrite the style of Eva Theme locally when "C_Cpp.enhancedColorization": "enabled", you can add the following text in the settings.

"editor.tokenColorCustomizations": {
        //effect Eva Dark only
        "[Eva Dark]": {
            "textMateRules": [
                {
                    "scope": "entity.name.function.preprocessor.cpp,",
                    "settings": {
                        "foreground": "#CF68E1",
                    },
                },
            ],
        },
        //effect all Themes
        "textMateRules": [
            {
                "scope": "entity.name.function.preprocessor.cpp",
                "settings": {
                    "foreground": "#CF68E1",
                },
            },
        ],
}

If you find some characters display errors in "C_Cpp.enhancedColorization": "enabled" settings and their scope statements are already in Eva Theme default settings, you may need to locally overwrite its color by using the above method.

fisheva commented 6 months ago

On my computer, regardless of the settings, bool and true displays in C language are always correct. WX20240506-070543@2x

Can you show me their scope values when displaying errors on your computer? And under what settings do they display errors?

rababR1 commented 6 months ago

I've highlighted some strikethroughs when I inspect the scope. My build is Insiders v1.9.1

https://github.com/fisheva/Eva-Theme/assets/65360255/f9e30c4e-9e22-4497-a37a-1a0ed9ef7c37

fisheva commented 6 months ago

It didn't show the 'bool' scope value in the video. Could you show me again? Thanks!

fisheva commented 6 months ago

I found entity.name.function.preprocessor.cpp and entity.name.function.preprocessor.c can't be used to highlight NULL and false, it effects many other characters. So I just deleted it in the lasted version(2.6.2).

20240508103604

rababR1 commented 6 months ago

Sorry for the late response: Here it is...

https://github.com/fisheva/Eva-Theme/assets/65360255/b23be3c2-9a21-4256-a85d-5f9ef5c68519