-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Close popups automatically #1285
Close popups automatically #1285
Conversation
Sorry for the delay here, I'm not sure on whether we want to enable this for all popups. it makes sense for documentation popups, but we want to keep popups with menus or popups with diagnostics info open for a while |
Hey, In most situations, I find myself just needing a quick peek at the diagnostics message and would prefer to just manually reopen them if I needed. I could see it being useful in some cases, but it could also be confusing if diagnostics stay open even after not being valid anymore. Especially if the latest code edit triggered a new, different, diagnostic at exactly the same location as an older diagnostic popup that has been left open. Could add an additional property Thoughts? |
That was just an example, we will be using popups to display various debug info once the debug adapter support gets merged.
That seems reasonable, I'd add it as a builder method on helix/helix-term/src/ui/popup.rs Lines 44 to 47 in 23553bd
|
428dabd
to
eb34c97
Compare
…ups-automatically # Conflicts: # helix-term/src/commands.rs # helix-term/src/ui/editor.rs # helix-term/src/ui/popup.rs
@archseer added the Could you re-review it? |
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.
Looks fine to me, thanks for your patience! 🎉
supersedes helix-editor#1622 Builds on the work in helix-editor#1285. I want to allow Enter to create a newline when there is no selection in the autocomplete menu. This occurs somewhat often when using LSP autocomplete in Elixir which uses `do/end` blocks (and I set the autocomplete menu delay to 0 which exacerbates the problem): ```elixir defmodule MyModule do def do_foo(x) do x end def other_function(y) do| end ``` Here the cursor is `|` in insert mode. The LSP suggests `do_foo` but I want to create a newline. Hitting Enter currently closes the menu, so I end up having to hit Enter twice when the module contains any local with a `do` prefix, which can be inconsistent. With this change, we ignore the Enter keypress to end up creating the newline in this case.
* ignore Enter keypress when menu has no selection supersedes #1622 Builds on the work in #1285. I want to allow Enter to create a newline when there is no selection in the autocomplete menu. This occurs somewhat often when using LSP autocomplete in Elixir which uses `do/end` blocks (and I set the autocomplete menu delay to 0 which exacerbates the problem): ```elixir defmodule MyModule do def do_foo(x) do x end def other_function(y) do| end ``` Here the cursor is `|` in insert mode. The LSP suggests `do_foo` but I want to create a newline. Hitting Enter currently closes the menu, so I end up having to hit Enter twice when the module contains any local with a `do` prefix, which can be inconsistent. With this change, we ignore the Enter keypress to end up creating the newline in this case. * pop compositor layer when ignoring Enter keypress * move closing function out of consumed event result closure * explicitly label close_fn as an 'Option<Callback>'
This PR adds two things:
EventResult::Ignored(Option<Callback>)
, to allow processing event result callbacks without consuming themauto_close
property onPopup
, it closes the popup if an event happens that is ignored by its contentsfixes #326