vscode-kopytkoA Visual Studio Code extension providing first-class language support for BrightScript (Roku's scripting language) and the Kopytko Framework ecosystem. Features
See docs/features.md for the full feature list. Testing the extension in VS CodeThese steps run the extension in VS Code's Extension Development Host — a separate VS Code window where the extension is live and you can interact with it as a real user would. Prerequisites
1. Install dependencies and compile
2. Open the project in VS Code
3. Launch the Extension Development HostPress F5 (or go to Run → Start Debugging). VS Code will open a second window titled [Extension Development Host]. The extension is now active in that window. 4. Open or create a BrightScript fileIn the Extension Development Host window, open any
5. Exercise the features
Reloading after a code changeAfter editing source files, run For a faster loop, open two terminals and run the watchers in parallel:
Changes are picked up automatically; reload the Host window to apply them. Running the automated test suite
Runs all unit tests with Mocha. No VS Code instance is needed — tests run in Node.js directly.
Project layout
Roku device discoveryThe Roku Devices panel in the Explorer sidebar scans your local network using SSDP and lists all discovered Roku devices with their model, IP, and firmware version.
The active device's IP is automatically injected into your Debugging on a Roku devicePrerequisitesEnable developer mode on the Roku: on the remote press Home × 3, Up, Right, Left, Right, Left, Right. Note the device IP and set a developer password.
|
| Capability | How |
|---|---|
| Inspect variables | Variables panel — Local and Global scopes |
| View call stack | Call Stack panel — click any frame to switch context |
| Step over | F10 |
| Step into | F11 |
| Step out | Shift+F11 |
| Continue | F5 |
| Evaluate expression | Hover over a variable, or use the Debug Console |
See print output |
Debug Console — stdout forwarded in real time |
| See compilation errors | Debug Console — session terminates on compile failure |
See docs/roku-debug.md for full details and architecture notes.
Further reading
- Feature overview
- Roku device management and debugging
- BrightScript component catalog
- Kopytko @import annotations
- Language server architecture
Formatting Settings Reference
The formatter is configured in .vscode/settings.json (workspace) or VS Code's user settings. All settings use the kopytko.format. prefix.
See docs/formatting.md for the complete reference with before/after examples.
Indentation & Whitespace
| Setting | Type | Default | Description |
|---|---|---|---|
indentSize |
number |
4 |
Spaces per indent level |
useTabs |
boolean |
false |
Use tabs instead of spaces |
lineEnding |
string |
"auto" |
Line ending: lf, crlf, auto |
trimTrailingWhitespace |
boolean |
true |
Strip trailing spaces |
insertFinalNewline |
boolean |
true |
Ensure newline at EOF |
maxEmptyLines |
number |
2 |
Max consecutive blank lines (0 = no limit) |
emptyLinesBetweenFunctions |
number |
1 |
Blank lines between function/sub declarations |
emptyLinesBetweenMethods |
number |
1 |
Blank lines between AA method definitions |
emptyLinesAtBlockBoundaries |
string |
"preserve" |
strip, enforce, preserve |
Compound Keywords
| Setting | Type | Default | Description |
|---|---|---|---|
endKeywordStyle |
string |
"preserve" |
spaced (end if), compact (endif), preserve |
thenStyle |
string |
"preserve" |
always, never, multiline-only, singleline-only, preserve |
Functions & Subs
| Setting | Type | Default | Description |
|---|---|---|---|
functionVsSubForVoid |
string |
"preserve" |
function, sub, allow-void, preserve |
spaceBeforeNamedFunctionParens |
boolean |
false |
Space before ( in named definitions |
spaceBeforeAnonymousFunctionParens |
boolean |
false |
Space before ( in anonymous functions |
spaceBeforeCallParens |
boolean |
false |
Space before ( in calls |
spaceInsideParens |
string |
"never" |
never, always |
returnTypeAnnotations |
string |
"preserve" |
always, never, preserve |
paramTypeAnnotations |
string |
"preserve" |
always, never, preserve |
paramAlignmentStyle |
string |
"indent" |
indent, align-to-paren |
wrapParamsThreshold |
number |
0 |
Wrap params at this line length (0 = never) |
Line Length & Wrapping
| Setting | Type | Default | Description |
|---|---|---|---|
printWidth |
number |
160 |
Max desired line length |
wrapLongStrings |
string |
"preserve" |
preserve, plus, array-join |
stringConcatStyle |
string |
"preserve" |
preserve, plus, array-join |
wrapLongChains |
boolean |
false |
Break long method chains |
wrapArrays |
string |
"never" |
auto, always, never |
wrapAssocArrays |
string |
"never" |
auto, always, never |
Arrays & Associative Arrays
| Setting | Type | Default | Description |
|---|---|---|---|
bracketSpacing |
boolean |
true |
Spaces inside { } |
trailingComma |
string |
"never" |
never, always, multiline |
arrayCommaStyle |
string |
"preserve" |
Multi-line array commas: always, never, preserve |
assocArrayCommaStyle |
string |
"preserve" |
Multi-line AA commas: always, never, preserve |
arrayItemAlignment |
string |
"off" |
off, align |
singleLineObjectThreshold |
number |
0 |
Max keys before forcing multi-line (0 = no limit) |
Operators & Expressions
| Setting | Type | Default | Description |
|---|---|---|---|
spaceAroundOperators |
boolean |
true |
Spaces around +, -, *, /, <>, etc. (preserves +=, -=) |
spaceAroundAssignment |
boolean |
true |
Spaces around = in assignments (not +=, -=) |
unarySpacing |
boolean |
true |
Space after not |
operatorLineBreakStyle |
string |
"before" |
before, after |
Comments
| Setting | Type | Default | Description |
|---|---|---|---|
commentStyle |
string |
"preserve" |
', rem, preserve |
spaceAfterCommentMarker |
boolean |
true |
' comment vs 'comment |
commentWidth |
number |
0 |
Max comment line length (0 = no limit) |
Imports
| Setting | Type | Default | Description |
|---|---|---|---|
sortImports |
boolean |
false |
Sort @import and @mock lines alphabetically (mocks placed after imports) |
emptyLineAfterImports |
boolean |
false |
Blank line after last @import/@mock annotation |
Blank Lines
| Setting | Type | Default | Description |
|---|---|---|---|
blankLineAfterFunctionOpen |
boolean |
false |
Blank line after function/sub opening |
blankLineBeforeFunctionClose |
boolean |
false |
Blank line before end function/sub |
blankLineBeforeReturn |
string\|boolean |
false |
"always", "not-alone", false |
blankLineBeforeComment |
boolean |
false |
Blank line before comment blocks |
separateLogicBlocks |
boolean |
false |
Blank lines between logic groups |
Control Flow
| Setting | Type | Default | Description |
|---|---|---|---|
inlineIfThreshold |
number |
0 |
Max length for single-line if (0 = never) |
parenthesisIfCase |
string |
"preserve" |
preserve, always, never |
elseOnNewLine |
boolean |
true |
else on its own line |
forLoopSpacing |
boolean |
true |
Spaces around to and step |
BrightScript Patterns
| Setting | Type | Default | Description |
|---|---|---|---|
observeFieldStyle |
string |
"preserve" |
always-scoped, warn, preserve |
mPrefixStyle |
string |
"preserve" |
dot, bracket, preserve |
alignAssignments |
boolean |
false |
Align = in consecutive assignments |
fieldAccessConsistency |
string |
"preserve" |
dot, method, preserve |
stringConcatStyle |
string |
"preserve" |
preserve, plus, array-join |
Miscellaneous
| Setting | Type | Default | Description |
|---|---|---|---|
printStatement |
string |
"preserve" |
warn, remove, preserve |
lineCommentPosition |
string |
"preserve" |
above, inline, preserve |
Releasing
Both packages are released via GitHub Actions workflows (Actions tab → Run workflow → pick patch/minor/major).
Release kopytko-formatter (npm)
- Go to Actions → Release kopytko-formatter → Run workflow
- Select
patch,minor, ormajor - The workflow runs tests, bumps the version, updates the changelog, tags
kopytko-formatter-v{x.y.z}, publishes to npm (OIDC provenance), and creates a GitHub Release
Release vscode-kopytko (VS Code Marketplace)
- Go to Actions → Release vscode-kopytko → Run workflow
- Select
patch,minor, ormajor - The workflow compiles, tests, bumps the version, updates the changelog, tags
v{x.y.z}, publishes to the Marketplace, and creates a GitHub Release with the.vsixattached
Release order
When the formatter changes affect the extension:
- Release
kopytko-formatterfirst - Update the extension's
kopytko-formatterdependency version - Release
vscode-kopytko
Required secrets
| Secret | Purpose |
|---|---|
VSCE_PAT |
Azure DevOps PAT with Marketplace (Manage) scope |
npm uses OIDC provenance — no token needed. See docs/publishing.md for full setup.