dense-analysis / dense-analysis/ale

Kill linters on BufWinLeave if g:ale_lint_on_enter is 1

Open
#1,604 3 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Vim Script
Stars
14k
Forks
1.5k
Avg merge
17h 49m
Merged PRs (30d)
1

Description

If `g:ale_lint_on_enter` is set to `1`, the default, ALE will run the applicable linters on a buffer when the `BufWinEnter` and `BufRead` events fire. Quickly switching between buffers for files that have slow, heavy linters attached (e.g. gometalinter) will result in those linters being spun up concurrently for each buffer. Meanwhile, one implication of `g:ale_lint_on_enter` being set to `1` is that, when switching to a buffer, the loclist will be cleared and repopulated. This means that the output of linters on non-active buffers is never actually used.

The upshot of all this is that it should be safe to kill any running linters on `BufWinLeave` if `g:ale_lint_on_enter` is `1`. This would have the benefit of reducing CPU load and battery use in this scenario.

Contributor guide

Open the contributing guide

Research direction

Start by tracing ALE's handlers for BufWinLeave, BufWinEnter, and BufRead, along with the g:ale_lint_on_enter setting. Confirm how running linters are tracked and verify that, when the setting is 1, leaving a window stops those linters without disrupting linting for the active buffer.

Written by the indexing model from the issue text.

Assessment

Tech stack
vim
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.