@@ -846,7 +846,27 @@ pub fn exit_select_mode(cx: &mut Context) {
846846 cx.doc().mode = Mode::Normal;
847847}
848848
849−pub fn goto_definition(cx: &mut Context) {}
849+pub fn goto_definition(cx: &mut Context) {
850+ let language_server = cx
851+ .editor
852+ .language_servers
853+ .get("source.rust", &cx.executor)
854+ .unwrap();
855+ use log::info;
856+
857+ let doc = cx.doc();
858+
859+ // TODO: blocking here is not ideal
860+ let pos = helix_lsp::util::pos_to_lsp_pos(doc.text().slice(..), doc.selection().cursor());
861+
862+ // TODO: handle fails
863+ let res = smol::block_on(language_server.goto_definition(cx.doc().identifier(), pos))
864+ .unwrap_or_default();
865+
866+ println!("{:?}", res);
867+
868+ cx.doc().mode = Mode::Normal;
869+}
850870
851871// NOTE: Transactions in this module get appended to history when we switch back to normal mode.
852872pub mod insert {