At Spectra, our first conference for developers and product creators, we hosted a workshop that gave an overview of the features currently available in Particle Workbench. The workshop was recorded and will be posted soon. In the meantime, here’s some of the key features we highlighted.
If you’re new to Visual Studio Code, the Command Palette will become a familiar part of the user interface. As the name implies, the Command Palette provides access to many commands such as open files, search for symbols, and see a quick outline of a file, all using the same interactive window. It can be invoked via
cmd+shift+p on macOS or
ctrl+shift+p on Linux and Windows.
Workbench adds custom Particle commands to the palette. Start typing
Particle to see all the currently available commands.
Working with Projects
You can initialize a new project with the command,
Particle: Create New Project. Doing so will open a new a Visual Studio Code Workspace, an abstract concept of a collection of files and folders. The Workspace will include a scaffold of what is needed to begin developing your Particle project, like Tasks, C++ IntelliSense, Commands, files and folders. Note that these are designed to only work when editing Particle projects as to not muddy up the rest of your editing experience.
Workbench leans heavily on the built-in IntelliSense features of Visual Studio Code and the C++ language support provided by the official C/C++ extension. Workbench works behind the scenes to automatically configures the C/C++ extension work with Device OS.
You can see IntelliSense in action by starting to type
Particle. and see suggestions for public functions.
Or possible arguments.
IntelliSense for C++ includes a slew of advanced features for you to explore. For example, you can “peek” to the definition of a function.
Downloading and maintaining a local toolchain can be a full-time job so Workbench introduces a new dependency manager. It downloads the Device OS, build system, compiler, and anything else needed to develop and debug Device OS apps, and places them in a local, private location in user space as to not mess with your current configuration.
You can install and uninstall different versions of Device OS (and dependencies) with
Particle: Install Local Compiler. You can uninstall unneeded versions just as easily.
You can set a target Device OS, target platform (like Photon) and even device through commands. If you a set a target and the required files are missing from your system, the dependency manager will automatically download the needed bits. Workbench will download the current default bundle, which is for Photon running Device OS v0.7.0. Setting a new target version will start the download process (if missing.)
You can also set these values in the
*.code-workspace file. There’s even autocompletion to boot!
Building & Flashing
The pièce de résistance of Workbench is local compilation and flashing over the wire. This is especially useful for cellular-based products where you have to pay for the data used in OTA.
Visual Studio Code has a concept of Tasks, and in particular Build Tasks, the Workshop supports. Unlike the Command Palette, Build Tasks can be launched with
ctrl+shift+b. There are even more tasks available such as
clean, which can be viewed by selecting “Terminal > Run Tasks…” from the main menu.
Cloud compilation and OTA is also supported and is available in the Command Palette.
We’ve developed a dark and light Particle-inspired theme to add a little pizazz to Workbench .
Code snippets are templates that make it easier to enter repeating code patterns, such as loops or conditional-statements. We’ve included snippets for the bits of code we use most often for your Device OS apps. For example, start typing
dw and hit
tab to expand the snippet. You can
tab between input entries, which includes suggestions.
Wiring *.ino support
You can develop Device OS with full support for IntelliSense and building of Wiring-based, *.ino files just like standard C++ files.
Add one of the 3,000+ Device OS libraries with the
Particle: Install Library command. Workbench will download the requested library, all its dependencies and even example projects. Note that there isn’t UI yet to search for Libraries so in the meantime you can use the CLI - which is described next.
Workbench ships with a local copy of the Particle CLI (Command-Line Interface). The CLI powers many of the commands behind the scenes. It can also be accessed via the Integrated Terminal, which can be handy for features not (yet) exposed natively in Workbench, like
particle libraries list.
That’s all — for now!
Hopefully this overview will help you get the most out of Particle Workbench. While we’re only in developer preview, we believe Workbench is already a very effective tool. Our engineers are using Workbench for their daily development, and we hope you will too.
But we’d love to hear what you think - what works, what doesn’t and what you’d like see in the future. Let us know right here in the forums with a new post so we can help make Particle Workbench ready for primetime.