Add live as-you-type diagnostics for the cargo backend - #123
Merged
Conversation
Opt-in via `init_options.cargo.updateOnInsert = true`. When enabled, the server hardlinks a shadow copy of the workspace under `target/bacon-ls-live/`, mirrors dirty buffers from `textDocument/didChange` into the shadow, and runs cargo there with `--remap-path-prefix` so diagnostics point at the user's source. Coalesces keystrokes via a configurable debounce (`cargo.updateOnInsertDebounceMillis`, default 500ms). The capability has to come through `init_options` rather than `workspace/configuration` because the static `textDocument/didChange` sync mode must be advertised in the initialize response, and clients (Neovim in particular) don't reliably retrofit attached buffers when the server tries to register that capability dynamically post-`initialized`. Also redirect the global tracing subscriber set up by `test_can_configure_tracing` to a tempfile so `cargo test` no longer clobbers the developer's `bacon-ls.log`. Signed-off-by: Matteo Bigoi <bigo@crisidev.org>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #123 +/- ##
==========================================
+ Coverage 79.03% 79.21% +0.18%
==========================================
Files 5 6 +1
Lines 2766 3209 +443
Branches 2766 3209 +443
==========================================
+ Hits 2186 2542 +356
- Misses 489 554 +65
- Partials 91 113 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Forgot to push this yesterday night :)
Opt-in via
init_options.cargo.updateOnInsert = true. When enabled, the server hardlinks a shadow copy of the workspace undertarget/bacon-ls-live/, mirrors dirty buffers fromtextDocument/didChangeinto the shadow, and runs cargo there with--remap-path-prefixso diagnostics point at the user's source. Coalesces keystrokes via a configurable debounce (cargo.updateOnInsertDebounceMillis, default 500ms).The capability has to come through
init_optionsrather thanworkspace/configurationbecause the statictextDocument/didChangesync mode must be advertised in the initialize response, and clients (Neovim in particular) don't reliably retrofit attached buffers when the server tries to register that capability dynamically post-initialized.Also redirect the global tracing subscriber set up by
test_can_configure_tracingto a tempfile socargo testno longer clobbers the developer'sbacon-ls.log.