-
-
Notifications
You must be signed in to change notification settings - Fork 288
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
fix(popup)!: moved="any"
, enter
default, callback=fn
#622
Open
errael
wants to merge
1
commit into
nvim-lua:master
Choose a base branch
from
errael:PopupFix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
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
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
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
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 think what this does if I'm not mistaken @tjdevries @Conni2461 it's that checks for
vim_options.finalize_callback
to be (it could be null) and if does exists calls it, maybe there's a part of the code where it removes it or it's set to false, will look into that.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.
The question is about why it exists at all. It was added with #513.
@xactlyblue Could you clarify the purpose of #513? It doesn't seem to have anything to do with popups.
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 why it exists, that idk, if @xactlyblue could clarify on that regard, would be nice. I tried to find where it was being used or defined and this is what I got.
I added this to log when it's called or not:
Results from
make test
:Video demo when using
Telescope
which creates apopup
:finalize_callback-demo.mp4
Note
As you can see it adds the
not called
log twice because I thinkTelescope
calls it twice for each one it creates. I usedTelescope
3 times, and got 6not called
logs.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.
Tried both in this PR and in master btw, in case it was related to something this PR was removing.
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.
Hey.
I made that change a while ago to address a problem I was having where I needed to access some information about the buffer created for the popup (I forgot the details to be honest, but if you need them I could probably go through my dotfiles commit history to figure out what my specific use-case was at the time).
It just creates an easier way for the user to manually access the
bufnr
andwin_id
of the popup for whatever reason they might need it. There isn't any internal implementation or usage of it.I probably should've added a comment explaining the changes to clear the purpose up, sorry for any confusion!
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.
Thanks, no problem. Debug convenience. Do you agree there's no reason to keep it in a final product?
Consider
nvim_win_get_buf(win_id)
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.
Sorry, I should have clarified: this change was meant to be accessible by the user (for whatever reason they may need to access the
bufnr
andwin_id
of a created popup).I'm not really familiar with the inner-workings of plenary or it's API, so I apologize if this change was unnecessary, but I couldn't find any existing method to easily access the bufnr of a created popup via a callback, so I figured the simplest solution would be to add an optional callback to allow the user to access the
bufnr
andwin_id
as soon as they're available.If I recall correctly my use-case had something to do with zindex/overlap issues in a plugin that allowed you to supply popup arguments to plenary, which is why I made it a callback (I guess I figured it was more useful/elegant to add a general callback for plenary instead of modifying the plugin itself) the user can supply.
I looked through my NeoVim configuration and I'm not currently using it so I personally don't mind if it's removed but I'm not sure if anyone else is making use of it in their own configurations (though I'd guess the odds of that are fairly slim considering it's not really documented anywhere and has fairly specific use-cases).
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 understood (I think). I didn't see a reason for it, other than convenience.
I'm new to
neovim
, I don't know what was available when. Currentlynvim_win_get_buf(win_id)
orwinbufnr()
gets the buffer number from a window. May be other ways.I'm not asking you to remove it, just wanted to make sure there wasn't something I missed.