Repository navigation
Conversation
Behind a new `languageServer.lazyProjectActivation` setting (off by default). When more than one project is discovered, projects with no open files are left dormant: only their bsconfig.json is resolved to know which files they own, and nothing is loaded, parsed or validated. A dormant project is activated the first time one of its files is opened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ETmrNpsdDpbMJzc1iexFYJ
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
In workspaces with many projects, the language server activates every discovered project at startup. Each project globs, parses and validates all of its files, even if the user only ever opens files from one of them.
This adds an opt-in
languageServer.lazyProjectActivationsetting (defaultfalse). When it's on and more than one project is discovered, projects with no open files are left dormant and activated the first time one of their files is opened. This mirrors how tsserver only loads the project for a file the user opens.How it works
All changes are in
ProjectManagerandLanguageServer.syncProjects, a project that's allowed to be lazy (more than one project discovered, setting on) and owns none of the open documents becomes dormant. It only resolves itsbsconfig.jsonviautil.normalizeAndResolveConfig, the same callProgramBuildermakes, to build aPathCollectionfor itsrootDir/filespatterns. No files are listed, read or parsed. Its patterns are still registered with thePathFilterer, like an active project's.flushDocumentChangesfirst activates any dormant project that owns asetaction for an open document (allowStandaloneProject: true), then applies the actions as usual. It runs before standalone-project creation, so an opened file is handled by its real project rather than getting a standalone project. The woken project gets the in-memory editor contents and validates.LanguageServernow forwardsdocuments.onDidOpento a newProjectManager.handleFileOpen, andhandleFileCloseremoves the entry. This keeps a later re-sync (e.g. after a settings change) from leaving the project for an open file dormant.bsconfig.jsonrecomputes its file patterns.forceReloadanddisposeclear dormant projects.Rough numbers
Synthetic workspace, 6 projects × 300
.brsfiles, one file open, single-threaded:lazyProjectActivation: falselazyProjectActivation: trueThe memory measurements were too noisy to report.
Known gaps / open questions
projectsfrom settings can also go dormant. Should explicitly configured projects always activate?Tests
There's a new
ProjectManager→lazy project activationblock (8 tests):rootDir/filespatterns inbsconfig.jsonThe existing
LanguageServergetWorkspaceConfigstest was updated for the new setting. Full suite: 5361 passing, 0 failing; lint andtscare clean.Generated by Claude Code