Fix #1404 - Do not show balloons when g:ale_set_balloons is 0. Add b:ale_set_balloons

This commit is contained in:
w0rp
2018-03-25 12:57:08 +01:00
parent 107516c757
commit 164c711b3d
5 changed files with 107 additions and 17 deletions

View File

@@ -2,6 +2,13 @@
" Description: balloonexpr support for ALE.
function! ale#balloon#MessageForPos(bufnr, lnum, col) abort
" Don't show balloons if they are disabled, or linting is disabled.
if !ale#Var(a:bufnr, 'set_balloons')
\|| !g:ale_enabled
\|| !getbufvar(a:bufnr, 'ale_enabled', 1)
return ''
endif
let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist
let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col)
@@ -13,7 +20,7 @@ function! ale#balloon#Expr() abort
endfunction
function! ale#balloon#Disable() abort
set noballooneval
set noballooneval balloonexpr=
endfunction
function! ale#balloon#Enable() abort

View File

@@ -84,10 +84,6 @@ function! s:EnablePreamble() abort
" Lint immediately, including running linters against the file.
call ale#Queue(0, 'lint_file')
if g:ale_set_balloons
call ale#balloon#Enable()
endif
endfunction
function! s:DisablePostamble() abort
@@ -95,10 +91,6 @@ function! s:DisablePostamble() abort
if g:ale_set_highlights
call ale#highlight#UpdateHighlights()
endif
if g:ale_set_balloons
call ale#balloon#Disable()
endif
endfunction
function! s:CleanupEveryBuffer() abort
@@ -121,9 +113,17 @@ function! ale#toggle#Toggle() abort
if g:ale_enabled
call s:EnablePreamble()
if g:ale_set_balloons
call ale#balloon#Enable()
endif
else
call s:CleanupEveryBuffer()
call s:DisablePostamble()
if has('balloon_eval')
call ale#balloon#Disable()
endif
endif
call ale#toggle#InitAuGroups()