Hi I have the following chunk of code in ST3 using the default C++ syntax highlighting.
The reason it colors the call to countInsts()
and DPRINTF()
as red is because it mistakes them for variables. Same with the .value()
of ->numCycles
.
Using the C Improved plugin doesn’t help a ton:
While the call to countInsts()
, DPRINTF()
, and .value()
are now correctly distinguished from variables (and as an added bonus the ->numCycles
member variable is distinguished from local variables), the outer ::countInsts()
method is no longer colored as it used to be.
Here is how that chunk of code looks like in VSCode:
Now granted, unlike ST3 + C Improved, VSCode fails to distinguish ->numCycles
as a member variable. However, it correctly highlights the outer ::countInsts()
, countInsts()
, DPRINTF()
, and .value()
. As an added bonus, it also correctly colors the template
and uint64_t
keywords.
All-in-all, it seems that VSCode seems to “understand” C++ better. Note that I’ve done this syntax highlighting test not only with that snippet of code in the original source file, but also with that snippet copied to a separate blank file with nothing else in it. The results are the same for both editors, which confirms that they’re using context clues to do syntax highlighting rather than intimate knowledge of the project structure.
Is there any way to improve the C++ syntax highlighting of ST3?