dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.55k stars 1.44k forks source link

Add configurable delays for setting highlights and signs #1935

Open w0rp opened 6 years ago

w0rp commented 6 years ago

Setting highlights and signs repeatedly can slow down editing in Vim slightly. It would be nice to be able to configure settings for delaying the placement of highlights and signs. Two new settings could be added for delaying either highlights or signs. When the numbers are above 0, the existing functions for setting the highlights or signs could be called after a short delay. The timer would be reset each time new results come through for a buffer. This would make it so several quick edits to a file could be made faster.

ristillu commented 3 years ago

I think I would quite like this feature.

Scenario:

What I want is the correct red-squiggles but I also want responsiveness. I have a powerful machine with excess cores and memory but that has little effect. I don't want to manually toggle ALE and/or ALE settings on and off when I switch buffers. I want to be able to swap context, maintain responsiveness and yet have all the ALE information and hints available.

In the context of this Issue it would be great if I could switch buffers and ALE does its asynchronous processing of other stuff and then after some configurable time delay spawns the highlight processing asynchronously without affecting my interaction.

Diagnosing at the moment I'm running (neo)vim with logging and tailing the logs with timestamps in another terminal and can see clear 3-5 second delays as I switch between two buffers.

ristillu commented 3 years ago

Ugh literally one minute after commenting I found it was my fault. A web page advised me to add set hidden to my .vimrc and that effectively solves the problem for me. I guess without that setting each time I would buffer switch everything would have to reload and at that stage in my session that's not a clean process. Opening new buffers is not problematic for some reason (no symptoms like those I mentioned in my first post) but certainly swapping buffers was and now with set hidden is not any more.

I'll leave my comments in case they are informative to anyone else. Alternatively I'm happy to delete them if you feel they are polluting this thread.