diff options
author | w0rp <devw0rp@gmail.com> | 2019-05-11 17:19:45 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-05-11 17:19:45 +0100 |
commit | df90725c858103f1c63eb1c96f3e4e4727c32a7d (patch) | |
tree | 4db5ee24517d24f19ab8a7b199e39e298875692b | |
parent | edd31143946aa396a0021174b0dfb6927b630856 (diff) | |
download | ale-df90725c858103f1c63eb1c96f3e4e4727c32a7d.zip |
Support b:ale_completion_enabled for disabling it for some buffers
-rw-r--r-- | autoload/ale/completion.vim | 4 | ||||
-rw-r--r-- | doc/ale.txt | 5 | ||||
-rw-r--r-- | test/completion/test_completion_events.vader | 10 |
3 files changed, 17 insertions, 2 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim index e775347b..456fe68a 100644 --- a/autoload/ale/completion.vim +++ b/autoload/ale/completion.vim @@ -584,7 +584,7 @@ function! ale#completion#GetCompletions(source) abort endfunction function! s:TimerHandler(...) abort - if !g:ale_completion_enabled + if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif @@ -609,7 +609,7 @@ function! ale#completion#StopTimer() abort endfunction function! ale#completion#Queue() abort - if !g:ale_completion_enabled + if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif diff --git a/doc/ale.txt b/doc/ale.txt index 2c18d6a1..2a086981 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -560,6 +560,7 @@ g:ale_completion_delay *g:ale_completion_delay* g:ale_completion_enabled *g:ale_completion_enabled* +b:ale_completion_enabled *b:ale_completion_enabled* Type: |Number| Default: `0` @@ -572,6 +573,10 @@ g:ale_completion_enabled *g:ale_completion_enabled* This setting should not be enabled if you wish to use ALE as a completion source for other completion plugins. + A buffer-local version of this setting `b:ale_completion_enabled` can be set + to `0` to disable ALE's automatic completion support for a single buffer. + ALE's completion support must be enabled globally to be enabled locally. + See |ale-completion| diff --git a/test/completion/test_completion_events.vader b/test/completion/test_completion_events.vader index f79773cc..cdd3fea4 100644 --- a/test/completion/test_completion_events.vader +++ b/test/completion/test_completion_events.vader @@ -5,6 +5,7 @@ Before: Save &l:omnifunc Save &l:completeopt + unlet! b:ale_completion_enabled let g:ale_completion_enabled = 1 let g:get_completions_called = 0 let g:feedkeys_calls = [] @@ -49,6 +50,7 @@ Before: After: Restore + unlet! b:ale_completion_enabled unlet! g:output unlet! g:fake_mode unlet! g:get_completions_called @@ -78,6 +80,14 @@ After: Execute(ale#completion#GetCompletions should be called when the cursor position stays the same): call CheckCompletionCalled(1) +Execute(ale#completion#GetCompletions should not be called if the global setting is disabled): + let g:ale_completion_enabled = 0 + call CheckCompletionCalled(0) + +Execute(ale#completion#GetCompletions should not be called if the buffer setting is disabled): + let b:ale_completion_enabled = 0 + call CheckCompletionCalled(0) + Given typescript(): let abc = y. let foo = ab |