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:
Marshall Bowers 2025-05-17 18:42:45 +02:00 committed by GitHub
parent 122d6c9e4d
commit dd3956eaf1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 1644 additions and 152 deletions

39
crates/jj_ui/src/jj_ui.rs Normal file
View 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();
}