Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>CRBasic VSCode Support - Campbell Scientific, Inc.New to Visual Studio Code? Get it now.
CRBasic VSCode Support - Campbell Scientific, Inc.

CRBasic VSCode Support - Campbell Scientific, Inc.

Gary Roberts

|
933 installs
| (2) | Free
CRBasic programming language support for Visual Studio Code and Campbell Scientific data loggers
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CRBasic Language Support Extension

VS Marketplace Version VS Marketplace Installs VS Marketplace Rating

This Visual Studio Code extension provides comprehensive language support for the CRBasic programming language, used for programming Campbell Scientific CR and GRANITE series data loggers. Features include syntax highlighting, IntelliSense, signature help, hover documentation, code navigation, diagnostics, quick fixes, and an instruction browser panel.

Supported Dataloggers

This extension provides model-specific support for the following Campbell Scientific dataloggers:

Datalogger Series Description
CR1000X / CR1000Xe CR Series Measurement and control datalogger with analog and digital I/O
CR6 CR Series Measurement and control datalogger with universal terminals
CR300 CR Series Compact measurement and control datalogger
CR310 CR Series CR300 with Wi-Fi and Ethernet communications
CR350 CR Series Compact datalogger with extended measurement capabilities
GRANITE6 GRANITE Series High-performance measurement and control data acquisition system
GRANITE9 GRANITE Series High-performance data acquisition system without native measurement
GRANITE10 GRANITE Series High-performance data acquisition system without native measurement

IntelliSense, hover documentation, the Instruction Panel, and documentation links are all filtered based on the selected datalogger model, so you only see what your hardware supports.

Installation

From the VS Code Marketplace

  1. Open VS Code
  2. Go to the Extensions view (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for "CRBasic"
  4. Click Install on CRBasic VSCode Support - Campbell Scientific, Inc.

From a VSIX File

  1. Download the .vsix file
  2. In VS Code, open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
  3. Run Extensions: Install from VSIX...
  4. Select the downloaded .vsix file

Getting Started

  1. Open or create a CRBasic file with any supported extension: .crb, .cr1x, .cr300, .cr6, .dld
  2. Select your datalogger model via File > Preferences > Settings and search for crbasic.dataloggerModel (or let the extension auto-detect it from the first line of your file)
  3. Start typing to see IntelliSense suggestions, or browse the Instruction Panel in the Activity Bar sidebar
  4. Create a new program from a template via File > New File... > CRBasic Program

Features

Syntax Highlighting

Comprehensive syntax highlighting for all CRBasic keywords, instructions, operators, data types, and comments. Semantic highlighting provides distinct colors for public variables, private variables, constants, data tables, and functions based on their declarations.

IntelliSense & Code Completion

  • Smart auto-completion for 500+ CRBasic instructions and keywords
  • Model-specific filtering -- only instructions supported by your configured datalogger model are shown
  • Context-aware suggestions (e.g., output processing instructions only appear inside DataTable blocks)
  • Cross-file completions — variables and constants from Included files appear in suggestions
  • Categorized completions with detailed documentation
  • Snippet support with tab stops for quick code entry
  • Parameter pick list completions — when typing inside a function call, valid parameter values (voltage ranges, thermocouple types, data types, etc.) are suggested from the official DEF files

Signature Help

Inline parameter hints for all CRBasic functions showing:

  • Function signature with all parameters
  • Parameter descriptions with pick list options and default values from the official DEF files (e.g., voltage ranges, thermocouple types, data types)
  • Current parameter highlighting as you type

Hover Documentation

Hover over any CRBasic keyword or function to see:

  • Function signature
  • Detailed parameter information with valid options and defaults from the official DEF files
  • Links to official Campbell Scientific documentation (model-specific)

Documentation links dynamically point to the correct datalogger's help site based on your configured model.

Code Navigation

Action Shortcut Description
Go to Definition F12 Jump to variable, constant, table, or subroutine declarations — works across Included files
Find All References Shift+F12 Find all usages of variables, tables, and subroutines — searches Included files
Rename Symbol F2 Rename a variable, constant, data table, subroutine, or function across the current file and all Included files
Include File Navigation Ctrl+Click Click on Include "filename" paths to open the included file
Breadcrumbs Breadcrumb bar Shows current scope path (e.g., BeginProg > Scan) as you navigate
CodeLens Above declarations Shows reference counts (e.g., "3 references") above each variable, constant, table, and subroutine — includes cross-file references from Included files
Document Outline CRBasic sidebar View all declarations grouped by kind, with type metadata and Included file support

Code Diagnostics

Real-time validation that checks for:

  • Mismatched Begin/End pairs (BeginProg/EndProg, If/EndIf, For/Next, etc.)
  • Mismatched preprocessor directives (#If/#EndIf)
  • Unclosed code blocks
  • Unexpected end statements
  • Unused variables, constants, data tables, subroutines, and functions (shown as faded text) — cross-file aware via Include resolution
  • Duplicate variable, constant, data table, and subroutine declarations
  • Missing Include files (warns when the referenced file does not exist)
  • Incorrect argument counts in built-in function calls (too many or too few arguments)
  • Literal type mismatches in function arguments (e.g., string literal where numeric expected, literal value where variable reference required)

Quick Fixes

Automatic code actions to fix common issues:

  • Add missing EndIf for If statements
  • Add missing EndTable for DataTable blocks
  • Add missing Next for For loops
  • Add missing EndSub for subroutines
  • Add missing #EndIf for preprocessor conditionals

Auto-Capitalize Keywords & Variable Name Matching

Automatically corrects the casing of CRBasic identifiers as you type:

  • Keywords & instructions — all 500+ built-in instructions are corrected to their canonical PascalCase (e.g., beginprog → BeginProg, scan → Scan)
  • Logical operators — and → AND, or → OR, not → NOT, xor → XOR, mod → MOD, imp → IMP, intdv → INTDV
  • Data types — float → Float, long → Long, double → Double, boolean → Boolean, string → String
  • Other keywords — as → As, true → True, false → False, nan → NAN
  • Variable name matching — corrects variable, constant, data table, and subroutine names to match their original declaration casing
  • Skips corrections inside string literals and comments
  • Configurable via crbasic.enableAutoCaseCorrection

Document Formatting

Format your entire CRBasic program with proper indentation using Format Document (Shift+Alt+F). The formatter:

  • Automatically indents all block structures (BeginProg, Scan, If/Else/EndIf, For/Next, Sub/EndSub, DataTable, Select Case, While/Wend, Do/Loop, and more)
  • Handles preprocessor blocks (#If/#ElseIf/#Else/#EndIf)
  • Correctly identifies single-line If x Then y statements (no false indentation)
  • Corrects keyword and variable name casing (when crbasic.enableAutoCaseCorrection is enabled)
  • Respects your editor's tab size and spaces/tabs preference
  • Strips trailing whitespace while preserving blank lines
  • Ignores keywords inside string literals

Compile Program (Windows Only)

Compile your CRBasic program using Campbell Scientific's official compiler directly from VS Code:

  • Click the play button in the editor title bar, right-click and select CRBasic: Compile Program, use the Command Palette, or press Ctrl+F6
  • The correct compiler is auto-selected based on the detected datalogger model
  • Compiler errors and warnings appear as VS Code diagnostics with correct line numbers
  • Full compiler output is shown in the CRBasic Compiler output channel
  • The file is automatically saved before compiling
  • Requires the Campbell Scientific compilers to be installed (included with LoggerNet or the standalone CRBasic Editor)
  • Configure the compiler directory via crbasic.compilerDirectory if installed to a non-default location

Code Folding

Collapse and expand code blocks including:

  • Scan / NextScan loops
  • DataTable / EndTable blocks
  • If / Then / EndIf conditionals
  • For / Next loops
  • Sub / EndSub subroutines
  • SlowSequence / EndSequence blocks

Document Outline Panel

A color-coded tree view in the CRBasic sidebar that displays all declarations in your program grouped by kind with rich type metadata:

  • Grouped by kind: Public Variables (blue), Dim Variables (gray), Constants (orange), Data Tables (teal), Subroutines & Functions (purple)
  • Each variable shows its data type (Float, Long, Boolean, String, Double), array dimensions (e.g., Float(14)), and string length (e.g., String *200)
  • Constants show their assigned value (e.g., = 10.0)
  • Includes declarations from Included files, annotated with the source file name
  • Click any declaration to navigate to its source line (opens external files automatically)
  • Automatically refreshes as you edit
  • Empty groups are hidden
  • Symbol colors are customizable via workbench.colorCustomizations (see Configuration)

Data Tables Panel

A sidebar panel that shows the data output structure of your CRBasic program at a glance:

  • Displays every DataTable block with its output interval and units
  • Expand a table to see all output fields with their field name, processing type (Average, Sample, Totalize, Maximum, Minimum, StdDev, WindVector, etc.), and data type (FP2, IEEE4, etc.)
  • Correctly handles WindVector multi-field output (2-4 fields based on OutputOpt)
  • Respects FieldNames overrides that rename default field names
  • Click any table or field to navigate to its source line
  • Automatically refreshes as you edit

Instruction Help Panel

A sidebar panel that shows live documentation for the CRBasic instruction under your cursor:

  • Automatically updates as you move your cursor to different instructions
  • Shows the instruction signature, description, parameters (with types), and example code
  • Pin button to lock the current instruction and stop cursor tracking
  • Insert button to insert the instruction (with snippet tab stops) at the cursor position
  • Wizard button to launch the Parameter Wizard for guided, step-by-step instruction building
  • Links to the official Campbell Scientific documentation for the selected datalogger model
  • Also updates when clicking an instruction in the Instructions panel above

Parameter Wizard

A webview panel for building CRBasic instruction calls with all parameters visible at once:

  • Opens beside the editor showing every parameter in a form layout with numbered fields
  • Parameters with known options show a dropdown with valid values from the official DEF files (voltage ranges, thermocouple types, data types, etc.) plus a text input for custom values
  • Parameters expecting variables show declared variables from your program (Public, Dim, Const, and Include'd file symbols) in the dropdown
  • Parameters expecting data tables show declared DataTable names in the dropdown
  • Free-form parameters show a text input with the DEF file default value pre-filled
  • Live preview of the assembled instruction updates as you fill in parameters
  • Optional trailing empty parameters are automatically trimmed from the output
  • Insert with the Insert button or Ctrl+Enter / Cmd+Enter; cancel with Escape
  • Accessible via the wand icon on each instruction in the Instructions panel, the Wizard button in the Instruction Help panel, or the Command Palette (CRBasic: Parameter Wizard)

Instruction Panel

A dedicated sidebar panel for browsing all CRBasic instructions, accessible via the CRBasic icon in the Activity Bar:

  • Alphabetical list of 500+ instructions with category labels
  • Search functionality to filter instructions by name
  • Category filter to show only specific instruction types (Measurement, Math, Data Tables, etc.)
  • Filtered by datalogger model -- only shows instructions supported by the configured logger
  • Click the wand button to launch the Parameter Wizard for guided instruction building
  • Click the + button to insert an instruction at the cursor position (with snippet tab stops)
  • Click the ? button to open the Campbell Scientific documentation for that instruction
  • The panel only appears when editing CRBasic files

New Program Template

Quickly scaffold a new CRBasic program:

  • Use File > New File... > CRBasic Program or the Command Palette (CRBasic: New Program)
  • Prompts for the target datalogger model
  • Inserts a standard program template with the correct first-line datalogger declaration

Auto-Detect Datalogger Model

The extension reads the first line of CRBasic files (e.g., 'CR1000X Series Datalogger) to automatically detect the target model, overriding the global setting on a per-file basis. This means each file can target a different datalogger without changing settings.

Configuration

This extension provides the following settings (accessible via File > Preferences > Settings):

Setting Default Description
crbasic.dataloggerModel CR1000X Select your Campbell Scientific data logger model. Controls which instructions appear in completions, hover help, the Instruction Panel, and documentation links. Options: CR1000X, CR6, CR300, CR310, CR350, GRANITE6, GRANITE9, GRANITE10
crbasic.enableDiagnostics true Enable or disable real-time syntax validation and diagnostics
crbasic.enableCodeActions true Enable or disable quick fix suggestions for common errors
crbasic.enableUnusedVariableDetection true Enable or disable detection of declared but unused variables, constants, data tables, and subroutines
crbasic.enableDuplicateDeclarationDetection true Enable or disable detection of duplicate variable, constant, data table, and subroutine declarations
crbasic.enableCodeLens true Show or hide reference counts above declarations
crbasic.enableSemanticHighlighting true Enable or disable semantic highlighting for distinct variable/constant/table/function colors
crbasic.enableArgumentCountValidation true Enable or disable detection of incorrect argument counts in built-in function calls
crbasic.enableArgumentTypeValidation true Enable or disable detection of literal type mismatches in built-in function call arguments
crbasic.enableFormatting true Enable or disable the built-in document formatter (Format Document / Shift+Alt+F)
crbasic.enableAutoCaseCorrection true Automatically correct the casing of keywords, instructions, operators, and declared variable names as you type and during Format Document
crbasic.compilerDirectory C:\Campbellsci\Lib\Compilers Path to the directory containing Campbell Scientific compiler executables. Installed with LoggerNet or the standalone CRBasic Editor. (Windows only)

Document Outline Colors

Customize symbol colors in the Document Outline panel via workbench.colorCustomizations in your VS Code settings:

Color ID Default (Dark) Description
crbasic.symbolVariable #75BEFF Public variable symbols
crbasic.symbolDimVariable #9E9E9E Dim (private) variable symbols
crbasic.symbolConstant #EE9D28 Constant symbols
crbasic.symbolDataTable #4EC9B0 Data Table symbols
crbasic.symbolSubroutine #B180D7 Subroutine symbols

Keyboard Shortcuts

Shortcut Action
Ctrl+Space / Cmd+Space Trigger IntelliSense suggestions
Ctrl+Shift+Space / Cmd+Shift+Space Trigger signature help
F12 Go to Definition
Shift+F12 Find All References
Shift+Alt+F Format Document (reformat indentation)
Ctrl+' Comment Block (add ' to selected lines)
Ctrl+Shift+' Uncomment Block (remove ' from selected lines)
Ctrl+F6 Compile Program (Windows only)
Ctrl+Shift+O / Cmd+Shift+O Go to Symbol (document outline)
Ctrl+Shift+P / Cmd+Shift+P Command Palette (search for "CRBasic" commands)

Online CRBasic Help

CRBasic help for each specific Campbell Scientific data logger can be found at:

  • CR1000X and CR1000Xe
  • CR6
  • CR300 and CR310
  • CR350
  • GRANITE6
  • GRANITE9
  • GRANITE10

Supported File Extensions

.crb, .cr1x, .cr300, .cr6, .dld

Known Issues

  • IntelliSense help text is not yet complete for all CRBasic instructions. Coverage is expanding with each release.
  • Not all of the latest datalogger instructions are included yet (but coverage is growing -- 500+ instructions and counting).
  • Block validation (If/EndIf, For/Next) is automatically skipped in files containing preprocessor conditionals (#If) since conditional compilation makes block matching unreliable.

Requirements

VS Code 1.100.0 or later.

Current Maintainers

  • Gary Roberts (Daiwalkr)

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft