Merge pull request #1398 from tree-sitter/feat/cli/improve-query-output
feat(cli/query): Improve and unify query sub command output
This commit is contained in:
commit
51aa169387
1 changed files with 7 additions and 3 deletions
|
|
@ -48,10 +48,12 @@ pub fn query_files_at_paths(
|
|||
let capture_name = &query.capture_names()[capture.index as usize];
|
||||
writeln!(
|
||||
&mut stdout,
|
||||
" pattern: {}, capture: {}, row: {}, text: {:?}",
|
||||
" pattern: {:>2}, capture: {} - {}, start: {}, end: {}, text: `{}`",
|
||||
mat.pattern_index,
|
||||
capture.index,
|
||||
capture_name,
|
||||
capture.node.start_position().row,
|
||||
capture.node.start_position(),
|
||||
capture.node.end_position(),
|
||||
capture.node.utf8_text(&source_code).unwrap_or("")
|
||||
)?;
|
||||
results.push(query_testing::CaptureInfo {
|
||||
|
|
@ -70,9 +72,11 @@ pub fn query_files_at_paths(
|
|||
if end.row == start.row {
|
||||
writeln!(
|
||||
&mut stdout,
|
||||
" capture: {}, start: {}, text: {:?}",
|
||||
" capture: {} - {}, start: {}, end: {}, text: `{}`",
|
||||
capture.index,
|
||||
capture_name,
|
||||
start,
|
||||
end,
|
||||
capture.node.utf8_text(&source_code).unwrap_or("")
|
||||
)?;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue