From 31d6f72abf5c025374a60675e7db8d8c97c9f775 Mon Sep 17 00:00:00 2001 From: Ildar Akhmetgaleev Date: Sat, 12 Oct 2019 16:45:12 +0700 Subject: [PATCH] Add option to show hover messages in preview. Add new option 'ale_hover_to_preview' to show hover messages in preview window. --- autoload/ale/hover.vim | 10 ++++++++++ plugin/ale.vim | 3 +++ 2 files changed, 13 insertions(+) diff --git a/autoload/ale/hover.vim b/autoload/ale/hover.vim index 2af35aa4..8fdd288c 100644 --- a/autoload/ale/hover.vim +++ b/autoload/ale/hover.vim @@ -42,6 +42,11 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort \&& exists('*balloon_show') \&& ale#Var(l:options.buffer, 'set_balloons') call balloon_show(a:response.body.displayString) + elseif g:ale_hover_to_preview + call ale#preview#Show(split(a:response.body.displayString, "\n"), { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \}) else call ale#util#ShowMessage(a:response.body.displayString) endif @@ -98,6 +103,11 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort \&& exists('*balloon_show') \&& ale#Var(l:options.buffer, 'set_balloons') call balloon_show(l:str) + elseif g:ale_hover_to_preview + call ale#preview#Show(split(l:str, "\n"), { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \}) else call ale#util#ShowMessage(l:str) endif diff --git a/plugin/ale.vim b/plugin/ale.vim index 1912a9c0..8fea3bb4 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -125,6 +125,9 @@ let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0) " This flag can be set to 0 to disable balloon support. let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has('gui_running')) +" Use preview window for hover messages. +let g:ale_hover_to_preview = get(g:, 'ale_hover_to_preview', 0) + " This flag can be set to 0 to disable warnings for trailing whitespace let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1) " This flag can be set to 0 to disable warnings for trailing blank lines