Skip to content

Lazy LSP project activation: activate projects on first file interaction, not all at startup #1691

Description

@TwitchBronBron

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

  1. 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)
  2. 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)
  3. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions