Import tree-sitter to handle python files#87
Conversation
Signed-off-by: st01cs <42166106+st01cs@users.noreply.github.com>
Umpire2018
left a comment
There was a problem hiding this comment.
Thank you for your contribution and the effort you've put into this PR! I appreciate that you've included test cases and provided sufficient documentation for your changes.
Switching from ast to tree-sitter is indeed a great first step towards supporting multiple languages. However, I have some reservations about the implementation:
-
Dependency Concerns: The introduction of
tree_sitter_languagesadds a bundle of dependencies, which feels a bit heavy for this repository's current focus on Python. To keep things minimal and maintainable, I suggest directly using Python-specific dependencies, such as:from tree_sitter import Language, Parser import tree_sitter_python self.parser = Parser(Language(tree_sitter_python.language())
-
Future Considerations: While this change lays the groundwork for multi-language support, it might not result in a fundamental improvement without considering the entire workflow, especially given the presence of tools like
jedi. A more holistic approach might be required to address all integration challenges.
That said, this is an excellent initiative, and I truly appreciate your effort. I won't close this PR but instead suggest continuing the discussion in #86 , Your insights and contribution to that conversation would be incredibly valuable.
Thank you again for your work, and I look forward to seeing where this discussion leads!
Signed-off-by: st01cs <42166106+st01cs@users.noreply.github.com>
Replace python.ast with tree-sitter. This commit is just a replacement for python parser. If it works well, tree-sitter will support more language parser(C/C++, Java...)