-
-
Notifications
You must be signed in to change notification settings - Fork 175
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: add Terminal.find
function
#486
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if only a well defined subset of the terminal's fields be passed ot the predicate so people can't do undesirable things or use private fields or trigger side effects here that they shouldn't 🤔. I'm sure some some people are already doing stuff like this but I worry about users getting used to operating on the whole terminal in a way that a lot of people become dependent on private fields.
The cat might already be out of the bag on that one though since lua doesn't really support privacy for fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm definitely doing a lot of janky things in my config taking advantage of Lua's lack of privacy haha (haven't needed to do so with toggleterm, though). I'm not really sure about this specific case - the idea makes sense, but the function will return a full Terminal object that will be exposed either way, so that would really only avoid mutation in the predicate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to expose one or two functions for filtering terminals by bufnr or name, etc. and avoid using a higher order function entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I guess it's always been the case that users can interact with the terminal directly and I have advised in the README not to use the private methods but I'm sure some users will anyway 🤦🏾♂️, I guess more specific functions will just lead to future requests for more variants so probably one function that is super generic is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, that makes sense. Let me know if there are any changes you'd like!
I think with Lua it's almost impossible to make something private, even locals can be retrieved with
debug.getupvalue
, so I'm not sure it's worth spending much energy on haha