@@ -914,6 +914,31 @@ fn to_locations(definitions: Option<lsp::GotoDefinitionResponse>) -> Vec<lsp::Lo
917+pub fn goto_declaration(cx: &mut Context) {
918+ let (view, doc) = current!(cx.editor);
919+ let language_server = language_server!(cx.editor, doc);
920+ let offset_encoding = language_server.offset_encoding();
922+ let pos = doc.position(view.id, offset_encoding);
924+ let future = match language_server.goto_declaration(doc.identifier(), pos, None) {
925+ Some(future) => future,
928+ .set_error("Language server does not support goto-declaration");
935+ move |editor, compositor, response: Option<lsp::GotoDefinitionResponse>| {
936+ let items = to_locations(response);
937+ goto_impl(editor, compositor, items, offset_encoding);
917pub fn goto_definition(cx: &mut Context) {
942pub fn goto_definition(cx: &mut Context) {
918 let (view, doc) = current!(cx.editor);
943 let (view, doc) = current!(cx.editor);
919 let language_server = language_server!(cx.editor, doc);
944 let language_server = language_server!(cx.editor, doc);