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

Add common trait for all frontends #620

Closed
wants to merge 1 commit into from
Closed

Add common trait for all frontends #620

wants to merge 1 commit into from

Conversation

gbaranski
Copy link
Contributor

closes #618

@archseer
Copy link
Member

This runs into the discussions under #39, I was leaning towards either abstracting away the ui components, or at the very least sharing the components but keeping the rendering traits separate. That way frontends don't all have to look the same.

@dsseng
Copy link
Contributor

dsseng commented Aug 19, 2021

Probably this has common tasks with client/server model. Backend is responsible of holding and operating on the code, frontend just tells what to do. They will then share a common protocol

@gbaranski
Copy link
Contributor Author

I think I am not familiar enough with helix internals to implement that big change. It'd be better if someone else handle this.

@archseer

I was leaning towards either abstracting away the ui components, or at the very least sharing the components but keeping the rendering traits separate.

My idea was making Compositor trait, and all frontends would implement it, and it'd look something like that

pub trait Compositor {
    fn regex_prompt(
        &mut self,
        prompt: String,
        fun: Box<dyn FnOnce(&mut View, &mut Document, &mut Registers, Regex)>,
    );
    fn command_mode<'a>(
        &mut self,
        completion_fn: Box<dyn FnMut(&str) -> Vec<Completion> + 'static>,
        callback: Box<dyn FnOnce(&mut Context, &str, widgets::prompt::Event)>,
    );
    fn file_picker(&mut self, root: std::path::PathBuf);
    fn buffer_picker(&mut self);
    fn suspend(&mut self);
    // ...
}

@gbaranski gbaranski closed this Aug 19, 2021
@pickfire
Copy link
Contributor

I don't think it is a good idea to couple file picker and the rest with Compositor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add common trait for all frontends
4 participants