modify goto_reference_direction to work with new lsp macro

pull/6465/head
Anthony Templeton 2 years ago
parent 276ba37f0b
commit 1fd4de9400

@ -18,7 +18,8 @@ use tui::{
use super::{align_view, push_jump, Align, Context, Editor, Open}; use super::{align_view, push_jump, Align, Context, Editor, Open};
use helix_core::{ use helix_core::{
path, syntax::LanguageServerFeature, text_annotations::InlineAnnotation, Selection, movement::Direction, path, syntax::LanguageServerFeature, text_annotations::InlineAnnotation,
Selection,
}; };
use helix_view::{ use helix_view::{
document::{DocumentInlayHints, DocumentInlayHintsId, Mode}, document::{DocumentInlayHints, DocumentInlayHintsId, Mode},
@ -1148,13 +1149,20 @@ pub fn goto_reference(cx: &mut Context) {
} }
pub fn goto_reference_direction(cx: &mut Context, direction: Direction) { pub fn goto_reference_direction(cx: &mut Context, direction: Direction) {
let config = cx.editor.config();
let (view, doc) = current!(cx.editor); let (view, doc) = current!(cx.editor);
let language_server = language_server!(cx.editor, doc); let language_server =
language_server_with_feature!(cx.editor, doc, LanguageServerFeature::GotoReference);
let offset_encoding = language_server.offset_encoding(); let offset_encoding = language_server.offset_encoding();
let pos = doc.position(view.id, offset_encoding); let pos = doc.position(view.id, offset_encoding);
let future = match language_server.goto_reference(doc.identifier(), pos, None) { let future = match language_server.goto_reference(
doc.identifier(),
pos,
config.lsp.goto_reference_include_declaration,
None,
) {
Some(future) => future, Some(future) => future,
None => { None => {
cx.editor cx.editor

Loading…
Cancel
Save