Make Layer::parse take &mut tree_sitter::Parser
This commit is contained in:
parent
e22dbf102f
commit
9d41113ae0
@ -584,7 +584,7 @@ fn point_sub(a: Point, b: Point) -> Point {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Re-parse the tree.
|
// Re-parse the tree.
|
||||||
layer.parse(ts_parser, source)?;
|
layer.parse(&mut ts_parser.parser, source)?;
|
||||||
|
|
||||||
// Switch to an immutable borrow.
|
// Switch to an immutable borrow.
|
||||||
let layer = &self.layers[layer_id];
|
let layer = &self.layers[layer_id];
|
||||||
@ -822,17 +822,15 @@ pub fn tree(&self) -> &Tree {
|
|||||||
self.tree.as_ref().unwrap()
|
self.tree.as_ref().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse(&mut self, ts_parser: &mut TsParser, source: &Rope) -> Result<(), Error> {
|
fn parse(&mut self, parser: &mut Parser, source: &Rope) -> Result<(), Error> {
|
||||||
ts_parser.parser.set_included_ranges(&self.ranges).unwrap();
|
parser.set_included_ranges(&self.ranges).unwrap();
|
||||||
|
|
||||||
ts_parser
|
parser
|
||||||
.parser
|
|
||||||
.set_language(self.config.language)
|
.set_language(self.config.language)
|
||||||
.map_err(|_| Error::InvalidLanguage)?;
|
.map_err(|_| Error::InvalidLanguage)?;
|
||||||
|
|
||||||
// unsafe { syntax.parser.set_cancellation_flag(cancellation_flag) };
|
// unsafe { syntax.parser.set_cancellation_flag(cancellation_flag) };
|
||||||
let tree = ts_parser
|
let tree = parser
|
||||||
.parser
|
|
||||||
.parse_with(
|
.parse_with(
|
||||||
&mut |byte, _| {
|
&mut |byte, _| {
|
||||||
if byte <= source.len_bytes() {
|
if byte <= source.len_bytes() {
|
||||||
|
Loading…
Reference in New Issue
Block a user