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

Hover moves the cursor on itself #161

Closed
Shatur opened this issue Apr 20, 2021 · 6 comments
Closed

Hover moves the cursor on itself #161

Shatur opened this issue Apr 20, 2021 · 6 comments

Comments

@Shatur
Copy link
Contributor

Shatur commented Apr 20, 2021

When I use lua require("dap.ui.variables").hover() my cursor moves inside the popup. Also, when I exit it, it does not disappear as it usually does with hover windows from LSP.

@mfussenegger
Copy link
Owner

This is kinda by design so that you can expand nested variables. To close the window you can use CTRL-W_q

@theHamsta
Copy link
Contributor

theHamsta commented Apr 20, 2021

The native LSP float is now also enterable (the bug preventing that seemed to be fixed). So vim.lsp.util.open_floating_preview() could also replace or optionally replace popup (except that buf and win are swapped). I actually learned to like the new behavior with auto-entering.

@Shatur
Copy link
Contributor Author

Shatur commented Apr 20, 2021

Got it!
But how can I close or replace the window with another?

@theHamsta
Copy link
Contributor

theHamsta commented Apr 20, 2021

You could add an additional parameter to hover that creates the window and would use it when it's defined instead of popup https://github.com/theHamsta/nvim-dap/blob/724ea5aaa05dd7927d2745b7cf35a9f557e75c5c/lua/dap/ui/variables.lua#L275 . Additionally you would have to https://github.com/theHamsta/nvim-dap/blob/724ea5aaa05dd7927d2745b7cf35a9f557e75c5c/lua/dap/ui/variables.lua#L192-L213 to a separate function and apply it to the generated buffer. Or you let popup accept a window/buffer creation function.

You could also have a look what kind of option you can set with this line: https://github.com/theHamsta/nvim-dap/blob/724ea5aaa05dd7927d2745b7cf35a9f557e75c5c/lua/dap/ui/variables.lua#L192-L213

@mfussenegger
Copy link
Owner

@Shatur Did you have a look if the widget API covers your needs?

@Shatur
Copy link
Contributor Author

Shatur commented Jul 4, 2021

@mfussenegger, hm... yes, I think this solves my issue.

@Shatur Shatur closed this as completed Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants