Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>OpenC3 Extension (BETA)New to Visual Studio Code? Get it now.
OpenC3 Extension (BETA)

OpenC3 Extension (BETA)

Jake Hill

|
21 installs
| (0) | Free
openc3 local development support, cmd/tlm, scripting, etc.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

openc3 vscode - BETA

NOTE: This is not an official OpenC3 extension and is not maintained by the OpenC3 team. For bugs/feedback, use this Issue Tracker

This extension aims to assist in the local development of openc3/cosmos plugins/scripts.

Extension Settings

This extension contributes the following settings:

  • openc3.ignoreDirectories: list of directory names to ignore for context generation
  • openc3.preferredStyle: Set to "inline" for cmd("TARG MNEMONIC ...") or "positional" for cmd("TARG", "MNEMONIC"). Both styles are still possible at all times, this manages where your cursor gets placed during completions

Features

Works with many plugin directories in a single workspace/folder

Extension is not strict about structure/layout. Entire workspace is scanned and contextualized to generate cmd/tlm definitions etc.

Scripting completions/suggestions

Python:

  • Suggestions/Autocompletions for most common api functions ie. cmd,tlm,wait_check,etc.
  • Full API stub injection with type info
  • load_utility('<plugin/path>') dynamically resolves imports (if source exists in your workspace)

Ruby:

  • Suggestions/Autocompletions for most common api functions ie. cmd,tlm,wait_check,etc.

Your browser does not support the video tag.

Configuration completions/suggestions and highlighting

Your browser does not support the video tag.

Embedded Ruby Support (ERB)

Open from command palette with openc3.showERB - or click the eye icon in the top right

Your browser does not support the video tag.

Adding missing/custom erb values (typically not required)

NOTE: The target_name variable is automatically generated during compilation.

Create a file named openc3-erb.json near your configuration files that require erb definitions. A workspace can contain any number of erb configuration files.

plugin/target/cmd_tlm/cmd.txt <-- file with unresolvable erb definitions

These are all valid
- plugin/target/cmd_tlm/openc3-erb.json <- Scoped to only what is in cmd_tlm directory
- plugin/target/openc3-erb.json         <- Scoped to everything in the target
- plugin/openc3-erb.json                <- Scoped to everything in the plugin
- openc3-erb.json                       <- Scoped to everything

Update the openc3-erb.json with variables and patterns. If either is not required, simply assign it to an empty object like so "variables": {}

{
  "variables": {
    "var_name": "value"
  },
  "patterns": {
    "<some-regex/string>": "replace with this"
  }
}

The "variables" object directly instantiates ruby variables by name, any erb in any configuration file within the scope will be able to reference these variables.

Example:

// plugin/cmd_tlm/openc3-erb.json
{
  "variables": {
    "my_variable": "COMMAND_MNEMONIC"
  },
  "patterns": {}
}
# plugin/cmd_tlm/cmd.txt
COMMAND <%= target_name %> <%= my_variable %> ...
# Becomes
COMMAND TARGET_NAME COMMAND_MNEMONIC

The "patterns" object will simply replace whatever pattern is supplied with any other value. Useful if you have some custom preprocessor on top of your plugin generation workflow.

Example:

// plugin/openc3-erb.json
{
  "variables": {},
  "patterns": {
    "%%target_hostname%%": "127.0.0.1"
  }
}
# plugin/plugin.txt
VARIABLE host %%target_hostname%%

INTERFACE MY_INTERFACE openc3/interfaces/udp_interface.py <%= host %> ...

# Becomes
VARIABLE host '127.0.0.1'

INTERFACE MY_INTERFACE openc3/interfaces/udp_interface.py 127.0.0.1 ...

Requirements

NOTE: This extension will only activate if your workspace contains both:

  1. Plugin files (plugin.txt)
  2. Rakefiles (Rakefile)

Certain python scripting features will not work properly without the pylance extension. This extension automatically generates pylance configuration settings in .vscode/settings.json

For ruby you will need some extension that supports .rbs type signatures (Extension has only been tested with soutaro.steep-vscode + shopify.ruby-lsp)

  • "shopify.ruby-lsp"
  • "soutaro.steep-vscode"

Known Issues

There are probably tons, you are welcome to open issues here

  • Dollar signs in cmd/tlm files sometimes cause erb parse to fail, fix coming eventually

Release Notes

0.0.1

Initial release, includes minimum set of features to be somewhat useful

0.1.2

Resolve quirky behavior in scripting autocompletions

0.2.0

  • Improve parsing efficiency to manage much larger projects
  • Implement erb require which can include ruby files from project and utilize them during erb compilation
# require search will look through the ascending directory structure and in lib directories
<%
require 'otherfile'  # Located at ../lib/otherfile.rb

some_result = function_defined_in_otherfile()
%>
  • Implement erb render which includes additional cmd/tlm files in place with locals defined
TELEMETRY INST HEALTH_STATUS BIG_ENDIAN "Health and status"
  <%= render "_ccsds_apid.txt", locals: {apid: 1} %>  # <- this works now
  APPEND_ITEM COLLECTS     16 UINT   "Number of collects"

0.2.1

  • Fix issue that would delete the entire .gitignore contents from a workspace (OOPS)
  • Stubs are now managed in the proper workspace storage directory instead of in .vscode
  • Resolve initialization condition that caused many compilation tasks to spawn concurrently
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft