@@ -847,25 +847,21 @@ pub fn exit_select_mode(cx: &mut Context) {
849pub fn goto_definition(cx: &mut Context) {
849pub fn goto_definition(cx: &mut Context) {
850− let language_server = cx
853− .get("source.rust", &cx.executor)
857 let doc = cx.doc();
850 let doc = cx.doc();
852+ let language_server = match doc.language_server.as_ref() {
853+ Some(language_server) => language_server,
859 // TODO: blocking here is not ideal
857 // TODO: blocking here is not ideal
860 let pos = helix_lsp::util::pos_to_lsp_pos(doc.text().slice(..), doc.selection().cursor());
858 let pos = helix_lsp::util::pos_to_lsp_pos(doc.text().slice(..), doc.selection().cursor());
862 // TODO: handle fails
860 // TODO: handle fails
863− let res = smol::block_on(language_server.goto_definition(cx.doc().identifier(), pos))
862+ smol::block_on(language_server.goto_definition(doc.identifier(), pos)).unwrap_or_default();
864− .unwrap_or_default();
866− println!("{:?}", res);
868− cx.doc().mode = Mode::Normal;
864+ doc.mode = Mode::Normal;
871// NOTE: Transactions in this module get appended to history when we switch back to normal mode.
867// NOTE: Transactions in this module get appended to history when we switch back to normal mode.