Links to channel notes (#7262)

Release Notes:

- Added outline support for Markdown files
- Added the ability to link to channel notes:
https://zed.dev/channel/zed-283/notes#Roadmap
This commit is contained in:
Conrad Irwin
2024-02-01 22:22:02 -07:00
committed by GitHub
parent b35a7223b6
commit 69e0ea92e4
13 changed files with 260 additions and 65 deletions
+15
View File
@@ -413,6 +413,12 @@ pub struct Editor {
editor_actions: Vec<Box<dyn Fn(&mut ViewContext<Self>)>>,
show_copilot_suggestions: bool,
use_autoclose: bool,
custom_context_menu: Option<
Box<
dyn 'static
+ Fn(&mut Self, DisplayPoint, &mut ViewContext<Self>) -> Option<View<ui::ContextMenu>>,
>,
>,
}
pub struct EditorSnapshot {
@@ -1476,6 +1482,7 @@ impl Editor {
hovered_cursors: Default::default(),
editor_actions: Default::default(),
show_copilot_suggestions: mode == EditorMode::Full,
custom_context_menu: None,
_subscriptions: vec![
cx.observe(&buffer, Self::on_buffer_changed),
cx.subscribe(&buffer, Self::on_buffer_event),
@@ -1665,6 +1672,14 @@ impl Editor {
self.collaboration_hub = Some(hub);
}
pub fn set_custom_context_menu(
&mut self,
f: impl 'static
+ Fn(&mut Self, DisplayPoint, &mut ViewContext<Self>) -> Option<View<ui::ContextMenu>>,
) {
self.custom_context_menu = Some(Box::new(f))
}
pub fn set_completion_provider(&mut self, hub: Box<dyn CompletionProvider>) {
self.completion_provider = Some(hub);
}