Add a picker for jj bookmark list
(#30883)
This PR adds a new picker for viewing a list of jj bookmarks, like you would with `jj bookmark list`. This is an exploration around what it would look like to begin adding some dedicated jj features to Zed. This is behind the `jj-ui` feature flag. Release Notes: - N/A
This commit is contained in:
parent
122d6c9e4d
commit
dd3956eaf1
16 changed files with 1644 additions and 152 deletions
39
crates/jj_ui/src/jj_ui.rs
Normal file
39
crates/jj_ui/src/jj_ui.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
mod bookmark_picker;
|
||||
|
||||
use command_palette_hooks::CommandPaletteFilter;
|
||||
use feature_flags::FeatureFlagAppExt as _;
|
||||
use gpui::App;
|
||||
use jj::JujutsuStore;
|
||||
use workspace::Workspace;
|
||||
|
||||
pub fn init(cx: &mut App) {
|
||||
JujutsuStore::init_global(cx);
|
||||
|
||||
cx.observe_new(|workspace: &mut Workspace, _window, _cx| {
|
||||
bookmark_picker::register(workspace);
|
||||
})
|
||||
.detach();
|
||||
|
||||
feature_gate_jj_ui_actions(cx);
|
||||
}
|
||||
|
||||
fn feature_gate_jj_ui_actions(cx: &mut App) {
|
||||
const JJ_ACTION_NAMESPACE: &str = "jj";
|
||||
|
||||
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
||||
filter.hide_namespace(JJ_ACTION_NAMESPACE);
|
||||
});
|
||||
|
||||
cx.observe_flag::<feature_flags::JjUiFeatureFlag, _>({
|
||||
move |is_enabled, cx| {
|
||||
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
||||
if is_enabled {
|
||||
filter.show_namespace(JJ_ACTION_NAMESPACE);
|
||||
} else {
|
||||
filter.hide_namespace(JJ_ACTION_NAMESPACE);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue