@@ -4251,26 +4251,33 @@ fn scroll_down(cx: &mut Context) {
4251 scroll(cx, cx.count(), Direction::Forward);
4251 scroll(cx, cx.count(), Direction::Forward);
4254−fn goto_ts_object_impl(cx: &mut Context, object: &str, direction: Direction) {
4254+fn goto_ts_object_impl(cx: &mut Context, object: &'static str, direction: Direction) {
4255 let count = cx.count();
4255 let count = cx.count();
4256+ let motion = move |editor: &mut Editor| {
4256− let (view, doc) = current!(cx.editor);
4257+ let (view, doc) = current!(editor);
4258+ if let Some((lang_config, syntax)) = doc.language_config().zip(doc.syntax()) {
4257− let text = doc.text().slice(..);
4259+ let text = doc.text().slice(..);
4258− let range = doc.selection(view.id).primary();
4260+ let root = syntax.tree().root_node();
4260− let new_range = match doc.language_config().zip(doc.syntax()) {
4262+ let selection = doc.selection(view.id).clone().transform(|range| {
4261− Some((lang_config, syntax)) => movement::goto_treesitter_object(
4263+ movement::goto_treesitter_object(
4264− object,
4266+ object,
4265− direction,
4267+ direction,
4266− syntax.tree().root_node(),
4268+ root,
4267− lang_config,
4269+ lang_config,
4273− doc.set_selection(view.id, Selection::single(new_range.anchor, new_range.head));
4274+ doc.set_selection(view.id, selection);
4276+ editor.set_status("Syntax-tree is not available in current buffer");
4280+ cx.editor.last_motion = Some(Motion(Box::new(motion)));
4276fn goto_next_function(cx: &mut Context) {
4283fn goto_next_function(cx: &mut Context) {