Skip to content

feat: restore index cache commands - #65

Merged
ViTeXFTW merged 5 commits into
devfrom
feat/cache-commands
Jul 19, 2026
Merged

feat: restore index cache commands#65
ViTeXFTW merged 5 commits into
devfrom
feat/cache-commands

Conversation

@ViTeXFTW

Copy link
Copy Markdown
Owner

Restores persistent asset-index caching and adds VS Code commands to clear, rebuild, and reveal the cache location.\n\nValidation:\n- cargo test -p zerosyntax-server\n- npm run compile (editors/vscode)

@greptile-apps

greptile-apps Bot commented Jul 19, 2026

Copy link
Copy Markdown

Greptile Summary

This PR restores persistent asset-index caching and adds editor commands around the cache. The main changes are:

  • Persistent workspace/base scan cache keyed by roots, schema hash, and file fingerprints.
  • Serde support for analysis index data stored in the cache.
  • Server commands and a custom request to clear, rebuild, and locate the cache.
  • VS Code command contributions for cache management and cache-location reveal.

Confidence Score: 4/5

This PR needs a small extension-side fix before the new VS Code commands work as intended.

Server-side cache behavior is contained, but the newly contributed clear and rebuild commands are not wired to any VS Code handler.

editors/vscode/src/extension.ts

T-Rex T-Rex Logs

What T-Rex did

  • Ran a VS Code API harness against the compiled extension to verify which activation commands were registered.
  • Noted the posted P1 finding and produced a corresponding proof in response.
  • Reviewed rust and VS Code proof logs and observed a compile-time issue in Rust tests (missing CARGO_BIN_EXE_zerosyntax-lsp) while the TypeScript build for the VS Code extension completed successfully.
  • Uploaded and linked the reproduction and proof artifacts to support reviewer inspection.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
crates/server/src/scan.rs Implements persistent per-workspace asset index cache keyed by roots, schema hash, and file fingerprints.
crates/server/src/backend.rs Switches workspace scanning to cached scan results and adds LSP commands/custom request for clearing, rebuilding, and locating the cache.
editors/vscode/src/extension.ts Adds a handler to reveal the cache path, but omits handlers for the contributed clear and rebuild commands.
editors/vscode/package.json Contributes cache-management commands and activation events, but the clear/rebuild commands lack extension-side handlers.

Comments Outside Diff (1)

  1. General comment

    P1 Server package test target fails to compile

    • Bug
      • cargo test -p zerosyntax-server fails before running tests because crates/server/tests/cli.rs references env!("CARGO_BIN_EXE_zerosyntax-lsp"), but that compile-time environment variable is not defined for the current Cargo target.
    • Cause
      • The integration test uses the compile-time env! macro for a Cargo-provided binary path that is unavailable in this package test context.
    • Fix
      • Update the CLI integration test to resolve the binary path at runtime, for example with std::env::var("CARGO_BIN_EXE_zerosyntax-lsp"), or adjust the package/bin test configuration so Cargo defines the variable for this target.

    T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "feat: restore index cache commands" | Re-trigger Greptile

Comment on lines 71 to +83
context.subscriptions.push(
vscode.commands.registerCommand("zerosyntax.openIndexCacheLocation", async () => {
const cachePath = await client?.sendRequest<string>("zerosyntax/indexCachePath");
if (!cachePath) {
return;
}
const cacheUri = vscode.Uri.file(cachePath);
if (fs.existsSync(cachePath)) {
await vscode.commands.executeCommand("revealFileInOS", cacheUri);
} else {
vscode.window.showInformationMessage(`ZeroSyntax index cache will be created at ${cachePath}.`);
}
}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Commands are unhandled
package.json now contributes and activates zerosyntax.clearIndexCache and zerosyntax.rebuildIndexCache, but this activation block only registers zerosyntax.openIndexCacheLocation. Selecting the clear or rebuild commands from the command palette has no VS Code handler and never forwards to the server's workspace/executeCommand, so the cache-management commands are unusable from the extension.

Artifacts

Repro: executable VS Code API harness for command registration

  • Contains supporting evidence from the run (text/javascript; charset=utf-8).

Repro: command registration and invocation output

  • Keeps the command output available without making the summary code-heavy.

View artifacts

T-Rex Ran code and verified through T-Rex

@ViTeXFTW

ViTeXFTW commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

Addressed Greptile's command-wiring finding in 1609eab: clear and rebuild now explicitly dispatch workspace/executeCommand to the language server. Verified with npm run compile (editors/vscode) and cargo test -p zerosyntax-server. The reported CLI test issue was not reproducible; that command passed unchanged.

@ViTeXFTW
ViTeXFTW merged commit 6f2bd81 into dev Jul 19, 2026
4 checks passed
@ViTeXFTW
ViTeXFTW deleted the feat/cache-commands branch August 13, 2026 05:29
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