Replies: 1 comment
-
Rope has all the mechanisms needed to analyse the code for analysing variable scopes and However, a practical semantic highlighter probably would've required a much different internal infrastructure to be performant than what rope currently does. First, a highlighter needs to be able to sensibly parse broken Python syntax. Rope currently supports some of that, but the way it's implemented is mainly only useful for code completion. Rope's find references assumes that your codebase can be parsed into valid python syntax, or that you only have relatively few syntax errors that Rope's fixsyntax.py can ignore. Secondly, a highlighter needs to be able to do incremental parsing, because it'll need to update colour with every key press, you simply can't reparse the whole codebase with every key press. That might work with small python files, but it will quickly become unfeasible with larger files. On the contrary, refactoring requires accurate whole-project analysis and it's generally fine to take a few hundred milliseconds to analyse the entire project in more depth. So... it is possible, but other more specialised libraries probably can do semantic highlighting better than Rope. |
Beta Was this translation helpful? Give feedback.
-
It seems like Rope, anyway, supports parsing code by tokens.
Beta Was this translation helpful? Give feedback.
All reactions