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 #618

Closed
gbaranski opened this issue Aug 18, 2021 · 2 comments
Closed

Add common trait for all frontends #618

gbaranski opened this issue Aug 18, 2021 · 2 comments
Labels
A-core Area: Helix core improvements C-enhancement Category: Improvements

Comments

@gbaranski
Copy link
Contributor

that would unblock #39

@kirawi kirawi added A-core Area: Helix core improvements C-enhancement Category: Improvements labels Aug 19, 2021
@sudormrfbin
Copy link
Member

sudormrfbin commented Sep 3, 2021

I'm going to try to implement this, and the following is more or less the design I'm thinking of.

  • Make Compositor a trait, which can be implemented by each frontend. It takes items which implement the Component trait and renders them as layers on layers.

  • Move [structs implmenting] Components like FilePicker, EditorView, Popup, etc to helix-view. Now we have everything except the rendering logic in the base helix-view crate and frontends can handle rendering.

The Compositor and Component traits will be both defined in helix-view. The common "widgets" (items implementing Component) will also be in helix-view. These widgets will need to have the Component trait defined separately by each frontend. Since the frontend is another crate (like helix-term) we cannot do this:

// frontend crate
use helix_view::Component;
use helix_view::ui::FilePicker

// cannot implement a foreign trait for a foreign type
impl Component for FilePicker { /* ... */ }

We will need to use the newtype pattern and define wrapper structs for all widgets in frontends, which can then implement Component and also provide additional functionality if needed.

Any other ideas/suggestions welcome :)

@kirawi
Copy link
Member

kirawi commented Jan 18, 2023

Closing in favor of #5555

@kirawi kirawi closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Helix core improvements C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants