Skip to content

Add brsconfigPath launch config to merge brsconfig.json values#786

Draft
TwitchBronBron wants to merge 7 commits into
masterfrom
brsconfig-launch
Draft

Add brsconfigPath launch config to merge brsconfig.json values#786
TwitchBronBron wants to merge 7 commits into
masterfrom
brsconfig-launch

Conversation

@TwitchBronBron

@TwitchBronBron TwitchBronBron commented May 12, 2026

Copy link
Copy Markdown
Member

Summary

Adds a new brsconfigPath property to launch.json that points to a brsconfig.json file. When set, the extension reads files, rootDir, and logLevel from that file and merges them as base values into the launch config — eliminating duplication for standard BrightScript projects that already describe their structure via brsconfig.

brsconfig.json is loaded with the same parser BrighterScript uses for bsconfig.json, so it supports extends inheritance, JSONC (comments and trailing commas), and resolves rootDir relative to the config file.

When brsconfigPath is set, bsconfig.json is not auto-loaded. The two configs are mutually exclusive: brsconfigPath is an explicit opt-in for standard BrightScript projects.

Merge priority (lowest → highest): brsconfig < launch.json.

Why

brsconfig.json is a lightweight project-structure config for standard BrightScript (no compiler), distinct from BrighterScript's bsconfig.json. The BrsConfigProjectProvider already uses brsconfig.json for project discovery (files, rootDir). This PR closes the loop so users writing their own launch.json can reference the same file via brsconfigPath instead of repeating values.

Example

// brsconfig.json
{
  "rootDir": "src",
  "files": ["manifest", "source/**/*.brs", "components/**/*"]
}
// launch.json
{
  "type": "brightscript",
  "request": "launch",
  "name": "BrightScript Debug: Launch",
  "host": "192.168.1.17",
  "password": "rokudev",
  "brsconfigPath": "${workspaceFolder}/brsconfig.json"
  // rootDir, files inherited from brsconfig.json; launch.json wins on conflict
}

Changes

  • DebugConfigurationProvider.ts
    • New getBrsConfig(config, workspaceFolder) method — loads via bslangUtil.loadConfigFile (so extends chains and JSONC work), resolves ${workspaceFolder} and relative paths, extracts only the three supported properties, throws a clear error if the referenced file is missing or invalid
    • sanitizeConfiguration now selects brsconfig OR bsconfig (not both) based on whether brsconfigPath is set
    • New brsconfigPath?: string on the BrightScriptLaunchConfiguration interface
  • package.json — adds the brsconfigPath property to the launch config schema
  • docs/Editing/index.md — restructured to lead with brsconfig.json for standard BrightScript projects; bsconfig now a brief follow-on for BrighterScript users
  • docs/Debugging/index.md — new section on brsconfigPath cross-linked from the Editing doc

🤖 Generated with Claude Code

TwitchBronBron and others added 7 commits May 12, 2026 13:52
Introduces a new `brsconfigPath` property in launch.json that pulls
`files`, `rootDir`, `cwd`, and `logLevel` from a brsconfig.json file
so vanilla BrightScript projects can keep project-structure metadata
in one place instead of duplicating it across brsconfig and launch.

Merge priority (lowest to highest): brsconfig < bsconfig < launch.json.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Debugging section explains brsconfigPath, but people looking for
"how do I tell the language server about my project structure" won't
look there. Add a brsconfig.json vs bsconfig.json section to the
Editing docs and cross-link both directions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous "Choosing a config file" intro buried the lead. Walk
through brsconfig.json with concrete examples first (matches the
common case: vanilla BrightScript), then a brief bsconfig.json
section for BrighterScript users that points back to the same
property examples.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Also fix a now-broken anchor in the Debugging doc that pointed to
a section removed in the prior Editing/index.md restructure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
brsconfigPath is an explicit opt-in for standard BrightScript projects.
When set, the extension now uses brsconfig.json exclusively and skips
the usual bsconfig.json lookup — the two configs are mutually exclusive
rather than layered.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
brsconfig.json (and bsconfig.json) resolve paths relative to their own
file location, so cwd was never a meaningful property to carry over.
Removed from the code, schema, docs, and tests; added a test that
proves cwd in brsconfig.json is now intentionally ignored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Switches getBrsConfig from raw JSON.parse to bslangUtil.loadConfigFile
so brsconfig.json gets the same handling as bsconfig.json:

- JSONC (comments + trailing commas)
- extends inheritance chains
- rootDir resolved to absolute relative to the config file

Adds tests for extends inheritance and JSONC parsing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant