Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new ya.emit() API to consolidate event emission for various components and deprecate legacy APIs.
- Adds new command creation helper methods with improved error handling in Cmd
- Introduces the "emit" API in the Lua binding and deprecates ya.app_emit() and ya.input_emit()
- Updates the Lua API composition to register the new "emit" function alongside legacy functions
Reviewed Changes
Copilot reviewed 3 out of 19 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| yazi-shared/src/event/cmd.rs | Adds new() and new_or() with refined error propagation |
| yazi-plugin/src/utils/utils.rs | Registers the new "emit" command for event dispatch |
| yazi-plugin/src/utils/call.rs | Implements the new "emit" function and deprecates older APIs |
Files not reviewed (16)
- yazi-plugin/preset/components/current.lua: Language not supported
- yazi-plugin/preset/components/parent.lua: Language not supported
- yazi-plugin/preset/components/preview.lua: Language not supported
- yazi-plugin/preset/plugins/archive.lua: Language not supported
- yazi-plugin/preset/plugins/code.lua: Language not supported
- yazi-plugin/preset/plugins/dds.lua: Language not supported
- yazi-plugin/preset/plugins/empty.lua: Language not supported
- yazi-plugin/preset/plugins/extract.lua: Language not supported
- yazi-plugin/preset/plugins/folder.lua: Language not supported
- yazi-plugin/preset/plugins/fzf.lua: Language not supported
- yazi-plugin/preset/plugins/json.lua: Language not supported
- yazi-plugin/preset/plugins/mime.lua: Language not supported
- yazi-plugin/preset/plugins/pdf.lua: Language not supported
- yazi-plugin/preset/plugins/session.lua: Language not supported
- yazi-plugin/preset/plugins/video.lua: Language not supported
- yazi-plugin/preset/plugins/zoxide.lua: Language not supported
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a new
ya.emit()API to address:ya.mgr_emit()API can only emit events to[manager].ya.app_emit()andya.input_emit()can be used to emit events to[app]and[input], but they are private and undocumented APIs.[tasks],[spot],[pick],[confirm],[cmp], or[help].The first parameter of
ya.emit()is the event ID in the formatcomponent:event, where thecomponent:part is optional and defaults to[manager], for example:The second parameter is the parameters for the event.
Deprecated
ya.mgr_emit()is deprecatedya.emit()can be used as a direct replacement forya.mgr_emit():Since
ya.mgr_emit()is a public and widely used API, it will remain available for a long time and will later include a deprecation warning before eventually being removed.ya.app_emit()andya.input_emit()are deprecatedya.app_emit()andya.input_emit()are private and undocumented APIs. However, since they have been around for a long time, this PR marks them as deprecated and they will be removed in the future.