Closed monkoose closed 7 years ago
This is not a good implementation. All matches need to be exact. It's the linter's job to warn about mistyped operators.
Hm, i do not agree. You can't use any of this characters in your code in other situations then operators(and comment and strings have precedance over them). And it will be more complex to implement each operator because you actually can write things like that a+b
a+10
a + b
a+'hello'
a > b
a >= b
a >>= b
etc etc. It's possible but will be complex regexs for no reason.
Do you see any problem wit hcurrent impementation, can you desribe atleast one?
Reason is that you don't want highlighting for bogus operators, so that you can immediately see if you've typed something that isn't a builtin operator, like !
or >>=
.
The regex won't be very complex at all, as anything that can be broken down into other operators won't need to be added. Just add everything from this list: https://docs.python.org/3/library/operator.html#mapping-operators-to-functions
Also call the option variable g:python_highlight_operators
.
It's now implemented with proper error highlighting.
@nfnty >>=
and <<=
are actual assignment operators
https://docs.python.org/3/c-api/number.html#c.PyNumber_InPlaceLshift
My bad, I'll fix it.
Simplest possible solution for this proposal, will match any number of any characters in
-+\*/%<>^&|~!=
where\*
is just*
. Now it can match any of bitwise, comparison, extended assignment operators. Am i missing anything? But as said it will match any number of characters, should we update Error section for any possible error like<=>
,=>
etc or it would be too verbose. And if you type something like this you just don't know python, and we here create syntax highlighting not an helper for newbies? But obviosly it will help to find misstypes.Needs better description in README. I don't know how to describe this highlight group properly.