Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions docs/Debugging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,54 @@ then you would need change `rootDir` in your launch config to look like this:

When launching a debug session, this extension will first read all configurations from `bsconfig.json`. Then, it will overwrite any options from the selected configuration from `launch.json`. So, it is advised to keep all common settings in `bsconfig.json`, and only add values you wish to override in `launch.json`.

## Using `brsconfig.json` for standard BrightScript projects

`brsconfig.json` is a lightweight config file for **standard BrightScript** projects (i.e., projects that do **not** use BrighterScript). It is not a compiler config — it describes project structure so the language server and debugger can understand your project. See [Editing: brsconfig.json](../Editing/index.md#brsconfigjson) for how the same file drives the language server (intellisense, navigation, diagnostics).

> **Note:** `brsconfig.json` is distinct from `bsconfig.json`. `bsconfig.json` is the BrighterScript compiler config. `brsconfig.json` has no compiler; it only carries project-structure metadata for plain `.brs` projects.

### Supported properties

| Property | Description |
|---|---|
| `files` | File globs describing which files belong to the project. Used by the LSP and merged into the launch config when `brsconfigPath` is set. |
| `rootDir` | The root directory of the project (must contain `manifest`); resolved relative to the `brsconfig.json` file's location. |
| `logLevel` | Logging verbosity: `off`, `error`, `warn`, `log`, `info`, `debug`, or `trace`. |
| `extends` | Path to another `brsconfig.json` to inherit from. Comments and trailing commas (JSONC) are also supported. |

### Avoiding duplication with `brsconfigPath`

Set `brsconfigPath` in your `launch.json` to pull `files`, `rootDir`, and `logLevel` from your `brsconfig.json` automatically. Values explicitly set in `launch.json` always win.

```json
// brsconfig.json
{
"rootDir": "src",
"files": ["manifest", "source/**/*.brs", "components/**/*"]
}
```

```json
// launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "brightscript",
"request": "launch",
"name": "BrightScript Debug: Launch",
"host": "192.168.1.17",
"password": "rokudev",
"brsconfigPath": "${workspaceFolder}/brsconfig.json"
}
]
}
```

The merge order from lowest to highest priority is: extension defaults → `brsconfig.json` (via `brsconfigPath`) → `launch.json`.

> **Note:** When `brsconfigPath` is set, `bsconfig.json` is **not** auto-loaded. `brsconfigPath` is an explicit opt-in for standard BrightScript projects, so the extension uses `brsconfig.json` exclusively and skips the usual `bsconfig.json` lookup.

## Breakpoints

Roku devices currently do not have a way to dynamically insert breakpoints during a running application. So, in order to use breakpoints, this extension will inject a `STOP` statement into the code for each breakpoint before the app is deployed. This means that anytime you add/remove a breakpoint, you will need to stop your current debug session and start a new one.
Expand Down
47 changes: 32 additions & 15 deletions docs/Editing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@ C:/Projects/YourAwesomeApp/
```


## bsconfig.json
In all other situations, you will need to create a `bsconfig.json` file at the root of your project. The following sections describe the various settings you can utilize to help VSCode to better understand your project
## brsconfig.json
If your standard BrightScript project doesn't match the layout above — extra folders, a subdirectory layout, etc. — create a `brsconfig.json` at the root of your project. It tells the language server where your files live so intellisense, navigation, and diagnostics work correctly.

Supported properties:

- `files` — file globs describing which files belong to the project
- `rootDir` — the project root (must contain `manifest`); resolved relative to the `brsconfig.json` file's location
- `logLevel` — `off` | `error` | `warn` | `log` | `info` | `debug` | `trace`
- `extends` — path to another `brsconfig.json` to inherit from

## Extra folders
If your project has folders not part of the standard Roku structure, then you will need to specify all of the necessary files in the
Comments and trailing commas are allowed (JSONC). The file is loaded with the same parser BrighterScript uses for `bsconfig.json`, so `extends` chains work the same way.

> **Note:** A file named `brsconfig.json` previously existed in older versions of this extension with a different meaning. Today it has the specific, narrower purpose described here. If you're using BrighterScript, see [bsconfig.json](#bsconfigjson) below instead.

### Extra folders
If your project has folders not part of the standard Roku structure, specify all of the necessary files via `files`.

Consider this project that includes a `config/` folder:
```text
Expand All @@ -51,7 +62,7 @@ C:/Projects/YourAwesomeApp/
└─ prod.json
```

You would create the following `bsconfig.json`
You would create the following `brsconfig.json`:
```javascript
{
"files": [
Expand All @@ -66,8 +77,8 @@ You would create the following `bsconfig.json`
}
```

## Subdirectory
If your project lives in a subdirectory, you should add a `rootDir` property to the `bsconfig.json`.
### Subdirectory
If your project lives in a subdirectory, set `rootDir`.

Consider this project:

Expand All @@ -81,19 +92,19 @@ C:/Projects/YourAwesomeApp/
| └─ HomeScene.xml
└─ source/
└─ main.brs
```
```

You would have the following `bsconfig.json`:
You would create the following `brsconfig.json`:

```javascript
{
"rootDir": "./src"
}
```

## Subdirectory and Extra Folders
### Subdirectory and Extra Folders

If your code is in a subdirectory and you have extra folders
If your code is in a subdirectory and you have extra folders:
```text
C:/Projects/YourAwesomeApp/
├─ docs/
Expand All @@ -108,9 +119,9 @@ C:/Projects/YourAwesomeApp/
├─ dev.json
├─ test.json
└─ prod.json
```
```

You would have the following `bsconfig.json`:
You would create the following `brsconfig.json`:

```json
{
Expand All @@ -122,5 +133,11 @@ You would have the following `bsconfig.json`:
}
```

## Additional Options
This project relies heavily on the [brighterscript](https://github.com/rokucommunity/brighterscript) project for language server support. See [this link](https://github.com/rokucommunity/brighterscript#bsconfigjson-options) to view all of the available `bsconfig.json` options.
### Sharing brsconfig.json with your debugger

Point your `launch.json` at it via the `brsconfigPath` property so you don't have to duplicate `files` / `rootDir` / `logLevel` in both places. See [Debugging: Using `brsconfig.json` for standard BrightScript projects](../Debugging/index.md#using-brsconfigjson-for-standard-brightscript-projects).

## bsconfig.json
If you're using BrighterScript, you already have a `bsconfig.json` for the compiler — the language server reads it directly, so you don't need a separate `brsconfig.json`.

For project structure, `bsconfig.json` supports the same `files`, `rootDir`, and `logLevel` properties shown in the [brsconfig.json](#brsconfigjson) examples above — just use `bsconfig.json` as the filename. On top of that, it carries the full BrighterScript compiler config. See [the BrighterScript docs](https://github.com/rokucommunity/brighterscript#bsconfigjson-options) for the complete list of options.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,10 @@
"description": "A path to an environment variables file.",
"default": ".env"
},
"brsconfigPath": {
"type": "string",
"description": "Path to a brsconfig.json file for standard BrightScript projects. When set, the `files`, `rootDir`, and `logLevel` properties from that file are used as base values, with any properties explicitly set in launch.json taking precedence. Supports ${workspaceFolder}."
},
"consoleOutput": {
"type": "string",
"description": "Determines which console output event to listen for. 'full' is every console message (including the ones from the adapter). 'normal' excludes output initiated by the adapter and rendezvous logs if enabled on the device.",
Expand Down
Loading
Loading