Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command palette cannot create new pickers #4508

Open
the-mikedavis opened this issue Oct 28, 2022 · 3 comments
Open

Command palette cannot create new pickers #4508

the-mikedavis opened this issue Oct 28, 2022 · 3 comments
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug E-hard Call for participation: Experience needed to fix: Hard / a lot

Comments

@the-mikedavis
Copy link
Member

Summary

Running a command from the command palette (<space>?) which pushes a new picker to the compositor will not create the picker.

Reproduction Steps

<space>?jumplist_picker<ret> should bring up the jumplist picker but it has no effect. Running the jumplist picker command from its keybind (<space>j) works.

Helix log

No response

Platform

Linux

Terminal Emulator

Kitty 0.26.2

Helix Version

26f21da

@the-mikedavis the-mikedavis added C-bug Category: This is a bug A-helix-term Area: Helix term improvements labels Oct 28, 2022
@nrabulinski
Copy link
Contributor

Has this been picked up yet? If not I can get on it as I identified what the issue is

@woojiq
Copy link
Contributor

woojiq commented Jul 24, 2023

What I dug up:

Actually, async pickers work even from the command palette. The reason is that they use callback method that internally add a picker to the application's task list:

cx.callback(

Sync pickers, on the other hand, use the push_layer method, which internally populates the callback field:

pub fn push_layer(&mut self, component: Box<dyn Component>) {
self.callback = Some(Box::new(|compositor: &mut Compositor, _| {

The interesting part about this field is that it only resolves in one place - EditorView::handle_event:

mode => self.command_mode(mode, &mut cx, key),

So when you populate this field while in the command palette, it will be lost and incomplete just because the Picker has a different handle_event implementation:
fn handle_event(&mut self, event: &Event, ctx: &mut Context) -> EventResult {

So far I have only one idea to solve this: inside the push_layer make the callback asynchronous and add it to the application's task list (same as the async pickers do). Otherwise, anything that uses push_layer (file, jumplist, buffer pickers...) will only work if you start them from EditorView (the first layer).

P.S. I wrote this so tomorrow I will recall what I was thinking, xd. Maybe someone will be interested.

@the-mikedavis
Copy link
Member Author

I believe the proper fix for this overlaps with #1383 / #4709 (also see #5294 (comment) and #5555). Those need a very large refactor to commands that should probably be taken care of internally (see #5581).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug E-hard Call for participation: Experience needed to fix: Hard / a lot
Projects
None yet
Development

No branches or pull requests

3 participants