Closed alekseyt closed 5 years ago
Also i think ->*
and .*
are missing in syntax. It's not a big deal, but if this fix is made then someone may complain that in
a->*b
There are 1) two operators while it's one operator really 2) they may or may not be highlighted differently. But it won't be noticeable if ->
and *
are in the same category.
Greeting @alekseyt , welcome.
C++ is my very primary language, and almost the only one. So I've put my best efforts to highlight it as good as I can a long time ago.
While comma is indeed operator in C++, it's rarely used this way. Only the last part of for-loop condition comes to mind. And even then it's more like a delimiter. So in my opinion it's better to leave comma in punctuation as other delimiters.
Speaking of .
, ->
, ::
. I don't see a reason to not color them as operators. const std::string s = "yo";
doesn't look weird to me either. Just think of punctuation
category as delimiters
.
The main goal is to provide for readable highlighting, calm, simple, easy to customize.
Nevermind then.
I think it makes sense to tag
.
and->
as punctuation. Comma (,
) is an operator in C++ too, but no one highlighting it because it doesn't make sense to assign color to every,
. By extension it doesn't make a lot of sense to highlight every.
. Since->
essentially does the same thing as.
but on pointers instead of references, for consistency reasons it also should go to punctuation IMO.Example code:
For C++ it also would be nice to move
::
to punctuation because it looks weird in something like this:Alternatively all such "questionable" operators might go into their own category like
syntax.punctuation.operator
orsyntax.operator.punctuation
. Alas styles in this extension do not work hierarchically, e.g.syntax.operator
won't assign color tosyntax.operator.punctuation
, sosyntax.operator.punctuation
is kind of misleading name. Another name might be something likesyntax.access
, idk really.Here is the patch for moving
.
,->
and::
to punctuation:What do you think?