vim-python / python-syntax

Python syntax highlighting for Vim
MIT License
438 stars 84 forks source link

test.py needs some work around pythonBuiltinFunc #5

Closed monkoose closed 7 years ago

monkoose commented 7 years ago

I dunno who made this change, but now you can't reach pythonBuiltinFunc highlighting group. Because this syn match pythonIdentifier '\v[a-zA-Z_][a-zA-Z0-9_]*' nextgroup=FunctionParameters overwrites any of this

  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(__import__|abs|all|any)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(bin|chr|classmethod|cmp|compile|complex)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(delattr|dir|divmod|enumerate|eval)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(filter|format|getattr)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(globals|hasattr|hash|hex|id)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(input|isinstance)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(issubclass|iter|len|locals|map|max)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(min|next|oct|open|ord)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(pow|property|range)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(repr|reversed|round|setattr)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(slice|sorted|staticmethod|sum|super)>\ze\(' nextgroup=FunctionParameters
  syn match pythonBuiltinFunc    '\v(\.)@<!\zs<(type|vars|zip)>\ze\(' nextgroup=FunctionParameters

Why do you even change syn keyword(that has precedence over match) to syn match for builtins?

nfnty commented 7 years ago

Not true. Read :syn-priority.

Because from should be handled differently for import and raise.

monkoose commented 7 years ago
2. A Keyword has priority over Match and Region items.

KEYWORD > MATCH

Did i miss something?

nfnty commented 7 years ago

Yes, you missed this:

1. When multiple Match or Region items start in the same position, the item
   defined last has priority.
monkoose commented 7 years ago

Ah, you talking about that it didn't overwrite pythonBuiltinFunc? Hm, maybe. I just opened test.py and checked. And now i tested with actual python file. Yes it didn't overwrite - my bad. I think test.py then should be changed.

nfnty commented 7 years ago

Why should it be changed?

nfnty commented 7 years ago

Oh, you mean the keyword section. Sure.

monkoose commented 7 years ago

Because in the test.py file under the section Builtin function we have pythonIdentifier highlighting for almost all builtins. Check it. And actually non-english function and class names didn't recognized at all.

nfnty commented 7 years ago

That's a separate issue altogether, and would need a major refactor for proper unicode support.

monkoose commented 7 years ago

Sorry. Maybe because of my bad english it's hard for you to understand what i'm trying to say. I repeat. In test.py file all builtin functions cant be recognized and highlighted as pythonIdentifiers.

nfnty commented 7 years ago

Completely missed that, sorry.

monkoose commented 7 years ago

Should i rename the issue? Because it is actually working as supposed. And problem only in test.py file itsef.

nfnty commented 7 years ago

Now it's fixed, thanks.