summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-29 17:03:29 +0000
committerw0rp <devw0rp@gmail.com>2017-10-29 17:03:29 +0000
commitdaecbad543c68de1c0a2d8c368e4edde2f90461e (patch)
tree07ef88ce52d7bc006f8f006add1468c18eea0ce5 /autoload
parent1aa737cdc9b6e92b51823df93f356b4ec37beab3 (diff)
downloadale-daecbad543c68de1c0a2d8c368e4edde2f90461e.zip
Fix #719 - Add ALEReset and ALEResetBuffer for removing problems for all buffers or one buffer
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/toggle.vim40
1 files changed, 26 insertions, 14 deletions
diff --git a/autoload/ale/toggle.vim b/autoload/ale/toggle.vim
index 8e54dc21..e8cb83a5 100644
--- a/autoload/ale/toggle.vim
+++ b/autoload/ale/toggle.vim
@@ -110,25 +110,28 @@ function! s:DisablePostamble() abort
endif
endfunction
+function! s:CleanupEveryBuffer() abort
+ for l:key in keys(g:ale_buffer_info)
+ " The key could be a filename or a buffer number, so try and
+ " convert it to a number. We need a number for the other
+ " functions.
+ let l:buffer = str2nr(l:key)
+
+ if l:buffer > 0
+ " Stop all jobs and clear the results for everything, and delete
+ " all of the data we stored for the buffer.
+ call ale#engine#Cleanup(l:buffer)
+ endif
+ endfor
+endfunction
+
function! ale#toggle#Toggle() abort
let g:ale_enabled = !get(g:, 'ale_enabled')
if g:ale_enabled
call s:EnablePreamble()
else
- for l:key in keys(g:ale_buffer_info)
- " The key could be a filename or a buffer number, so try and
- " convert it to a number. We need a number for the other
- " functions.
- let l:buffer = str2nr(l:key)
-
- if l:buffer > 0
- " Stop all jobs and clear the results for everything, and delete
- " all of the data we stored for the buffer.
- call ale#engine#Cleanup(l:buffer)
- endif
- endfor
-
+ call s:CleanupEveryBuffer()
call s:DisablePostamble()
endif
@@ -152,6 +155,11 @@ function! ale#toggle#Disable() abort
endif
endfunction
+function! ale#toggle#Reset() abort
+ call s:CleanupEveryBuffer()
+ call ale#highlight#UpdateHighlights()
+endfunction
+
function! ale#toggle#ToggleBuffer(buffer) abort
" Get the new value for the toggle.
let l:enabled = !getbufvar(a:buffer, 'ale_enabled', 1)
@@ -171,7 +179,6 @@ function! ale#toggle#ToggleBuffer(buffer) abort
" Stop all jobs and clear the results for everything, and delete
" all of the data we stored for the buffer.
call ale#engine#Cleanup(a:buffer)
-
call s:DisablePostamble()
endif
endfunction
@@ -188,3 +195,8 @@ function! ale#toggle#DisableBuffer(buffer) abort
call ale#toggle#ToggleBuffer(a:buffer)
endif
endfunction
+
+function! ale#toggle#ResetBuffer(buffer) abort
+ call ale#engine#Cleanup(a:buffer)
+ call ale#highlight#UpdateHighlights()
+endfunction