grep names each file once with its lines under it, the changes header keeps its position whole, and the bash teardown tests stop flaking on macOS
- grep groups its lines under each file, the layout of rg --heading, rather than repeating the path on every line: 9–28% fewer bytes than rg -n on the searches measured. scopes: true labels each run of matches with the function or type around it. - The changes pane's header shortens the path rather than cut its position, and keeps a gap before the FILE / DIFF switch. - The bash teardown tests count a loop still running as a survivor, not one write already under way when the kill landed.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
mod standards;
|
||||
|
||||
pub use standards::{FunctionSize, OutlineSource};
|
||||
pub use standards::{FunctionSize, OutlineSource, Scope};
|
||||
|
||||
use crate::formatter::FormatterRegistry;
|
||||
use crate::hook::{Hook, HookCtx, HookEvent, HookOutcome, HookPoint};
|
||||
|
||||
@@ -20,6 +20,24 @@ const MAX_NAMED: usize = 5;
|
||||
pub trait OutlineSource: Send + Sync {
|
||||
/// The functions and methods in `source`, or `None` for a language it cannot parse.
|
||||
fn functions(&self, path: &Path, source: &str) -> Option<Vec<FunctionSize>>;
|
||||
|
||||
/// The named scopes in `source` that can hold code: functions, methods, types and modules,
|
||||
/// not fields or constants. `None` for a language it cannot parse, which is also the default.
|
||||
/// A search labels what it found with the scopes around it.
|
||||
fn scopes(&self, _path: &Path, _source: &str) -> Option<Vec<Scope>> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// One named scope and the lines it spans, 0-based and inclusive.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Scope {
|
||||
/// The bare name, `delete` or `QuerySet`
|
||||
pub name: String,
|
||||
/// Its first line, where its declaration starts
|
||||
pub start_line: usize,
|
||||
/// Its last line
|
||||
pub end_line: usize,
|
||||
}
|
||||
|
||||
/// One function's name, qualified by its container where it has one, and its length.
|
||||
|
||||
Reference in New Issue
Block a user