feat: fast reload optimization — skip Bazel discovery on window reload#20
Merged
monkey666-cr merged 9 commits intoMay 20, 2026
Merged
Conversation
…tExist on reload BazelCache::open() created the database file but never created tables. Read transactions (used by load_all_classpaths on startup) cannot create tables in redb, causing "Table 'classpath' does not exist" errors on every VS Code Reload Window — forcing a full 18s re-import instead of using cached data. - Add ensure_tables_exist() called after every Database::create path - Add TableDoesNotExist defense-in-depth to all read-only methods Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… noise During reload, identical "Skipping non-existent JAR" warnings were emitted once per target sharing the same missing dependency (293 warnings for 8 unique JARs). Use a static ConcurrentHashMap-backed set to log each unique missing path only once. The set is cleared on classpath refresh so warnings resurface after reimport if the JAR is still missing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…le artifacts During reload, recoverFromCache() would construct a container from stale cached entries (JARs cleaned from bazel-out/) and set it even when all entries were invalid. Now explicitly sets EMPTY container and logs an info message, preventing JDT from re-invoking initialize() and making the stale-cache scenario visible in logs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When cached state from a previous session exists (project index + workspace config + classpath cache files), importToWorkspace() now restores projects from file caches (~2-3s) instead of running the full 3-phase Bazel discovery pipeline (~16s). A background Job then runs the full pipeline asynchronously to pick up any BUILD changes. Key changes: - TargetProjectMapping: file-based workspace config persistence, project index (_index) for enumerating cached projects, shared getStateDir() helper - BazelClasspathContainerInitializer: always try file cache first via tryRecoverFromCache(), regardless of bridge initialization state - BazelProjectImporter: tryFastReload() fast path + background refresh scheduling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rity Compare computed classpath entries against file cache before calling JavaCore.setClasspathContainer() — skip the update when entries are identical, avoiding unnecessary JDT.LS workspace rebuilds. Lower background sync job priority from BUILD to DECORATE so language features (completion, go-to-definition) are never preempted. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move all Eclipse projects from default location (.metadata/) to a dedicated .bazel-projects/<projectName>/ directory under the workspace root. Projects at this location pass JDT.LS's isContainedIn() check and survive cleanInvalidProjects() across Reload Window, eliminating the delete-recreate-refresh-reindex cycle. Key changes: - Always use custom location at .bazel-projects/ (no more default location) - Linked source folders work without overlap (project and source in different directory trees) - Standard src roots (src/main/java, src/test/java) use linked folders - Fast-skip for projects already at correct location (just appendTargets) - One-time migration for projects at old locations - Auto-manage .bazel-projects/ in .gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace per-project container initialization with a single batch JavaCore.setClasspathContainer() call from file cache, reducing 28 workspace sync events to 1. Remove the background sync pipeline (queryTargets + populateGraph + runAspectBuild + refreshClasspath) from fast reload since it does 15-40s of work with zero benefit when BUILD files are unchanged. Incremental sync via BazelBuildSupport handles BUILD file changes on-demand. Also optimize the fast-skip path: remove redundant ensureNatures() call (natures persist in .project file) and add idempotent check for appendTargets() to avoid unnecessary file I/O. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…emove Java builder Optimize JDT.LS initialization to eliminate post-Ready "Synchronizing project" and "Searching..." delays: - Add IMPORT_IN_PROGRESS flag to skip per-project container initialization - Add batchSetClasspathContainers() for single JavaCore.setClasspathContainer call - Add FILE_EXISTS_CACHE to avoid repeated filesystem checks during batch init - Remove org.eclipse.jdt.core.javabuilder from Bazel projects (redundant with Bazel build, and JDT code intelligence uses Java Model not builder output) - Refactor importToWorkspace() and tryFastReload() to use deferred+batch pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pre-set JavaCore compiler options and resource filters before JDT.LS framework code runs, so its later setOptions()/configureFilters() calls become no-ops and don't trigger a second round of search indexing. Add waitForIndexesReady workspace command as a safety net so the TS extension confirms indexes are truly complete before showing ready. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
.bazel-projects/and reusing cached classpath dataChanges
BazelProjectImporter.javaBazelProjectCreator.java.bazel-projects/, skip redundant creationBazelClasspathManager.javaBazelClasspathContainerInitializer.javaBazelClasspathContainer.javaTargetProjectMapping.javaBazelCommandHandler.javaredb_store.rsstatusBar.tsTest plan
🤖 Generated with Claude Code