Polish Ruby language support#574
Conversation
PR Overview: Polish Ruby Language SupportSummaryThis PR significantly enhances Ruby language support across Probe's CLI and LSP daemon by adding first-class symbol handling, improving nested symbol resolution, and tightening test detection. The changes span 10 files with 511 additions and 30 deletions. Key Changes1. LSP Daemon Tree-Sitter IntegrationFile:
File:
2. Ruby Language Rules for UID GenerationFile:
File:
3. Enhanced Symbol ExtractionFile:
File:
4. Ruby Language ImplementationFile:
5. Test Detection ImprovementsFile:
File:
6. Test FixFile:
Architecture & ImpactComponent Relationshipsgraph TD
A[Ruby Source Code] --> B[tree-sitter-ruby Parser]
B --> C[ParserPool lsp-daemon]
B --> D[ParserPool CLI]
C --> E[TreeSitterAnalyzer]
E --> F[map_ruby_node_to_symbol]
E --> G[creates_scope ruby]
C --> H[LspDatabaseAdapter]
H --> I[node_kind_to_symbol_kind]
H --> J[is_symbol_like ruby]
D --> K[SymbolFinder]
K --> L[find_symbol_in_file]
K --> M[get_qualified_name constant]
D --> N[SymbolExtractor]
N --> O[collect_symbols body_statement]
N --> P[extract_symbol_name constant]
Q[LanguageRules ruby] --> R[SymbolUIDGenerator]
R --> S[Stable Ruby Symbol IDs]
T[RubyLanguage impl] --> U[is_test_node Minitest/RSpec]
T --> V[find_parent_function]
T --> W[get_symbol_signature]
X[test_detection] --> Y[is_test_file components]
Data Flow: Nested Ruby Symbol ExtractionsequenceDiagram
participant CLI as probe extract
participant SF as SymbolFinder
participant AL as RubyLanguage
participant TS as tree-sitter-ruby
participant SS as SymbolExtractor
CLI->>SF: find_symbol_in_file("Base.add_offense")
SF->>TS: parse Ruby code
TS-->>SF: AST with module/class/method nodes
SF->>AL: is_acceptable_parent(method node)
AL-->>SF: true (method is acceptable)
SF->>SF: Traverse nested: RuboCop → Cop → Base → add_offense
SF->>SS: extract_symbols()
SS->>SS: collect_symbols() through body_statement
SS->>SS: extract_symbol_name() using constant node
SS-->>SF: Symbol hierarchy with Base.add_offense
SF-->>CLI: Method node with code body
Scope Discovery & Context ExpansionAffected Modules
Related Files (Not Modified)Based on the search analysis, these files are related but not changed in this PR:
Testing CoverageThe PR includes comprehensive tests:
ValidationThe author tested against a real RuboCop checkout (1,718 Ruby files) and validated:
ReferencesModified Files
Metadata
Powered by Visor from Probelabs Last updated: 2026-06-04T12:57:39.654Z | Triggered by: pr_opened | Commit: 4be42ab 💡 TIP: You can chat with Visor using |
Security Issues (2)
Architecture Issues (1)
Quality Issues (9)
Powered by Visor from Probelabs Last updated: 2026-06-04T12:39:18.419Z | Triggered by: pr_opened | Commit: 4be42ab 💡 TIP: You can chat with Visor using |
Summary
Polishes Ruby support across the CLI symbol/search paths and the LSP daemon tree-sitter path.
Implemented
module,class,method, andsingleton_methodas first-class symbols.body_statementwrappers and non-symbol wrapper nodes.file#symbolextraction for nested Ruby classes, instance methods, and singleton methods.lsp-daemonand wire Ruby symbol kind/scope mapping.test/,spec/,*_test.rb,*_spec.rb, Minitesttest_methods, and RSpecdescribe/context/itblocks.test/foo.rbare detected, not only paths containing/test/with a leading parent component.Tests
cargo test ruby --libcargo test --test ruby_outline_format_tests -- --nocapturecargo test -p lsp-daemon rubycargo test -p lsp-daemon test_node_kind_to_symbol_kind_mapping --libcargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo test --libcargo test --test integration_testsDogfood
Tested against a real RuboCop checkout:
/tmp/probe-ruby-dogfood/rubocophttps://github.com/rubocop/rubocop.git0553884(2026-06-04 02:11:54 +0900, merge PR #15211)Validated:
probe symbols -o json /tmp/probe-ruby-dogfood/rubocop/lib/rubocop/cop/base.rbfinds nestedRuboCop,Cop,Base,documentation_url, andadd_offensesymbols.probe extract .../base.rb#Basereturns the actualclass Basebody.probe extract .../base.rb#Base.add_offensereturns the instance method body.probe extract .../base.rb#Base.documentation_urlreturns the singleton method body.probe search add_offense /tmp/probe-ruby-dogfood/rubocop -l ruby --max-results 3 -o plainreturns Ruby method-context results from RuboCoplib/.probe query -l ruby 'def $NAME' .../base.rb --max-results 3 -o jsonreturns Ruby method matches.spec/fordescribereturns no results by default and returns RSpec matches with--allow-tests.Notes
probe lsp languagesstill reports Ruby external LSP as unavailable on this machine becausesolargraphis not installed. This PR adds the internal tree-sitter/LSP-daemon Ruby parser and symbol plumbing; it does not install or vendor the external Ruby LSP server.