aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorblobmasterbrian2026-02-06 11:47:52 -0700
committerGitHub2026-02-06 18:47:52 +0000
commite762262f4465f29493eef0ee491c49191c8f0125 (patch)
tree6ef186e7168da87c82781aa098872584403cfbf2
parent6d9962946172fda4f25f9f5773b601aa4b2bedaf (diff)
downloadale-e762262f4465f29493eef0ee491c49191c8f0125.tar.gz

add option to lint diff buffers (#3185)

  • add option to lint diff buffers
  • fix misaligned doc tag
  • update docs
-rw-r--r--autoload/ale.vim2
-rw-r--r--doc/ale.txt11
-rw-r--r--test/test_should_do_nothing_conditions.vader7
3 files changed, 19 insertions, 1 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim
index 2f46bce5c..78ab5c20c 100644
--- a/autoload/ale.vim
+++ b/autoload/ale.vim
@@ -48,7 +48,7 @@ function! ale#ShouldDoNothing(buffer) abort
endif
" Do nothing for diff buffers.
- if getbufvar(a:buffer, '&diff')
+ if getbufvar(a:buffer, '&diff') && !get(g:, 'ale_lint_diff', 0)
return 1
endif
diff --git a/doc/ale.txt b/doc/ale.txt
index a652aad4c..320048f79 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -1622,10 +1622,21 @@ g:ale_lint_delay
A buffer-local option, `b:ale_lint_delay`, can be set to change the delay
for different buffers, such as in |ftplugin| files.
+ *ale-options.ale_lint_diff*
+ *g:ale_lint_diff*
+g:ale_lint_diff
+
+ Type: |Number|
+ Default: `0`
+
+ When this option is set to `1`, ALE will lint buffers where `&diff` is set.
+
+
*ale-options.lint_on_enter*
*g:ale_lint_on_enter*
lint_on_enter
g:ale_lint_on_enter
+
Type: |Number|
Default: `1`
diff --git a/test/test_should_do_nothing_conditions.vader b/test/test_should_do_nothing_conditions.vader
index 6dfed5554..56c372ec5 100644
--- a/test/test_should_do_nothing_conditions.vader
+++ b/test/test_should_do_nothing_conditions.vader
@@ -32,6 +32,7 @@ After:
let b:funky_command_created = 0
endif
+ unlet! g:ale_lint_diff
unlet! b:funky_command_created
unlet! b:fake_mode
@@ -79,6 +80,12 @@ Execute(DoNothing should return 1 for diff buffers):
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
+Execute(DoNothing should return 0 for diff buffers when ale_lint_diff is set):
+ let &diff = 1
+ let g:ale_lint_diff = 1
+
+ AssertEqual 0, ale#ShouldDoNothing(bufnr(''))
+
Execute(The DoNothing check should work if the ALE globals aren't defined):
unlet! g:ale_filetype_blacklist
unlet! g:ale_maximum_file_size