Objective
Add support for chained method calls in Dialect to enable more expressive and readable code navigation queries.
Problem
Current Dialect syntax is limited to simple function calls, making complex location queries verbose or impossible:
// Current - limited expressiveness
findDefinition(`User`)
search(`*.rs`, `TODO:`)
Solution
Implement chained method calls for fluent API-style navigation:
// Proposed - fluent and expressive
findDefinition(`User`).methods().named('validate')
search(`*.rs`, `TODO:`).limit(5).inFile('auth')
findReferences(`validate_token`).filter(f => f.path.includes('test')).first()
Implementation Ideas
Core Method Categories
Filtering methods:
.filter(predicate) - Filter results by condition
.named(pattern) - Filter by name matching
.inFile(pattern) - Filter by file path
.inDirectory(path) - Filter by directory
Selection methods:
.first() - Take first result
.last() - Take last result
.limit(n) - Take first n results
.at(index) - Take result at index
Symbol-specific methods:
.methods() - Get methods of a class/struct
.fields() - Get fields of a class/struct
.implementations() - Get trait implementations
.usages() - Get usage sites
Location methods:
.line(n) - Move to specific line in same file
.range(start, end) - Expand to line range
Example Use Cases
Find specific method in class:
findDefinition(`TokenValidator`).methods().named('validate')
Find TODO comments in auth module:
search(`src/auth/**/*.rs`, `TODO:`).limit(10)
Find test usages of a function:
findReferences(`validate_token`).inDirectory('tests').first()
Find struct fields:
findDefinition(`User`).fields().named('email')
Benefits
- More readable - Natural language-like queries
- More powerful - Complex filtering and selection
- Better UX - Easier for LLMs to generate correct expressions
- Extensible - Easy to add new methods over time
Implementation Notes
- Maintain backward compatibility with current simple function calls
- Consider lazy evaluation for performance
- Add comprehensive error messages for invalid chains
- Document method availability per result type
Context
This enhancement supports the new markdown+XML walkthrough format (#30) by making location expressions more natural and powerful for AI assistants to generate.
Objective
Add support for chained method calls in Dialect to enable more expressive and readable code navigation queries.
Problem
Current Dialect syntax is limited to simple function calls, making complex location queries verbose or impossible:
Solution
Implement chained method calls for fluent API-style navigation:
Implementation Ideas
Core Method Categories
Filtering methods:
.filter(predicate)- Filter results by condition.named(pattern)- Filter by name matching.inFile(pattern)- Filter by file path.inDirectory(path)- Filter by directorySelection methods:
.first()- Take first result.last()- Take last result.limit(n)- Take first n results.at(index)- Take result at indexSymbol-specific methods:
.methods()- Get methods of a class/struct.fields()- Get fields of a class/struct.implementations()- Get trait implementations.usages()- Get usage sitesLocation methods:
.line(n)- Move to specific line in same file.range(start, end)- Expand to line rangeExample Use Cases
Find specific method in class:
Find TODO comments in auth module:
Find test usages of a function:
Find struct fields:
Benefits
Implementation Notes
Context
This enhancement supports the new markdown+XML walkthrough format (#30) by making location expressions more natural and powerful for AI assistants to generate.