lsp: replace the event that closes the signature help preview window from InsertCharPre to CursolMovedI (#11954)

In the case of InsertCharPre, it is inconvenient because the signature help is displayed
when backspaced in insert mode, so change it to CursolMovedI.
This commit is contained in:
Hirokazu Hata
2020-04-19 02:04:47 +09:00
committed by GitHub
parent 7d4451c657
commit c5466ba6ef

View File

@@ -522,8 +522,7 @@ function M.open_floating_preview(contents, filetype, opts)
end
api.nvim_buf_set_lines(floating_bufnr, 0, -1, true, contents)
api.nvim_buf_set_option(floating_bufnr, 'modifiable', false)
-- TODO make InsertCharPre disappearing optional?
api.nvim_command("autocmd CursorMoved,BufHidden,InsertCharPre <buffer> ++once lua pcall(vim.api.nvim_win_close, "..floating_winnr..", true)")
M.close_preview_autocmd({"CursorMoved", "CursorMovedI", "BufHidden"}, floating_winnr)
return floating_bufnr, floating_winnr
end