feat: floating input (#721)

* feat: add floating input to ask method

Open a floating input similar to the "edit" input for the "ask" input.
Enabled in config via `Config.windows.ask.floating` or by passing
`{ floating = true }` to the `api.ask` method.

Includes logic to ensure the sidebar uses the correct buffer and selection
if an existing sidebar is open for another code buffer.

Also refactored the `selection` module to extract the floating input
logic into a new `PromptInput` class.

* docs: update config options

* feat: more accurate annotations to prevent user misunderstandings

---------

Co-authored-by: yetone <yetoneful@gmail.com>
This commit is contained in:
Maddison Hellstrom
2024-10-14 20:22:34 -07:00
committed by GitHub
parent b19573cb2a
commit 964715be64
7 changed files with 443 additions and 286 deletions

View File

@@ -262,6 +262,18 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
align = "center", -- left, center, right for title
rounded = true,
},
input = {
prefix = "> ",
},
edit = {
border = "rounded",
start_insert = true, -- Start insert mode when opening the edit window
},
ask = {
floating = false, -- Open the 'AvanteAsk' prompt in a floating window
start_insert = true, -- Start insert mode when opening the ask window, only effective if floating = true.
border = "rounded",
},
},
highlights = {
---@type AvanteConflictHighlights