please icon indicating copy to clipboard operation
please copied to clipboard

Make plz watch debounce duration configurable

Open RichardoC opened this issue 4 years ago • 5 comments

This could be done by adding a flag for waiting a certain time after the last change to that target before building, or just building this in by default.

This would be very helpful for avoid building things that are genuinely broken because I haven't finished typing the line yet 😅

RichardoC avatar Apr 08 '22 16:04 RichardoC

plz watch does have some debouncing, see https://github.com/thought-machine/please/blob/270c0ece7d2465ea20457afeae5056bfea243709/src/watch/watch.go#L67

It seems reasonable to make that configurable though (currently it's a constant 100ms).

This would be very helpful for avoid building things that are genuinely broken because I haven't finished typing the line yet

Curious, it only fires builds when the file actually gets written to disk; is that happening for you because you're saving as you go, or is your editor autosaving as you write?

peterebden avatar Apr 28 '22 08:04 peterebden

It might be that he was editing the file during the build, so when the build finishes it just starts the next build. If the target takes a while to link, this might happen but I'm not sure if we can really do anything about this.

Tatskaari avatar Apr 28 '22 09:04 Tatskaari

plz watch does have some debouncing, see

https://github.com/thought-machine/please/blob/270c0ece7d2465ea20457afeae5056bfea243709/src/watch/watch.go#L67

It seems reasonable to make that configurable though (currently it's a constant 100ms).

This would be very helpful for avoid building things that are genuinely broken because I haven't finished typing the line yet

Curious, it only fires builds when the file actually gets written to disk; is that happening for you because you're saving as you go, or is your editor autosaving as you write?

I'm using vscode with autosave, and its saves every ~ 250ms leading to this behaviour

RichardoC avatar Apr 28 '22 09:04 RichardoC

I'm using vscode with autosave, and its saves every ~ 250ms leading to this behaviour

OK, I'm fine with providing a flag to make this configurable to work around that then. Although I do think that is a little naive of VSCode to just do it on a hard timer - I'd expect it to be debouncing here as well.

peterebden avatar Apr 28 '22 10:04 peterebden

This issue has been automatically marked as stale because it has not had any recent activity in the past 90 days. It will be closed if no further activity occurs. If you require additional support, please reply to this message. Thank you for your contributions.

stale[bot] avatar Aug 10 '22 06:08 stale[bot]