summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-08-28 09:52:36 +0100
committerw0rp <devw0rp@gmail.com>2020-08-28 09:54:43 +0100
commitb8c0ac2e6126d2245f4281c286387b4dd1847178 (patch)
tree68c64e378182472622f41fd24f3083b4b7ed353b
parent68741204059d56ffcb4229ec433edf5f9fc4e8c7 (diff)
downloadale-b8c0ac2e6126d2245f4281c286387b4dd1847178.zip
Close #3309 - Add b:ale_lint_delay
-rw-r--r--autoload/ale/events.vim6
-rw-r--r--doc/ale.txt5
-rw-r--r--test/test_autocmd_commands.vader16
3 files changed, 15 insertions, 12 deletions
diff --git a/autoload/ale/events.vim b/autoload/ale/events.vim
index 731e36f2..3568c117 100644
--- a/autoload/ale/events.vim
+++ b/autoload/ale/events.vim
@@ -105,11 +105,11 @@ function! ale#events#Init() abort
if g:ale_enabled
if l:text_changed is? 'always' || l:text_changed is# '1'
- autocmd TextChanged,TextChangedI * call ale#Queue(g:ale_lint_delay)
+ autocmd TextChanged,TextChangedI * call ale#Queue(ale#Var(str2nr(expand('<abuf>')), 'lint_delay'))
elseif l:text_changed is? 'normal'
- autocmd TextChanged * call ale#Queue(g:ale_lint_delay)
+ autocmd TextChanged * call ale#Queue(ale#Var(str2nr(expand('<abuf>')), 'lint_delay'))
elseif l:text_changed is? 'insert'
- autocmd TextChangedI * call ale#Queue(g:ale_lint_delay)
+ autocmd TextChangedI * call ale#Queue(ale#Var(str2nr(expand('<abuf>')), 'lint_delay'))
endif
if g:ale_lint_on_enter
diff --git a/doc/ale.txt b/doc/ale.txt
index f2f77a83..14d2abbe 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -1172,7 +1172,7 @@ g:ale_list_window_size *g:ale_list_window_size*
g:ale_lint_delay *g:ale_lint_delay*
-
+ *b:ale_lint_delay*
Type: |Number|
Default: `200`
@@ -1180,6 +1180,9 @@ g:ale_lint_delay *g:ale_lint_delay*
be run after text is changed. This option is only meaningful with the
|g:ale_lint_on_text_changed| variable set to `always`, `insert`, or `normal`.
+ A buffer-local option, `b:ale_lint_delay`, can be set to change the delay
+ for different buffers, such as in |ftplugin| files.
+
g:ale_lint_on_enter *g:ale_lint_on_enter*
diff --git a/test/test_autocmd_commands.vader b/test/test_autocmd_commands.vader
index a69333d4..2f0a893f 100644
--- a/test/test_autocmd_commands.vader
+++ b/test/test_autocmd_commands.vader
@@ -92,8 +92,8 @@ Execute (All events should be set up when everything is on):
\ 'FileType * call ale#events#FileTypeEvent( str2nr(expand(''<abuf>'')), expand(''<amatch>''))',
\ 'InsertLeave * if ale#Var(str2nr(expand(''<abuf>'')), ''lint_on_insert_leave'') | call ale#Queue(0) | endif',
\ 'InsertLeave if exists(''*ale#engine#Cleanup'') | call ale#cursor#EchoCursorWarning() | endif',
- \ 'TextChanged * call ale#Queue(g:ale_lint_delay)',
- \ 'TextChangedI * call ale#Queue(g:ale_lint_delay)',
+ \ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
+ \ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
\ ],
\ CheckAutocmd('ALEEvents')
@@ -145,8 +145,8 @@ Execute (g:ale_lint_on_text_changed = 1 bind both events):
AssertEqual
\ [
- \ 'TextChanged * call ale#Queue(g:ale_lint_delay)',
- \ 'TextChangedI * call ale#Queue(g:ale_lint_delay)',
+ \ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
+ \ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
\ ],
\ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''')
@@ -155,8 +155,8 @@ Execute (g:ale_lint_on_text_changed = 'always' should bind both events):
AssertEqual
\ [
- \ 'TextChanged * call ale#Queue(g:ale_lint_delay)',
- \ 'TextChangedI * call ale#Queue(g:ale_lint_delay)',
+ \ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
+ \ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
\ ],
\ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''')
@@ -165,7 +165,7 @@ Execute (g:ale_lint_on_text_changed = 'normal' should bind only TextChanged):
AssertEqual
\ [
- \ 'TextChanged * call ale#Queue(g:ale_lint_delay)',
+ \ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
\ ],
\ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''')
@@ -174,7 +174,7 @@ Execute (g:ale_lint_on_text_changed = 'insert' should bind only TextChangedI):
AssertEqual
\ [
- \ 'TextChangedI * call ale#Queue(g:ale_lint_delay)',
+ \ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
\ ],
\ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''')