-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop splitting common operators #275
Conversation
I think that because you are allowed to define |
I changed how operators are recognized and I'll update the PR text. |
name: 'keyword.operator.arithmetic.scala' | ||
}, | ||
{ | ||
match: '(=|\\<|>)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I think we shouln't match =
, as a single =
doesn't compare but defines things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! You need to rebase on main to get this mergable though
Doesn't affect comparison, arithmetic nor logical. In the match `:+` the `+` became redundant, because it's contained in `opchar`. Discovered while working on scala#191.
'Longer' operators like -> aren't an arithmetic operator and than a comparison, but one operator.
With this the examples from [the documentation](https://docs.scala-lang.org/tour/operators.html) work.
Instead of dancing around around special operators we can just enumerate them now. This fixes a lot of edge cases.
b996fae
to
d868753
Compare
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This PR fixes the operators like
->
,:+
,=>
,<-
that are 'composed' from shorter operators like-
and>
. It also fixes operators like\/
where\
wasn't highlighted at all.The change looks quite drastic, but the changes in the snaps look fine to me. I'd would appraciate a second pair of eye to check if an special operator is missing.
A change where I'm not sure if we want it:
One could argue, the
-
is realy the arithmetic operator here, as theexpressions
i -= 1
most of the time meansi = i - 1
.Btw. I don't think in
i = 1
the=
shouldn't be marked as a comparison but just as an operator.