-
Notifications
You must be signed in to change notification settings - Fork 45
Variable declaration highlighting differences #8
Comments
It just dawned on me, is this an issue with the default C++ package rather than yours? |
Thanks for reporting this. |
The color scheme is Solarized, and here is a screenshot of a macro: I assume the parenthesis, comma, and multiply in the macro definition were supposed to be highlighted like normal? I feel it is perhaps counter intuitive to highlight something like a variable differently where it is declared compared to where it is used. The problem of course is that, like you say, you cannot parse C with regexp. It would require an actual parser to know what is a variable, what is a function, or what is a macro. |
Yeah, I just tried these examples with Solarized. I'm pretty sure that the unusual highlighting of macro body (
I'm confident that there must be a scope for a source part like preprocessor directive (as for a function). I'm used to use Ctrl+Shift+Space to select the whole, even multi-line, macro, for example. And the only suitable scope for that I can imagine is
I guess this is pretty subjective, because it feels natural to me. I miss (and you too probably) a proper "goto declaration" feature in Sublime, and I find it rather useful to be able at least to recognize a declaration visually. I even have an idea of implementing a poor man's goto variable declaration plugin based on scopes (I mean just jumping up to the nearest word occurrence with an appropriate scope). That is, scopes are good, in general. :) Nevertheless, I'll try to fix the original issue eventually, among with few more problems that I was able to catch with Solarized, like these: Are you related to Solarized development somehow (I saw some contributions)? Anyway, what can you say on highlighting meta scopes like a macro body? |
You know, I've come to realize that I actually don't want to implement highlighting of variable initialization as long as I see no way to implement it good enough. There're too many corner cases and false positives (that usually annoy rather than help), even in simple and commonly used snippets. The question on highlighting macros is still open (though a bit off-topic), so I'll leave this issue open for a while. |
I am not involved in Solarized development other than being a user of the theme, and trying to fix the issues that affect me. I imagine the highlighting of I don't have much experience with the way the grammars work, but I can see there appear to besome shortcomings -- for instance there is no |
I guess, you're right. It would be enough to limit this highlighting to BTW, I added highlighting of operators in 7b4db41 (available in v1.3.0), please check it out. It doesn't recognize a difference between dereferencing and multiplying ( |
Inside functions, if a variable declaration contains more than one variable, the last one is
variable.other.c
, the others are not:Personally, I think I would prefer none of them are highlighted, so they match the variable names in the function type and global scope.
The text was updated successfully, but these errors were encountered: