Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support popup windows for ALEHover and ALEDetail #2922

@dotdash

Description

@dotdash

Using the popup feature you can get a balloon like experience without having to use the mouse.

A proof of concept patch is below, but I'm not experienced enough in either vimscript or ale's code specifically to provide a fully fleshed out PR.

diff --git autoload/ale/cursor.vim autoload/ale/cursor.vim
index 8c331c5..edb99e2 100644
--- autoload/ale/cursor.vim
+++ autoload/ale/cursor.vim
@@ -136,8 +136,7 @@ function! s:ShowCursorDetailForItem(loc, options) abort
 
     let s:last_detailed_line = line('.')
     let l:message = get(a:loc, 'detail', a:loc.text)
-    let l:lines = split(l:message, "\n")
-    call ale#preview#Show(l:lines, {'stay_here': l:stay_here})
+    call ale#util#ShowMessage(l:message)
 
     " Clear the echo message if we manually displayed details.
     if !l:stay_here
diff --git autoload/ale/util.vim autoload/ale/util.vim
index 99cd856..cf46136 100644
--- autoload/ale/util.vim
+++ autoload/ale/util.vim
@@ -21,15 +21,7 @@ function! ale#util#ShowMessage(string) abort
         call ale#preview#CloseIfTypeMatches('ale-preview.message')
     endif
 
-    " We have to assume the user is using a monospace font.
-    if has('nvim') || (a:string !~? "\n" && len(a:string) < &columns)
-        execute 'echo a:string'
-    else
-        call ale#preview#Show(split(a:string, "\n"), {
-        \   'filetype': 'ale-preview.message',
-        \   'stay_here': 1,
-        \})
-    endif
+    call popup_atcursor(split(a:string, "\n"), {'border':[], 'moved': 'any'})
 endfunction
 
 " A wrapper function for execute, so we can test executing some commands.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions