hdima / python-syntax

Python syntax highlighting script for Vim
http://www.vim.org/scripts/script.php?script_id=790
MIT License
363 stars 109 forks source link

highliting isn't semantic aware. #45

Closed purpleP closed 8 years ago

purpleP commented 8 years ago
screenshot 2016-01-07 17 55 50 screenshot 2016-01-07 17 55 58 screenshot 2016-01-07 17 56 26

As you can see from screenshots pycharm nows that len is bultin function and hightlights it, but if I define variable named len for some evil reason (and I sometimes do it with dict) it knows that it's the variable and not the function call, so it doesn't highlight it, unlike your highlighter.

hdima commented 8 years ago

Thank you for the report! AFAIK PyCharm parse Python code and uses AST to represent code internally. So it's possible to do language aware code highlighting, automatic refactoring, type guessing, etc. However syntax highlighting in Vim just uses regex based pattern matching so it's impossible or really expensive to do language aware syntax highlighting. So it won't be fixed unfortunately.

PS. If you really like language aware syntax highlighting in PyCharm I think they also have Vim mode/plugin.