diff --git a/autoload/ale.vim b/autoload/ale.vim index 6500b30..15fb53d 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -61,6 +61,12 @@ function! ale#ShouldDoNothing(buffer) abort return 1 endif + let l:filename = fnamemodify(bufname(a:buffer), ':t') + + if l:filename is# '.' + return 1 + endif + " Do nothing if running in the sandbox if ale#util#InSandbox() return 1 diff --git a/test/test_should_do_nothing_conditions.vader b/test/test_should_do_nothing_conditions.vader index 3afa11a..23ebd92 100644 --- a/test/test_should_do_nothing_conditions.vader +++ b/test/test_should_do_nothing_conditions.vader @@ -1,6 +1,8 @@ Before: Save &l:statusline + call ale#test#SetDirectory('/testplugin/test') + let b:funky_command_created = 0 " We will test for the existence of this command, so create one if needed. @@ -10,6 +12,8 @@ Before: endif After: + call ale#test#RestoreDirectory() + if b:funky_command_created delcommand CtrlPFunky let b:funky_command_created = 0 @@ -25,3 +29,13 @@ Execute(ALE shouldn't do much of anything for ctrlp-funky buffers): let &l:statusline = '%#CtrlPMode2# prt %*%#CtrlPMode1# line %* ={%#CtrlPMode1# funky %*}= <-> %=%<%#CtrlPMode2# %{getcwd()} %*' Assert ale#ShouldDoNothing(bufnr('')) + +Execute(ALE shouldn't try to check buffers with '.' as the filename): + AssertEqual + \ 0, + \ ale#ShouldDoNothing(bufnr('')), + \ 'ShouldDoNothing() was 1 for some other reason' + + silent! noautocmd file . + + Assert ale#ShouldDoNothing(bufnr(''))