@ -4251,26 +4251,33 @@ fn scroll_down(cx: &mut Context) {
scroll ( cx , cx . count ( ) , Direction ::Forward ) ;
scroll ( cx , cx . count ( ) , Direction ::Forward ) ;
}
}
fn goto_ts_object_impl ( cx : & mut Context , object : & str , direction : Direction ) {
fn goto_ts_object_impl ( cx : & mut Context , object : & ' static str , direction : Direction ) {
let count = cx . count ( ) ;
let count = cx . count ( ) ;
let ( view , doc ) = current ! ( cx . editor ) ;
let motion = move | editor : & mut Editor | {
let text = doc . text ( ) . slice ( .. ) ;
let ( view , doc ) = current ! ( editor ) ;
let range = doc . selection ( view . id ) . primary ( ) ;
if let Some ( ( lang_config , syntax ) ) = doc . language_config ( ) . zip ( doc . syntax ( ) ) {
let text = doc . text ( ) . slice ( .. ) ;
let root = syntax . tree ( ) . root_node ( ) ;
let new_range = match doc . language_config ( ) . zip ( doc . syntax ( ) ) {
let selection = doc . selection ( view . id ) . clone ( ) . transform ( | range | {
Some ( ( lang_config , syntax ) ) = > movement ::goto_treesitter_object (
movement ::goto_treesitter_object (
text ,
text ,
range ,
range ,
object ,
object ,
direction ,
direction ,
syntax . tree ( ) . root_node ( ) ,
root ,
lang_config ,
lang_config ,
count ,
count ,
) ,
)
None = > range ,
} ) ;
} ;
doc . set_selection ( view . id , Selection ::single ( new_range . anchor , new_range . head ) ) ;
doc . set_selection ( view . id , selection ) ;
} else {
editor . set_status ( "Syntax-tree is not available in current buffer" ) ;
}
} ;
motion ( cx . editor ) ;
cx . editor . last_motion = Some ( Motion ( Box ::new ( motion ) ) ) ;
}
}
fn goto_next_function ( cx : & mut Context ) {
fn goto_next_function ( cx : & mut Context ) {