Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C/C++ variables are set red #390

Closed
w-xy opened this issue May 11, 2020 · 27 comments
Closed

C/C++ variables are set red #390

w-xy opened this issue May 11, 2020 · 27 comments

Comments

@w-xy
Copy link

w-xy commented May 11, 2020

In C/C++, all variables are set red. It's too harsh when the C codes are full of variables.
I wonder if it's a bug, if not, how can I set the variables gray as in python codes?

捕获


OS: Win7 Pro SP1
VSCode: 1.44.2
One Dark Pro: 3.5.0

@sagar-barapatre
Copy link

Hello, Either you can change your theme to material theme or you can change your IDE. I personally use both Sublime text as well as VS code But in sublime text, the variables are not in red color. So it's completely your choice which option to choose to.
Happy Coding!!!

@w-xy
Copy link
Author

w-xy commented May 12, 2020

@sagarbarapatre02 Thanks for your suggestion, but I don't have a commercial lincense of sublime text, so vs code is the only choise for me. I use atom in my personal computer, and I really enjoy the One-Dark theme. I cannot give up easily...

@Binaryify
Copy link
Owner

could you provide the code in your screenshot

@w-xy
Copy link
Author

w-xy commented May 12, 2020

@Binaryify

#include <stdio.h>

void main()
{
   char *name = "Jack";
   printf("Hello, %s\n", name);
}

@Binaryify
Copy link
Owner

did you installed other extensions?
that name is not red in my vscode
image

@w-xy
Copy link
Author

w-xy commented May 12, 2020

@Binaryify
I reproduced the problem in my personal computer.
I installed the offcial extension: C/C++, and the name turned red immediately. When I disable the extension, it turns gray.
I noticed that there's a wavy line in your screenshot, which seems to mean you didn't install C/C++ extension, or you didn't configure the include path so the header file cannot be identified.
If you have installed the extension, you can just reproduct the problem without any header by this:
void main() { char *name = "Jack"; }

@Binaryify
Copy link
Owner

ok

@Binaryify
Copy link
Owner

image
still can't reproduced, did I miss something?

@w-xy
Copy link
Author

w-xy commented May 12, 2020

It seems good in my WSL too. Could you please try it in Windows?

@Binaryify
Copy link
Owner

image

@w-xy
Copy link
Author

w-xy commented May 12, 2020

捕获
捕获2

@Binaryify
Copy link
Owner

Binaryify commented May 13, 2020

oh, I see that in my vscode insider
image
will try to fixed that

@w-xy
Copy link
Author

w-xy commented May 13, 2020

thank you

@Binaryify
Copy link
Owner

just fixed this in v3.6.1

@w-xy
Copy link
Author

w-xy commented May 14, 2020

Thanks. It's fine now in my personal machine. I'll check it tomorrow.

@GenhaoLi
Copy link

Hi, it seems that the same problem happens again. All kinds of variable in C are coral now.

This can be reproduced on both Windows 10 and Ubuntu 16.04 with the only other extension C/C++ by Microsoft.

image

Local variables are light white only if C/C++ extension is disabled.

@Binaryify
Copy link
Owner

@Gytobp will fix that soon

@Binaryify
Copy link
Owner

@Gytobp you can check v3.12.3

@e-potashkin
Copy link

In C#, all variables also are set red. Could you please change it too? =)

@Binaryify
Copy link
Owner

@e-potashkin ok

@MoonChasing
Copy link

@Binaryify Hello,I am accustomed to the coral color of the variables in the C language. Now it was fixed as a bug. I am very uncomfortable. Can you make this an option?

@Binaryify
Copy link
Owner

@MoonChasing
you can add this in your settings.json

 "editor.semanticTokenColorCustomizations": {
    "rules": {
      "variable:c": {
        "foreground": "#e06c75"
      },
      "variable:cpp": {
        "foreground": "#e06c75"
      },
      "variable:cs": {
        "foreground": "#e06c75"
      }
    }
  },

@MoonChasing
Copy link

@Binaryify Thank you very much.

@tristan957
Copy link

Initially it was a jarring change. Wondering what Atom One Dark Pro does in this situation. It was kind of nice to be able to see the parameters at a glance easily. Don't really care enough to stray from the default behavior however.

@Binaryify
Copy link
Owner

Binaryify commented Dec 3, 2021

@BenJSouthwell
Copy link

It should be consistent with the original implementation of the theme. They should be grey. If red is preferred by some it could be a potential option. But if you are to make a clone of a colour theme then you should be consistent with it, otherwise what is the point ?

@Andreasgdp
Copy link

If you just want to keep using the defaults of one dark pro but still use the c/c++ extension, you can set the following extension setting:

"C_Cpp.enhancedColorization": "disabled"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants