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

feat!: custom preloader & previewer #401

Merged
merged 8 commits into from
Dec 26, 2023
Merged

feat!: custom preloader & previewer #401

merged 8 commits into from
Dec 26, 2023

Conversation

sxyazi
Copy link
Owner

@sxyazi sxyazi commented Nov 26, 2023

This marks a milestone in the "Yazi concurrent plugin system". I spent a lot of time thinking how to build it - prioritizing efficiency while ensuring scalability. To achieve this:

  • All I/O tasks are asynchronous and concurrent, even including the plugins themselves.
  • Previewers/preloaders for all file formats are re-implemented as Lua plugins (CPU-bound tasks are still in Rust).
  • The entire file system has been rewritten - no more frequent directory list reads to keep things up-to-date. Instead, heuristic updates for changed files are in place.
  • UI rendering is done in a separate thread through Lua plugins, enabling concurrent rendering. This is useful for CPU-bound tasks like code highlighting, JSON preview, external escape sequences, and custom components. The entire process is discardable (IO/CPU).
  • More granular control over task cancellation: leveraging Lua, task discarding isn't restricted to just I/O. CPU tasks can now also be discarded - checking for discarding during function calls, returns, and fixed instructions have executed.
  • New mixed media preview mode: imagine displaying file metadata (e.g., video duration, resolution, color space) above or below the preview image simultaneously.

I think I made it; Yazi will be faster than ever before! Note: This is a breaking change set to be released as Yazi v0.2.0. If you have time, please help us in testing it! 🙏🏻

If you're interested in creating your own preloader or previewer, there are some built-in examples here: https://github.com/sxyazi/yazi/tree/main/yazi-plugin/preset/plugins. I'll release the new plugin API documentation at https://yazi-rs.github.io soon.

Breaking changes:

See Migrating to Yazi v0.2.0.

Tagging the owners of affected repos as a headsup:

https://github.com/search?q=ui.Base%28+yazi+NOT+is%3Afork&type=code

@sxyazi sxyazi changed the title [WIP] feat: plugin system feat: custom preloader & previewer Dec 26, 2023
@sxyazi sxyazi mentioned this pull request Dec 26, 2023
@sxyazi sxyazi changed the title feat: custom preloader & previewer feat!: custom preloader & previewer Dec 26, 2023
@sxyazi sxyazi merged commit 82bab0f into main Dec 26, 2023
3 checks passed
@sxyazi sxyazi deleted the pr-2c3cab5c branch December 26, 2023 11:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant