aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-09-13 02:34:51 +0000
committerBlaž Hrastnik2020-09-13 02:36:48 +0000
commit593f33dca6b160b4b52074fb5abaa6359efe8ad1 (patch)
treeaca82ee33f3af6a777ce8dcf3b3b4b1906ae84fe /helix-core/src
parentd466882d0432b7e9cf905041aa7a4f8d56047de0 (diff)
Fix clippy warnings.
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/syntax.rs118
1 files changed, 62 insertions, 56 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index b936ecd3..b661efad 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -1,52 +1,52 @@
-pub struct LanguageMode {
- parser: Parser,
-}
-
-impl LanguageMode {
- // buffer, grammar, config, grammars, sync_timeout?
- pub fn new() -> Self {
- unimplemented!()
- // make a new root layer
- // track markers of injections
- //
- // track scope_descriptor: a Vec of scopes for item in tree
- //
- // fetch grammar for parser based on language string
- // update root layer
- }
+// pub struct Syntax {
+// parser: Parser,
+// }
- // fn buffer_changed -> call layer.update(range, new_text) on root layer and then all marker layers
-
- // call this on transaction.apply() -> buffer_changed(changes)
- //
- // fn parse(language, old_tree, ranges)
- //
- // fn tree() -> Tree
- //
- // <!--update_for_injection(grammar)-->
-
- // Highlighting
- // fn highlight_iter() -> iterates over all the scopes
- // on_tokenize
- // on_change_highlighting
-
- // Commenting
- // comment_strings_for_pos
- // is_commented
-
- // Indentation
- // suggested_indent_for_line_at_buffer_row
- // suggested_indent_for_buffer_row
- // indent_level_for_line
-
- // TODO: Folding
-
- // Syntax APIs
- // get_syntax_node_containing_range ->
- // ...
- // get_syntax_node_at_pos
- // buffer_range_for_scope_at_pos
-}
+//impl Syntax {
+// // buffer, grammar, config, grammars, sync_timeout?
+// pub fn new() -> Self {
+// unimplemented!()
+// // make a new root layer
+// // track markers of injections
+// //
+// // track scope_descriptor: a Vec of scopes for item in tree
+// //
+// // fetch grammar for parser based on language string
+// // update root layer
+// }
+
+// // fn buffer_changed -> call layer.update(range, new_text) on root layer and then all marker layers
+
+// // call this on transaction.apply() -> buffer_changed(changes)
+// //
+// // fn parse(language, old_tree, ranges)
+// //
+// // fn tree() -> Tree
+// //
+// // <!--update_for_injection(grammar)-->
+
+// // Highlighting
+// // fn highlight_iter() -> iterates over all the scopes
+// // on_tokenize
+// // on_change_highlighting
+
+// // Commenting
+// // comment_strings_for_pos
+// // is_commented
+
+// // Indentation
+// // suggested_indent_for_line_at_buffer_row
+// // suggested_indent_for_buffer_row
+// // indent_level_for_line
+
+// // TODO: Folding
+
+// // Syntax APIs
+// // get_syntax_node_containing_range ->
+// // ...
+// // get_syntax_node_at_pos
+// // buffer_range_for_scope_at_pos
+//}
pub struct LanguageLayer {
// mode
@@ -55,12 +55,12 @@ pub struct LanguageLayer {
// tree: Tree,
}
-impl LanguageLayer {
- // fn highlight_iter() -> same as Mode but for this layer. Mode composits these
- // fn buffer_changed
- // fn update(range)
- // fn update_injections()
-}
+// impl LanguageLayer {
+// // fn highlight_iter() -> same as Mode but for this layer. Mode composits these
+// // fn buffer_changed
+// // fn update(range)
+// // fn update_injections()
+// }
// -- refactored from tree-sitter-highlight to be able to retain state
// TODO: add seek() to iter
@@ -189,13 +189,19 @@ struct HighlightIterLayer<'a> {
depth: usize,
}
-impl Highlighter {
- pub fn new() -> Self {
+impl Default for Highlighter {
+ fn default() -> Self {
Highlighter {
parser: Parser::new(),
cursors: Vec::new(),
}
}
+}
+
+impl Highlighter {
+ pub fn new() -> Self {
+ Self::default()
+ }
pub fn parser(&mut self) -> &mut Parser {
&mut self.parser