GithubHelp home page GithubHelp logo

georgejecook / vscode-brightscript-language Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rokucommunity/vscode-brightscript-language

0.0 2.0 0.0 2.34 MB

A Visual Studio Code extension for Roku's BrightScript language

License: MIT License

TypeScript 99.98% Shell 0.02%

vscode-brightscript-language's Introduction

BrightScript Extension for VSCode

A VSCode extension to support Roku's BrightScript language.

Build Status codecov Visual Studio Marketplace

Features

  • Syntax highlighting
  • Code formatting (provided by brightscript-formatter)
  • Debugging support - Set breakpoints, launch and debug your source code running on the Roku device all from within VSCode
  • Publish directly to a roku device from VSCode (provided by roku-deploy)
  • Basic symbol navigation for document and workspace ("APPLE/Ctrl + SHIFT + O" for document, "APPLE/Ctrl + T" for workspace)
  • Goto definition (F12)
  • Peek definition (Alt+F12)
  • Find usages (Shift+F12)
  • XML goto definition support which navigates to xml component, code behind function, or brs script import (F12)
  • Method signature help (open bracket, or APPLE/Ctrl + SHIFT + SPACE)
  • Brightscript output log (which is searchable and can be colorized with a plugin like this: https://marketplace.visualstudio.com/items?itemName=IBM.output-colorizer
  • Roku remote control from keyboard

Requirements

Your project must be structured in the way that Roku expects, which looks something like this:

  • manifest
  • components/
    • HomeScene.brs
    • HomeScene.xml
  • source/
    • main.brs

Here is a sample launch configuration

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "brightscript",
            "request": "launch",
            "name": "BrightScript Debug: Launch",
            "host": "192.168.1.17",
            "password": "password",
            "rootDir": "${workspaceRoot}", //update if roku project lives in a subdirectory
            "stopOnEntry": false,
            "debugServer": 4711
        }
    ]
}

If your BrightScript project is located in a subdirectory of the workspace, you will need to update the launch configuration property called 'rootDir' to point to the root folder containing the manifest file.

For example, if you have this structure:

  • Root Workspace Folder/
    • Images/
    • Roku App/
      • manifest
      • components/
        • HomeScene.brs
        • HomeScene.xml
      • source/
        • main.brs

then you would need change rootDir in your launch config to look like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            ...
            "rootDir": "Roku App/${workspaceRoot}",
            ...
        }
    ]
}

Special Cases

Debug source files with Custom build process

If you have a build process that moves files from a source directory to an output directory, by default you will need to place breakpoints in the output directory's versions of the files.

IF your build process does not change line numbers between source files and built files, this extension will allow you to place breakpoints in your source files, and launch/run your built files. Pair this with vscode's task system, and you can build your code, then launch and debug your code with ease.

Example:

  • src/
    • main.brs
    • language.brs
    • manifest
  • languages/
    • english.brs
    • french.brs
  • dist/
    • main.brs
    • language.brs
    • manifest

Here's a sample launch.json for this scenario:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "brightscript",
            "request": "launch",
            "name": "BrightScript Debug: Launch",
            "host": "192.168.1.100",
            "password": "password",
            "rootDir": "${workspaceFolder}/dist",
            "debugRootDir": "${workspaceFolder}/src",
            "preLaunchTask": "your-build-task-here"
        }
    ]
}

Extension Settings

This extension contributes the following settings:

  • brightscript.format.keywordCase: specify case of keywords when formatting
  • brightscript.format.compositeKeywords: specify whether composite words (ie: "endif", "endfor") should be broken apart into their two-word format (ie: "end if", "end for")
  • brightscript.format.removeTrailingWhiteSpace: specify whether trailing whitespace should be removed on format

Roku Remote Control

You can use your keyboard as a Roku remote by clicking inside the Output or Debug Console panel of VSCode, and then pressing one of the predefined keyboard shortcuts from the table below. You can also press win+k (or cmd+k on mac) from inside those same panels to bring up a text box to send text to the Roku device.

This extension sends keypresses to the Roku device through Roku's External Control API. The 12 standard Roku remote buttons are already included. The keys are mapped using the when clause so it will only send remote commands if the Output or Debug Console Panel has focus (panelFocus) AND the Editor Find widget is NOT visible (!findWidgetVisible).

Here are the commands included in this extension:

Keyboard Key Roku Remote Key Keybinging Command
Backspace Back Button extension.brightscript.pressBackButton
win+Backspace (or cmd+Backspace on mac) Backspace extension.brightscript.pressBackspaceButton
Escape Home Button extension.brightscript.pressHomeButton
up Up Button extension.brightscript.pressUpButton
down Down Button extension.brightscript.pressDownButton
right Right Button extension.brightscript.pressRightButton
left Left Button extension.brightscript.pressLeftButton
Enter Select Button (OK) extension.brightscript.pressSelectButton
win+Enter (or cmd+Enter on mac) Play Button extension.brightscript.pressPlayButton
win+left (or cmd+left on mac) Rev Button extension.brightscript.pressRevButton
win+right (or cmd+right on mac) Fwd Button extension.brightscript.pressFwdButton
win+8 (or cmd+8 on mac) Info Button extension.brightscript.pressStarButton

You also have the ability to create keybindings for any other Roku supported key by adding. Here's a example entry for keybindings.json of how to create a VSCode keyboard shortcut to send the space key to the Roku:

{
	"key": "Space",
	"command": "extension.brightscript.sendRemoteCommand",
	"args": "Lit_%20",
	"when": "panelFocus && !inDebugRepl && !findWidgetVisible"
}

Contributing

View our developer guidelines for more information on how to contribute to this extension.

You can also chat with us on slack. (We're in the #vscode-bs-lang-ext channel).

Known Issues

Click here to see the list of known issues.

Changelog

Click here to see the changelog.

vscode-brightscript-language's People

Contributors

twitchbronbron avatar georgejecook avatar bvisin avatar triwav avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.