Fix clippy warnings.

pull/1/head
Blaž Hrastnik 4 years ago
parent d466882d04
commit 593f33dca6

@ -1,52 +1,52 @@
pub struct LanguageMode { // pub struct Syntax {
parser: Parser, // 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
}
// fn buffer_changed -> call layer.update(range, new_text) on root layer and then all marker layers //impl Syntax {
// // buffer, grammar, config, grammars, sync_timeout?
// call this on transaction.apply() -> buffer_changed(changes) // pub fn new() -> Self {
// // unimplemented!()
// fn parse(language, old_tree, ranges) // // make a new root layer
// // // track markers of injections
// fn tree() -> Tree // //
// // // track scope_descriptor: a Vec of scopes for item in tree
// <!--update_for_injection(grammar)--> // //
// // fetch grammar for parser based on language string
// Highlighting // // update root layer
// fn highlight_iter() -> iterates over all the scopes // }
// on_tokenize
// on_change_highlighting // // fn buffer_changed -> call layer.update(range, new_text) on root layer and then all marker layers
// Commenting // // call this on transaction.apply() -> buffer_changed(changes)
// comment_strings_for_pos // //
// is_commented // // fn parse(language, old_tree, ranges)
// //
// Indentation // // fn tree() -> Tree
// suggested_indent_for_line_at_buffer_row // //
// suggested_indent_for_buffer_row // // <!--update_for_injection(grammar)-->
// indent_level_for_line
// // Highlighting
// TODO: Folding // // fn highlight_iter() -> iterates over all the scopes
// // on_tokenize
// Syntax APIs // // on_change_highlighting
// get_syntax_node_containing_range ->
// ... // // Commenting
// get_syntax_node_at_pos // // comment_strings_for_pos
// buffer_range_for_scope_at_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 { pub struct LanguageLayer {
// mode // mode
@ -55,12 +55,12 @@ pub struct LanguageLayer {
// tree: Tree, // tree: Tree,
} }
impl LanguageLayer { // impl LanguageLayer {
// fn highlight_iter() -> same as Mode but for this layer. Mode composits these // // fn highlight_iter() -> same as Mode but for this layer. Mode composits these
// fn buffer_changed // // fn buffer_changed
// fn update(range) // // fn update(range)
// fn update_injections() // // fn update_injections()
} // }
// -- refactored from tree-sitter-highlight to be able to retain state // -- refactored from tree-sitter-highlight to be able to retain state
// TODO: add seek() to iter // TODO: add seek() to iter
@ -189,13 +189,19 @@ struct HighlightIterLayer<'a> {
depth: usize, depth: usize,
} }
impl Highlighter { impl Default for Highlighter {
pub fn new() -> Self { fn default() -> Self {
Highlighter { Highlighter {
parser: Parser::new(), parser: Parser::new(),
cursors: Vec::new(), cursors: Vec::new(),
} }
} }
}
impl Highlighter {
pub fn new() -> Self {
Self::default()
}
pub fn parser(&mut self) -> &mut Parser { pub fn parser(&mut self) -> &mut Parser {
&mut self.parser &mut self.parser

Loading…
Cancel
Save