summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-03-25 12:57:08 +0100
committerw0rp <devw0rp@gmail.com>2018-03-25 12:57:08 +0100
commit164c711b3da5a51a2323a3bd613df251ce455ca5 (patch)
tree25796d3a5776c4789def6ee00b68fca95a8db2e4 /autoload
parent107516c757df82d2ee84426de9b35fd52e953c5c (diff)
downloadale-164c711b3da5a51a2323a3bd613df251ce455ca5.zip
Fix #1404 - Do not show balloons when g:ale_set_balloons is 0. Add b:ale_set_balloonsv1.8.0
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/balloon.vim9
-rw-r--r--autoload/ale/toggle.vim16
2 files changed, 16 insertions, 9 deletions
diff --git a/autoload/ale/balloon.vim b/autoload/ale/balloon.vim
index 41fa95fa..552ced82 100644
--- a/autoload/ale/balloon.vim
+++ b/autoload/ale/balloon.vim
@@ -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
diff --git a/autoload/ale/toggle.vim b/autoload/ale/toggle.vim
index e9cc29b6..2fa98b4a 100644
--- a/autoload/ale/toggle.vim
+++ b/autoload/ale/toggle.vim
@@ -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()