dressing.nvim icon indicating copy to clipboard operation
dressing.nvim copied to clipboard

Open menu before loading buffer

Open ChristianChiarulli opened this issue 2 years ago • 1 comments

I am using a language server that I need to make a selection for before starting the server. Currently I can use the default way to select my option first and then the buffer loads. When using this plugin the buffer is not blocked from loading and I am unable to make the selection before the language server starts.

Is there anyway to expose an option to have the menu block loading a buffer until after the selection is made?

buffer is not loaded yet, there is time to make selection image

buffer already loaded, too late to make selection image

ChristianChiarulli avatar Mar 31 '22 04:03 ChristianChiarulli

Unfortunately, there's no way to block it in the same way that inputlist() would. When vim uses those built-in input commands, the whole editor more-or-less is paused while that resolves. Even if there were an API to do a similar pause, that would also block the rendering of the selection float.

That said, there are some other possibilities.

  • You could conditionally disable the vim.ui.select patch and use the built-in inputlist() function for this particular case. See #29 for more info.
  • Total hack, but you could play around with doing an immediate bufwipe or bufclose, popping up the prompt, then reloading the buffer (with a flag to prevent an infinite loop).
  • If this is for LSP, you have the option to take more control over when the client attaches. You could pass autostart = false to your configuration and run :LspStart once the selection completes.

stevearc avatar Mar 31 '22 15:03 stevearc