Enable ALE to lint diffs
The fix for https://github.com/w0rp/ale/issues/2399 caused a regression.
It's not great that before the fix, ALE would incorrectly lint the index file when using :Gdiff, but it's also not great that ALE doesn't lint the working directory file at all now.
Several times a day for code review I do
vim -p $(git diff --cached --name-only @~) -c "tabdo :Gdiff @~"
to open the previous version of the file, and (until this regression) show if the new version introduces any linting issues.
Since this patch, no errors are shown now until I run diffoff then :ALELint once again.
Sometimes I also do development using the previous version of the diff open, and I would still like to receive linting updates for changes I make to the working directory file.
Perhaps the patch in 9a0ece1ecb4cddf9eebbc5bfa224764c4b5ad670 would be improved by changing ale#ShouldDoNothing to check two things:
- If
&diffis on - If the file is in the current repository
This would make it so that in a :Gdiff scenario, the temporary index file would not get checked, but the working directory index file would. Does this sound reasonable?
We can add an option to enable linting for diffs, which can be disabled by default.
I saw this was added to the v4 milestone back in 2023 and it is now also in the v5 milestone, but I opened a PR supporting this functionality in 2020. Can we get that merged?
Here is the associated PR: https://github.com/dense-analysis/ale/pull/3185