Add highlight for extra operators #9
Add highlight for extra operators #9monkoose wants to merge 1 commit intovim-python:masterfrom monkoose:extraoperators
Conversation
|
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 |
|
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 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 |
|
It's now implemented with proper error highlighting. |
|
@nfnty |
|
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.