Make "go to definition" work in project diagnostics

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-01-20 17:30:30 +01:00
parent d92b40474f
commit b6685a532c
9 changed files with 79 additions and 37 deletions

View file

@ -80,17 +80,13 @@ impl GoToLine {
}
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
workspace.toggle_modal(cx, |cx, workspace| {
let editor = workspace
.active_item(cx)
.unwrap()
.to_any()
.downcast::<Editor>()
.unwrap();
let view = cx.add_view(|cx| GoToLine::new(editor, workspace.settings.clone(), cx));
cx.subscribe(&view, Self::on_event).detach();
view
});
if let Some(editor) = workspace.active_item(cx).unwrap().downcast::<Editor>() {
workspace.toggle_modal(cx, |cx, workspace| {
let view = cx.add_view(|cx| GoToLine::new(editor, workspace.settings.clone(), cx));
cx.subscribe(&view, Self::on_event).detach();
view
});
}
}
fn confirm(&mut self, _: &Confirm, cx: &mut ViewContext<Self>) {