Skip to content

remove polling; wait for modify events to .bacon-locations before pushing diagnostics to editor #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

Leandros
Copy link
Collaborator

Instead of constantly polling in a loop for any changes to the
.bacon-locations, and constantly pushing updates to the editor via
LSP, this will watch for changes to the .bacon-locations and only then
reevaluate the file and push diagnostics to the editor. This uses the
notify crate for cross-platform compatibility (it's used by
rust-analyzer itself, for example).

To avoid pushing too many updates at once the events are debounced using
notify-debouncer-full. The syncronize_all_open_files_wait_millis
configuration that was previously used as a wait time between polls is
now used as a timeout, ensuring that bacon-ls receives updates at least
this often. This allows us to move users silently over to the improved
implementation without requiring any new configuration or
re-configuration.

All further threads are unnecessary. There isn't much I/O happening in
*parallel*. This reduces the startup overhead when running on machines
with many cores.
Instead of constantly polling in a loop for any changes to the
`.bacon-locations`, and constantly pushing updates to the editor via
LSP, this will watch for changes to the `.bacon-locations` and only then
reevaluate the file and push diagnostics to the editor. This uses the
`notify` crate for cross-platform compatibility (it's used by
rust-analyzer itself, for example).

To avoid pushing too many updates at once the events are debounced using
`notify-debouncer-full`. The `syncronize_all_open_files_wait_millis`
configuration that was previously used as a wait time between polls is
now used as a timeout, ensuring that bacon-ls receives updates at least
this often. This allows us to move users silently over to the improved
implementation without requiring any new configuration or
re-configuration.
@crisidev
Copy link
Owner

Looks good. I'll merge and will probably do some cleanup before releasing a new version. Thanks a lot!!

@crisidev crisidev merged commit 8e413ec into crisidev:main Feb 27, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants