Currently on startup, the language server activates all discovered projects immediately. For workspaces with many bsconfig.json files (e.g. monorepos, multi-channel workspaces), this means loading and compiling every project upfront, which is expensive.
Proposed approach
- On startup, scan for all projects and parse their
bsconfig.json files (to know which files belong to each project), but do not activate them (no compilation, no full program load)
- Activate a project lazily the first time any file from its
files array is seen flowing through the editor (open, focus, hover, go-to-def — any editor event, not just file-change events)
- Add a
brightscript.languageServer.activationMode VS Code setting with values:
"eager" — current behavior: activate all projects at startup
"lazy" — new behavior: activate on first file touch
Open question: Should activationMode also be settable in bsconfig.json for per-project control? This would let a large shared library opt into eager loading even if the workspace default is lazy.
Tradeoffs
- Pro: Faster startup, lower memory in large workspaces; unused projects never load
- Con: First interaction with a new project has latency while it activates; no pre-baking benefit for large projects under
lazy mode (which is why eager should remain an option)
Currently on startup, the language server activates all discovered projects immediately. For workspaces with many
bsconfig.jsonfiles (e.g. monorepos, multi-channel workspaces), this means loading and compiling every project upfront, which is expensive.Proposed approach
bsconfig.jsonfiles (to know which files belong to each project), but do not activate them (no compilation, no full program load)filesarray is seen flowing through the editor (open, focus, hover, go-to-def — any editor event, not just file-change events)brightscript.languageServer.activationModeVS Code setting with values:"eager"— current behavior: activate all projects at startup"lazy"— new behavior: activate on first file touchOpen question: Should
activationModealso be settable inbsconfig.jsonfor per-project control? This would let a large shared library opt into eager loading even if the workspace default is lazy.Tradeoffs
lazymode (which is whyeagershould remain an option)