Skip to content

Commit

Permalink
Auto Build for Visual Studio Code
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob-the-Kuhn authored and thinkyhead committed Jun 13, 2018
1 parent e601cfb commit 26c059a
Show file tree
Hide file tree
Showing 29 changed files with 3,553 additions and 0 deletions.
2 changes: 2 additions & 0 deletions buildroot/share/vscode/AutoBuildMarlin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out
node_modules
9 changes: 9 additions & 0 deletions buildroot/share/vscode/AutoBuildMarlin/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.vscode/**
.vscode-test/**
out/test/**
test/**
src/**
**/*.map
.gitignore
tsconfig.json
vsc-extension-quickstart.md
52 changes: 52 additions & 0 deletions buildroot/share/vscode/AutoBuildMarlin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Auto Build support for Visual Studio Code
This `Visual Studio Code` extension provides access to the `Auto Build` script.

## Installation

Get the MarlinFirmware repository from GitHub. Open the directory `buildroot/share/vscode` and copy the `AutoBuildMarlin` folder to the `Visual Studio Code` extension directory. Relaunch `Visual Studio Code` to complete the installation.

To find the `Visual Studio Code` extension directory:

- Windows - Use Windows Explorer's address bar to open `C:/Users/USERNAME/.vscode/extensions`.
- Mac - Use the Finder's `Go` menu to open `~/.vscode/extensions`.
- Linux - In the Terminal type `open ~/.vscode/extensions`.

### 3. Install the PlatformIO extension
Click on `View` > `Command Palette...`

![](./resources/view_command_palette.png)

Find and click on `Extensions: Install Extensions`

![](./resources/install_extensions.png)

Type `platformio` into the search box and click on `Install` under `PlatformIO IDE`.

![](./resources/platformio_install.png)

## Usage

This extension adds the Auto Build icon ![](./media/AB.svg) to the Activities bar.

### 1. Open the Marlin folder
Click on `File` > `Open Folder...`

![](./resources/Open_Folder.png)

This brings up the `Open Folder` dialog. Select the folder that has the `platformio.ini` file in it.

![](./resources/Open_Marlin.png)

You should see something like the following. If not, click on the Explorer icon in the Activities bar.

![](./resources/Activity_bar.png)

### 2. Click on the Auto Build Icon ![](./media/AB.svg)
This brings up the Auto Build menu icon bar.
![](./resources/AB_menu.png)

### 3. Click on one of the four icons
- ![](./resources/B_small.svg) - Clicking on it starts `PIO Build`
- ![](./resources/C_small.svg) - Clicking on it starts `PIO Clean`
- ![](./resources/U_small.svg) - Clicking on it starts `PIO Upload`
- ![](./resources/Ut_small.svg) - Clicking on it starts `PIO Upload (traceback)`
37 changes: 37 additions & 0 deletions buildroot/share/vscode/AutoBuildMarlin/extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

var vscode = require('vscode');

function activate(context) {

console.log('Extension "AutoBuildMarlin" is now active!');

var NEXT_TERM_ID = 1;
var pio_build = vscode.commands.registerCommand('piobuild', function () {
const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
terminal.sendText("python buildroot/share/atom/auto_build.py build");
});
var pio_clean = vscode.commands.registerCommand('pioclean', function () {
const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
terminal.sendText("python buildroot/share/atom/auto_build.py clean");
});
var pio_upload = vscode.commands.registerCommand('pioupload', function () {
const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
terminal.sendText("python buildroot/share/atom/auto_build.py upload");
});
var pio_traceback = vscode.commands.registerCommand('piotraceback', function () {
const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
terminal.sendText("python buildroot/share/atom/auto_build.py traceback");
});

context.subscriptions.push(pio_build);
context.subscriptions.push(pio_clean);
context.subscriptions.push(pio_upload);
context.subscriptions.push(pio_traceback);
}
exports.activate = activate;

// this method is called when your extension is deactivated
function deactivate() {
}
exports.deactivate = deactivate;
12 changes: 12 additions & 0 deletions buildroot/share/vscode/AutoBuildMarlin/media/AB.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 26c059a

Please sign in to comment.