Skip to content

Watch brightscript.bsdk SDK for dependency changes, debounce restarts, and reload language server #817

Description

@TwitchBronBron

Problem

When a workspace defines brightscript.bsdk, the extension should use the language server from that path.

If the user runs npm install in that SDK location and the BrighterScript version changes, the extension currently may keep running the old language server process.

Expected behavior

When brightscript.bsdk is set, detect dependency updates in that SDK and restart the language server once changes have settled.

Proposed approach

If brightscript.bsdk is configured, watch:

  • ${bsdkPath}/package.json
  • Optionally ${bsdkPath}/package-lock.json or other lockfiles
    On change, start a debounce/settle flow instead of immediate restart:
  • Wait for filesystem quiet period (e.g. 10–30s of no changes), with max timeout safety.
  • During settle flow, monitor the root level node_modules where ${bsdkPath} resides for activity.
  • After activity settles, restart the language server once.
  • Avoid restart loops (coalesce multiple events into one restart).
  • Handle missing paths / invalid SDK path gracefully.

Notes

  • npm install can take a while and produce many writes, so restart should happen after install activity stabilizes, not on first file event.

Acceptance criteria

  • With brightscript.bsdk set, running npm install that updates brighterscript eventually triggers exactly one language server restart.
  • No restart occurs for transient/partial writes until filesystem activity settles.
  • No repeated restart loop from install churn.
  • No behavior change when brightscript.bsdk is not set.

Metadata

Metadata

Assignees

No one assigned

    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