Closed Jeansidharta closed 1 year ago
Hi @Jeansidharta! Thanks for a clear issue :)
It would make sense to add another entry to the opts
passed to the custom action which indicates if it's a yank or macro. One could add the typ
variable to the get_custom_action_handler
and include that in the opts
.
Would you like to do that in a PR?
Great! I'll make a PR in a moment. Thank you :)
Hello!
While trying to extend a bit of the telescope functionality for my own use, I've had some difficulty differentiating between an entry created by a yanked text, and an entry created by a macro recording. I want to do something like this:
After reading a bit of the source code, the only way I found to achieve what I'm looking for is to check if
opts.entry.filetype
isnil
. Something likelocal is_listing_macros = opts.entry.filetype == nil
. While this works, I feel like it could be better, or at least better documented. So I'd like to know if I missed something, or if we could improve this API, or it's documentation.My suggestion would be to either pass a second argument to the custom action, after the
opts
, that's either"yank"
or"macro"
, or to separate custom action handlers for yank or macro in different parts of the setup. If no change to the API is desired, then the documentation could mention something about this in the "Custom actions" section. I'd be willing to create a pull request with the desired changes if needed.Love the project, and thank you for your time and effort!