Vector DBC Syntax for VS Code
Rich language support for the Vector DBC (CAN database) file format in Visual Studio Code. DBC files define the messages, signals, and nodes of a CAN bus network and are widely used in automotive development with tools such as CANdb++, CANalyzer, and CANoe.
Features
Syntax Highlighting
Tokens are coloured according to their role in the DBC grammar:
- Section keywords —
VERSION, NS_, BS_, BU_, BO_, SG_, EV_, CM_, BA_DEF_, BA_DEF_DEF_, BA_, VAL_, SIG_GROUP_, SG_MUL_VAL_, BO_TX_BU_, and all relation keywords.
- Strings — double-quoted values, with
\" escape support.
- Numbers — integers, decimals, and scientific notation; signed and unsigned.
- Comments —
// line comments.
- Mux indicators —
M, mN, and mNM signal multiplexing markers.
- Operators and punctuation —
|, @, (, ), [, ], ,, ;, :.
- Special identifier —
Vector__XXX (the no-node placeholder).

Hover over a message ID, message name, signal name, node name, or attribute name to see a structured summary without leaving the editor.
- Signal hover — start bit, bit length, byte order, value type (signed/unsigned), scale, offset, min/max, unit, and receiver nodes. If a
CM_ SG_ comment exists, it is appended below.
- Message hover — DBC ID, decoded CAN ID (with frame type: 11-bit standard or 29-bit extended), DLC, sender node, and signal count. If a
CM_ BO_ comment exists, it is appended below.
- Node hover — node name and its
CM_ BU_ comment if present.
- Attribute hover — declared kind, type, range or enum choices, and default value.

Document Outline (Symbols)
The Outline panel and Go to Symbol (Ctrl+Shift+O / Cmd+Shift+O) display a structured tree of the file:
- Each
BO_ message appears as a top-level entry labelled [0xID] MessageName with its DLC and sender as detail text.
- Each
SG_ signal appears as a child of its message, labelled with the signal name and unit.
- A
Nodes group lists all BU_ node names.
- Environment variables (
EV_) appear as top-level variable symbols.

Message Block Folding
BO_ message blocks fold and expand independently. Click the gutter chevron or use Ctrl+Shift+[ / ] to collapse or expand a message block, keeping the rest of the file visible.

Find All References
Press Shift+F12 or right-click → Find All References on any symbol to see every location in the file where it is used:
- Signal names — all occurrences in
CM_ SG_, VAL_, SIG_VALTYPE_, SIG_GROUP_, SG_MUL_VAL_, and BA_ lines.
- Message IDs — all occurrences in
CM_ BO_, VAL_, SIG_VALTYPE_, SIG_GROUP_, SG_MUL_VAL_, BO_TX_BU_, and BA_ lines.
- Node names — all occurrences in message sender fields, signal receiver lists,
CM_ BU_, BO_TX_BU_, and BA_ lines.
- Environment variable names — all occurrences in
CM_ EV_ and BA_ lines.
- Attribute names — all occurrences in
BA_DEF_DEF_ and BA_ lines.
References can be invoked from either the definition site or any usage site.
Go to Definition
Press F12 or Ctrl+Click on a reference to jump to its definition:
- Signal names in
CM_ SG_, VAL_, SIG_VALTYPE_, SIG_GROUP_, SG_MUL_VAL_, and BA_ lines navigate to the SG_ definition.
- Message IDs in
CM_ BO_, VAL_, SIG_VALTYPE_, SIG_GROUP_, SG_MUL_VAL_, BO_TX_BU_, and BA_ lines navigate to the BO_ definition.
- Node names in message sender fields, signal receiver lists,
CM_ BU_, BO_TX_BU_, and BA_ lines navigate to the BU_ definition.
- Environment variable names in
CM_ EV_ and BA_ lines navigate to the EV_ definition.
- Attribute names in
BA_DEF_DEF_ and BA_ lines navigate to the BA_DEF_ definition.
Editor Conveniences
- Comment toggling —
Ctrl+/ (Cmd+/) toggles // line comments.
- Bracket matching —
[] and () pairs are matched and highlighted.
- Auto-close pairs —
[, (, and " are automatically closed.
Installation
Install from the Visual Studio Code Marketplace or search for "Vector DBC Syntax" in the Extensions panel (Ctrl+Shift+X).
Files with the .dbc extension are automatically recognised and highlighted on open.
What is a DBC file?
A .dbc file is a plain-text network database used to describe a CAN bus. It lists:
- Nodes (
BU_) — ECUs or devices on the bus.
- Messages (
BO_) — CAN frames, each with a numeric ID, DLC, and sending node.
- Signals (
SG_) — bit fields within a message frame, with scaling, offset, range, unit, and receiver nodes.
- Comments (
CM_) — human-readable descriptions attached to messages, signals, and nodes.
- Attributes (
BA_DEF_, BA_) — custom metadata (e.g. cycle time, initial value).
- Value tables (
VAL_, VAL_TABLE_) — named enumerations for signal values.
Example snippet:
BO_ 100 ENGINE_STATUS: 8 ECU
SG_ EngineSpeed M : 0|16@1+ (0.1,0) [0|6500] "rpm" Vector__XXX
SG_ EngineTemp m0 : 16|8@1+ (1,-40) [-40|215] "degC" DASHBOARD
Limitations and planned features
The following features are planned but not yet implemented:
- Rename — rename a signal or node across the entire file.
- Completion — node-name suggestions in sender and receiver fields; attribute-name suggestions in
BA_ lines.
License
MIT
| |