Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import tree-sitter to handle python files #87

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

st01cs
Copy link
Contributor

@st01cs st01cs commented Dec 31, 2024

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...)

Copy link
Collaborator

@Umpire2018 Umpire2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Dependency Concerns: The introduction of tree_sitter_languages adds 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())
  2. 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!

@st01cs st01cs changed the title feat(file_handler) replace python.ast with tree-sitter to parse python Import tree-sitter to handle python files Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants