Skip to content

fix(lsp): re-check only affected projects (#384); lspkit 0.6.0 - #413

Merged
MelbourneDeveloper merged 4 commits into
mainfrom
fix/lsp-sweep-cpu
Nov 18, 2026
Merged

MelbourneDeveloper merged 4 commits into
mainfrom
fix/lsp-sweep-cpu

Conversation

@MelbourneDeveloper

@MelbourneDeveloper MelbourneDeveloper commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR

A watched file save or a tab close now re-checks only the projects it affects instead of the whole repository, which ends the idle 100% CPU in osprey lsp (#384). Osprey also moves to lspkit 0.6.0.

Details

Language server (#384)

  • New scope::rescope (server/scope.rs). It handles workspace/didChangeWatchedFiles and textDocument/didClose, and queues only:

    • the changed documents and the siblings they affect;
    • newly discovered documents.

    A sweep already in progress keeps its queue instead of restarting.

  • Before this, every save and every close called refresh, which re-queued every closed file in the repository. The cache keeps only 4 closed projects (fix(lsp): release closed projects the diagnostics sweep has passed #411), so each save re-analysed all 191 projects in this repository, and a stream of saves never let the server settle.

  • refresh still re-sweeps everything for initialized, configuration changes and workspace-folder changes. Both paths share one rescan.

  • New server/scope/files.rs holds the disk discovery helpers moved out of scope.rs, which keeps that file under 500 lines.

  • New watched() in server.rs extracts the URIs a watched-files notification names.

Dependencies

  • lspkit, lspkit-server and lsp-profiler 0.5.0 → 0.6.0, and @nimblesite/lsp-profiler-ui ^0.4.0 → ^0.6.0. Osprey needed no code changes.
  • humantime (RUSTSEC-2026-0542), rmp and rmp-serde leave Cargo.lock.

CI

  • In gpui.yml, the macOS job now builds the host in its own step and saves the GPUI host cache right after, as the Linux job does. Before, a cold build that hit the 20-minute limit lost its post-step save, so every rerun started cold again.

Docs

  • docs/plans/lsp-memory.md: the CPU fix and the 0.6.0 upgrade steps are ticked.

How Do The Automated Tests Prove It Works?

  • New test: server::tests::features::watched_changes_recheck_only_the_projects_they_affect drives the real framed server over an 8-project workspace. It asserts that the first sweep publishes every project, then counts project analyses after each event:

    • one watched save → exactly 1 analysis, and the saved file's warning clears;
    • a tab close → at most 1 analysis;
    • a newly created file → exactly 1 analysis, and its redundant-annotation warning is published;
    • an unrelated .ts file → 0 analyses.

    After each event, no other document is republished. Before the fix, the save step failed with a save re-checked 8 projects (left: 8, right: 1).

  • Existing suites: all 259 osprey-lsp tests pass, including diagnostic_scope_initial_roots_unsaved_python_and_workspace_changes, which covers that a close restores the disk warning and that a deleted file's findings clear. All 21 lsp-profiler-osprey tests pass on 0.6.0.

  • CI: CI run 44259894341 is green. On its second attempt, the macOS job restored the cache the first attempt saved.

Refs #384. It stays open until a released binary is verified.

🤖 Generated with Claude Code

@MelbourneDeveloper MelbourneDeveloper changed the title fix(lsp): a watched save or tab close re-checks only the projects it affects (#384) fix(lsp): re-check only affected projects (#384); lspkit 0.6.0 Nov 18, 2026
@MelbourneDeveloper
MelbourneDeveloper merged commit 40b5e7f into main Nov 18, 2026
87 of 90 checks passed
@MelbourneDeveloper
MelbourneDeveloper deleted the fix/lsp-sweep-cpu branch November 18, 2026 12:52
MelbourneDeveloper added a commit that referenced this pull request Nov 20, 2026
## TL;DR
Moves the language server to lspkit 0.10.1 and drops dependencies
nothing uses.

## Details
- **lspkit 0.6.0 → 0.10.1:** `lspkit`, `lspkit-server` and
`lsp-profiler` in `src/toolchain/Cargo.toml`, plus
`@nimblesite/lsp-profiler-ui` ^0.10.0, which is its newest release.
- The releases in between fix leaks and lifecycles: an abandoned
cooperative attach now stops the in-process sampler, forwarder tasks are
owned and pinned, Python memory tracking is released on stop, and
decoration types are disposed.
- 0.10.1 also fixes the frame drain (lspkit #55) and logs dropped
sidecar notifications, which adds a `tracing` edge.
- Osprey uses no API that changed. `lsp-profiler` still pins `sysinfo`
0.39.3, which matches the workspace.
- **Unused dependencies removed:**
  - `thiserror` from `lsp-profiler-osprey`.
  - `ts-node` and its `.vscodeignore` line from the VS Code extension.
- `@11ty/eleventy-plugin-syntaxhighlight` and `markdown-it-anchor` from
the website.
- `@osprey/graphics` and `@osprey/json` from `signal_flow` and `vscode`,
and `@osprey/json` from `uitest`. These packages never import them;
`@osprey/native` brings them in.
- **Kept:** the website's `markdown-it` devDependency.
`tests/pages.spec.js` calls `require("markdown-it")`, which fails with
`MODULE_NOT_FOUND` once the package is gone from the top level.
- `docs/plans/lspkit-leak-upgrade.md` now records the pinned version.

## How Do The Automated Tests Prove It Works?
- The LSP suites run on lspkit 0.10.1: `cargo test -p osprey-lsp` and
the `live_profiler_lsp` end-to-end test, which drives lspkit's profiler
service and covers `$/cancelRequest`. The VS Code extension's LSP suite
runs as well.
- The website test `long authored guides retain a useful image or inline
video per 500 prose words` passes with `markdown-it` restored. Without
it, it fails with `MODULE_NOT_FOUND`.
- The package matrix test
`the_package_matrix_runs_all_62_suite_backend_pairs_once` builds
`signal_flow`, `uitest` and `vscode` without the removed manifest
entries.
- Local `make ci` on macOS: lint, build and every test pass. The three
Rust coverage gates that fail only on macOS (osprey-cli, osprey-lsp,
osprey-types) are the same ones that failed locally for #413, whose
Linux CI passed them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant