Add ruff parser backend as experimental alternative to tree-sitter#16
Merged
ram-nadella merged 5 commits intomainfrom Jun 30, 2025
Merged
Add ruff parser backend as experimental alternative to tree-sitter#16ram-nadella merged 5 commits intomainfrom
ram-nadella merged 5 commits intomainfrom
Conversation
- Add parser trait abstraction to support multiple backends - Implement ruff-based Python parser as alternative to tree-sitter - Add --parser CLI flag to select backend (default: tree-sitter) - Update pylight_devtools with parser comparison tool - Both parsers extract identical symbols with minor column differences - All tests updated to use SymbolIndex::default() This enables experimenting with ruff's parser while maintaining full compatibility with the existing tree-sitter implementation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Split UI into tabs: "Symbol Search" and "Parser Comparison" - Add parser backend dropdown in Symbol Search tab (tree-sitter/ruff) - Pass selected parser to pylight when spawning LSP server - Improve visual design with proper tab navigation - Show current parser in search metrics - Update IndexRequest to include parser parameter This makes it easy to test different parsers without restarting devtools and provides a cleaner separation of concerns in the UI. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove rounded corners from all UI elements for cleaner look - Fix active tab hover state with better contrast (white text on green) - Add subtle hover effect for inactive tabs - Improve visual hierarchy with better color transitions - Active tab now has solid green background for better visibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Active tabs now use blue (#2196F3) with darker blue on hover (#1976D2) - Buttons remain green for visual distinction between navigation and actions - Better separation of UI element purposes through color coding 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace custom from_str method with standard FromStr trait - Apply clippy suggestions for cleaner code - Fix redundant closure warnings - All tests passing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Owner
Author
|
File discovery down from 6 seconds to 1.3 seconds! Python file read, parse and index down from 8.79s to 5.29s Logs of initial bootstrap before optimizations (before switch to ruff and also before the faster file discovery changes in #14) After these fixes landed: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for using ruff's Python parser as an experimental alternative to tree-sitter, while maintaining full backward compatibility. The tree-sitter parser remains the default.
Changes
Parser Abstraction
Parsertrait to abstract symbol extraction logicTreeSitterParserwrapper for existing tree-sitter functionalityRuffParserusing ruff's AST for symbol extractionCLI and Configuration
--parserCLI flag to select backend (default: tree-sitter)FromStrtrait forParserBackendenumDevTools Improvements
Testing and Validation
SymbolIndex::default()Performance
Initial testing shows comparable performance between the two parsers. The ruff parser may have advantages for certain use cases, particularly when integrating with other ruff-based tooling.
Future Work
Test Plan
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com