Registered Member
|
Hi all,
this could sound trivial, but what is the rationale behind the variable syntax colors? I mean, of course it is useful to have each variable with a predefined color, even if I find it a little confusing to read a so colored code, but how is a color for a particular variable chosen? For instance within a method I've got three QString declared sequentially and with the color of yellow, blue and red. Are these colors randomly chosen or do they have a specific meaning? |
KDE Developer
|
Local variables are randomly colored (but once a given name has a given color, it should be reused). The big gain here is that it's much simpler to see where a given variable is used. I know of many people who really like this feature (including me) and I also heard it quite a few times that people where first reluctant in accepting it but came to love that feature.
Here's one (maybe bad) example of where this really helps: int longVarNameuAsdf = 1; int longVarNameaAsdf = 2; Usually you'd had to read both long names to find the difference of one char, with the colorization it's quite easy to differenciate the two vars. If you don't like that, disable it by reducing the local color intensity in KDevelop's settings.
current KDE projects: Quanta, KDevelop, Kate
|
Registered Member
|
It is probably also worth mentioning that the colouration really helps determine whether the variable you are calling is a local variable, a global variable or a class variable. It is possible under some circumstances to end up with variables of the same name with the coloration it becomes easier to figure out which you are affecting.
|
Registered Member
|
Effectively, after several days of using this feature, I'm loving it. |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell