summaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-01-09 15:50:32 +0000
committerBlaž Hrastnik2022-01-23 07:04:12 +0000
commit9d41113ae02665fd73a7e25b4aff9cc416cfe4ae (patch)
tree198ae8d3c621fbed4afddc8de25b4a4b9946a19f /helix-core/src
parente22dbf102fea06fe7c4292635543ca2e521d299f (diff)
Make Layer::parse take &mut tree_sitter::Parser
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/syntax.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index ff547c58..3deee459 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -584,7 +584,7 @@ impl Syntax {
}
// Re-parse the tree.
- layer.parse(ts_parser, source)?;
+ layer.parse(&mut ts_parser.parser, source)?;
// Switch to an immutable borrow.
let layer = &self.layers[layer_id];
@@ -822,17 +822,15 @@ impl LanguageLayer {
self.tree.as_ref().unwrap()
}
- fn parse(&mut self, ts_parser: &mut TsParser, source: &Rope) -> Result<(), Error> {
- ts_parser.parser.set_included_ranges(&self.ranges).unwrap();
+ fn parse(&mut self, parser: &mut Parser, source: &Rope) -> Result<(), Error> {
+ parser.set_included_ranges(&self.ranges).unwrap();
- ts_parser
- .parser
+ parser
.set_language(self.config.language)
.map_err(|_| Error::InvalidLanguage)?;
// unsafe { syntax.parser.set_cancellation_flag(cancellation_flag) };
- let tree = ts_parser
- .parser
+ let tree = parser
.parse_with(
&mut |byte, _| {
if byte <= source.len_bytes() {