by jgke · 2y ago · 0 comments
I find the best uses for it being answering questions like 'how is this function called' and 'what is this struct's definition':
# find struct definition
$ syns 'struct Span {}'
[./src/psi.rs:21-26]
pub struct Span {
/// Starting byte index of the span.
pub lo: usize,
/// End byte index of the span.
pub hi: usize,
}
# How is this function called? $ syns 'ast_match()'
[./src/query.rs:91] if &op.ty == op1 && self.ast_match(content1, &[\*start]).is_some() {
[./src/query.rs:125] .flat_map(move |tts| self.ast_match(tts, &[self.machine.initial]))
It's also pretty fast for most repositories, as an extreme case with the kernel source: time syns 'kmalloc()' > /dev/null
syns 'kmalloc()' > /dev/null 61,82s user 0,90s system 99% cpu 1:02,73 total
Most other repositories print all results pretty much instantly.No comments yet.