Add containing range APIs to query cursor
Co-authored-by: Kirill Bulatov <mail4score@gmail.com> Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com> Co-authored-by: dino <dinojoaocosta@gmail.com> Co-authored-by: John Tur <john-tur@outlook.com> Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Co-authored-by: dino <dinojoaocosta@gmail.com> Co-authored-by: Will Lillis <will.lillis24@gmail.com>
This commit is contained in:
parent
7d3feeae9a
commit
c0b1710f8a
13 changed files with 420 additions and 34 deletions
|
|
@ -21,6 +21,8 @@ pub struct QueryFileOptions {
|
|||
pub ordered_captures: bool,
|
||||
pub byte_range: Option<Range<usize>>,
|
||||
pub point_range: Option<Range<Point>>,
|
||||
pub containing_byte_range: Option<Range<usize>>,
|
||||
pub containing_point_range: Option<Range<Point>>,
|
||||
pub quiet: bool,
|
||||
pub print_time: bool,
|
||||
pub stdin: bool,
|
||||
|
|
@ -48,6 +50,12 @@ pub fn query_file_at_path(
|
|||
if let Some(ref range) = opts.point_range {
|
||||
query_cursor.set_point_range(range.clone());
|
||||
}
|
||||
if let Some(ref range) = opts.containing_byte_range {
|
||||
query_cursor.set_containing_byte_range(range.clone());
|
||||
}
|
||||
if let Some(ref range) = opts.containing_point_range {
|
||||
query_cursor.set_containing_point_range(range.clone());
|
||||
}
|
||||
|
||||
let mut parser = Parser::new();
|
||||
parser.set_language(language)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue