mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-16 23:14:27 +08:00
Vim popup (#3817)
* implement vim popups for preview
Details on implementation
-------------------------
- we make use of the |popupwin| api
- we split implementations (Nvim* vs. Vim* prefix) and call the right
one based on has('nvim')
- we follow a similar structure in each function, using the relevant API
- popup_list, win_execute, popup_settext in VimShow
- popup_create in VimCreate
- popup_close in VimClose
Some differences
----------------
- we DON'T have VimPrepareWindowContent because we use arguments to
popup_create for borders, padding, etc., and it also takes care of
buffer creation.
- we follow the protocol of setting and using w:preview for information,
but we only need the ID
- InsertEnter is the only autocommand required, because of
popup_create's moved argument. Any cursor movement with 'any' will
close the popup. This in turns means VimClose is only called from
InsertMode, so no mode-restoration necessary
- we don't tweak too much in the buffer because vim's popup buffers
already have most relevant settings and aren't editable without
calling popup functions.
- I enabled scrollbars, close buttons, dragging, and resizing
- vim popups get as big as they need to by default, so no worrying about
truncating/hiding/size
Note: we might want to consider changing w:preview to w:ale_preview to
avoid clashes if someone else tries to use the same variable
* floating window: document that vim supports it
* lint: fix indent/cont. lines
This commit is contained in:
16
doc/ale.txt
16
doc/ale.txt
@@ -651,9 +651,9 @@ problem will be displayed in a balloon instead of hover information.
|
||||
Hover information can be displayed in the preview window instead by setting
|
||||
|g:ale_hover_to_preview| to `1`.
|
||||
|
||||
When using Neovim, if |g:ale_hover_to_floating_preview| or |g:ale_floating_preview|
|
||||
is set to 1, the hover information will show in a floating window. And
|
||||
|g:ale_floating_window_border| for the border setting.
|
||||
When using Neovim or Vim with |popupwin|, if |g:ale_hover_to_floating_preview|
|
||||
or |g:ale_floating_preview| is set to 1, the hover information will show in a
|
||||
floating window. And |g:ale_floating_window_border| for the border setting.
|
||||
|
||||
For Vim 8.1+ terminals, mouse hovering is disabled by default. Enabling
|
||||
|balloonexpr| commands in terminals can cause scrolling issues in terminals,
|
||||
@@ -968,8 +968,8 @@ g:ale_detail_to_floating_preview *g:ale_detail_to_floating_preview*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
When this option is set to `1`, Neovim will use a floating window for
|
||||
ALEDetail output.
|
||||
When this option is set to `1`, Neovim or Vim with |popupwin| will use a
|
||||
floating window for ALEDetail output.
|
||||
|
||||
|
||||
g:ale_disable_lsp *g:ale_disable_lsp*
|
||||
@@ -1200,7 +1200,8 @@ g:ale_floating_preview *g:ale_floating_preview*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
When set to `1`, Neovim will use a floating window for ale's preview window.
|
||||
When set to `1`, Neovim or Vim with |popupwin| will use a floating window
|
||||
for ale's preview window.
|
||||
This is equivalent to setting |g:ale_hover_to_floating_preview| and
|
||||
|g:ale_detail_to_floating_preview| to `1`.
|
||||
|
||||
@@ -1281,7 +1282,8 @@ g:ale_hover_to_floating_preview *g:ale_hover_to_floating_preview*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
If set to `1`, Neovim will use floating windows for hover messages.
|
||||
If set to `1`, Neovim or Vim with |popupwin| will use floating windows for
|
||||
hover messages.
|
||||
|
||||
|
||||
g:ale_keep_list_window_open *g:ale_keep_list_window_open*
|
||||
|
||||
Reference in New Issue
Block a user