|
31 | 31 | ---
|
32 | 32 | --- - Automatic display in floating window of completion item info (via
|
33 | 33 | --- 'completionItem/resolve' request) and signature help (with highlighting
|
34 |
| ---- of active parameter if LSP server provides such information). After opening, |
35 |
| ---- window for signature help is fixed and is closed when there is nothing to |
36 |
| ---- show, text is different or when leaving Insert mode. |
37 |
| ---- Scroll in either info/signature window (`<C-f>` / `<C-b>` by default). |
| 34 | +--- of active parameter if LSP server provides such information). |
| 35 | +--- Signature help is shown if character to cursor's left is a dedicated trigger |
| 36 | +--- character (configured in `signatureHelpProvider.triggerCharacters` of LSP |
| 37 | +--- server capabilities) and updated immediately if is currently opened. |
| 38 | +--- Already shown window for signature help is fixed and is closed when there |
| 39 | +--- is nothing to show, its text is different, or when leaving Insert mode. |
| 40 | +--- Scroll in either info/signature window with `<C-f>` / `<C-b>` (by default). |
38 | 41 | ---
|
39 | 42 | --- - Automatic actions are done after some configurable amount of delay. This
|
40 | 43 | --- reduces computational load and allows fast typing (completion and
|
|
225 | 228 | -- - On `CursorMovedI` start auto signature (if there is any active LSP
|
226 | 229 | -- client) with similar to completion timer pattern. Better event might
|
227 | 230 | -- be `InsertCharPre` but there are issues with 'autopair-type' plugins.
|
228 |
| --- - Check if character left to cursor is appropriate (')' or LSP's |
229 |
| --- signature help trigger characters). If not, do nothing. |
| 231 | +-- Update immediately if already shown or after delay if character to the |
| 232 | +-- left is signature help trigger (after delay has passed). |
230 | 233 | -- - If timer is activated, send 'textDocument/signatureHelp' request to
|
231 | 234 | -- all LSP clients. On callback, process their results. Window is opened
|
232 | 235 | -- if not already with the same text (its characteristics are computed
|
@@ -787,11 +790,12 @@ H.auto_signature = function()
|
787 | 790 | H.signature.timer:stop()
|
788 | 791 | if not H.has_lsp_clients('signatureHelpProvider') then return end
|
789 | 792 |
|
790 |
| - local left_char = H.get_left_char() |
791 |
| - local char_is_trigger = left_char == ')' or H.is_lsp_trigger(left_char, 'signature') |
792 |
| - if not char_is_trigger then return end |
| 793 | + local is_shown = H.is_valid_win(H.signature.win_id) |
| 794 | + local left_char_is_trigger = H.is_lsp_trigger(H.get_left_char(), 'signature') |
| 795 | + if not (is_shown or left_char_is_trigger) then return end |
793 | 796 |
|
794 |
| - H.signature.timer:start(H.get_config().delay.signature, 0, vim.schedule_wrap(H.show_signature_window)) |
| 797 | + local delay = is_shown and 0 or H.get_config().delay.signature |
| 798 | + H.signature.timer:start(delay, 0, vim.schedule_wrap(H.show_signature_window)) |
795 | 799 | end
|
796 | 800 |
|
797 | 801 | H.on_completedonepre = function()
|
|
0 commit comments