ale icon indicating copy to clipboard operation
ale copied to clipboard

ALE Should Not Run When Entering an Empty File

Open amarakon opened this issue 2 years ago • 3 comments

I added these two lines in my Neovim configuration (Lua) to not run ALE automatically after exiting insert mode:

vim.g.ale_lint_on_text_changed = "never"
vim.g.ale_lint_on_insert_leave = 0

If I enter into an empty Haskell file, (neovim file.hs), I will get an error message even though I haven't written anything yet. I think it should not show any warnings or errors if the file is empty.

amarakon avatar Aug 17 '22 04:08 amarakon

ALE lints on these situations (see :h ale-lint):

  • When you modify a buffer. - g:ale_lint_on_text_changed
  • On leaving insert mode. - g:ale_lint_on_insert_leave
  • When you open a new or modified buffer. - g:ale_lint_on_enter
  • When you save a buffer. - g:ale_lint_on_save
  • When the filetype changes for a buffer. - g:ale_lint_on_filetype_changed

Maybe setting g:ale_lint_on_enter to zero will make ALE behave as you expect.

hsanson avatar Aug 17 '22 10:08 hsanson

That does work, but it also causes behavior I don't want. If I enter a file that isn't empty, it will not lint because I set g:ale_lint_on_enter to zero. I want it to only lint when the file isn't empty.

  • It should not lint when writing to an empty file.
  • It should not lint when entering an empty file.
  • It should lint when entering a non-empty file.
  • It should lint when writing to a non-empty file.

amarakon avatar Aug 17 '22 20:08 amarakon

I see, that is not supported by ALE.

hsanson avatar Aug 17 '22 21:08 hsanson

We should add an option for it. It's going in the milestone.

w0rp avatar Feb 03 '23 09:02 w0rp