Differentiate private members from local variables
Paiusco opened this issue · 4 comments
Even liking gruvbox a lot, I find it annoying that it doesn't differentiate private variables from local and function-parameters at least colour-wise. Wouldn't that be a good idea? :) (I'm using C++ and miss it)
As you can see on Monokai theme, it has a special color and put it on italic for function parameters:
As I mentioned before I care more about private members than parameters, but having one for that seems pretty useful too. What you guys think? I could do a PR if it sounds as a good idea.
Thanks @Paiusco
I'm not entirely sure what you're proposing. Could you please have a side-by-side comparison photo or something?
We can scope the highlighting to specific language, so we can introduce this change for C++ only if you think that'd help C++ dev.
I actually think that would help any OO language
Take a look into this example:
class A {
public:
A() {};
bool foo(int parameter_int);
private:
int internal_int;
}
bool
A::foo(int external_int)
{
return external_int == internal_int; // Tag: Here!!!
}
int main()
{
A a;
a.foo(2);
}
Here!!! : How does one know, by gruvbox colours which int
is a class member and which isn't??
My project nowadays uses Hungarian notation for member variables (m_
), e.g. in my example internal_int
would necessarily become m_internal_int
. Which IMHO seems good enough, however, still error prone. Meaning that every new dev has to know that and check every review for it.
In Monokai, as previously mentioned by me, they even use different colours for methods parameters (colour + italic) and local variables.
Thanks @Paiusco , I'm happy to accept what would help. Do you have time to work on a PR ? It'd be helpful to include some screenshots before & after the change.
If you think you can target other languages, that's fine, just please make sure that the changes won't completely modify the views. There's a few code examples in this repo, feel free to use to test & add more if needed.
Sorry for the long delay on this.
I've started to play around those issues, as I don't have a good knowledge on JS, it took me a while to realise that it's not a matter of changing colours.
So here is a Monokai scope of a class member variable:
What's exactly missing there for gruvbox be able to see it as it should? So if anyone can help I'd be happy to open a PR and also add an specific '.cpp' test file (that's compile-able) :)