DBC Validator
Copyright (c) 2025 Murilo Rebelo Pontes
Professional DBC file validation and syntax highlighting for VS Code

A comprehensive Visual Studio Code extension for DBC (Database CAN) file validation, syntax highlighting, and error correction. Essential tool for automotive and embedded systems development.
🚀 Features
✅ Real-time Validation
- Instant syntax error detection
- Message ID and size validation
- Signal bit range checking
- Cross-reference validation between sections
- Advanced signal overlap detection
🎨 Advanced Syntax Highlighting
- Color-coded DBC keywords
- Standard vs custom symbol differentiation
- J1939 and CAN-FD protocol support
- Multiplexed signal indicators
🔧 Smart Error Correction
- Automatic semicolon insertion
- Quick fixes for common syntax errors
- Intelligent symbol suggestions
- Context-aware error messages
📊 Professional Features
- Real-time BO_/SG_ count in status bar
- Hover tooltips for message ID conversion
- Complete DBC specification support (40+ symbols)
- Protocol-aware validation (CAN, J1939, CAN-FD)
📦 Installation
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "DBC Validator"
- Click Install
🎯 Usage
Automatic Validation
- Open any
.dbc file
- Errors appear instantly with red underlines
- View all issues in the Problems panel
Quick Fixes
- Right-click on errors for automatic fixes
- Use Command Palette: "DBC: Fix Syntax Issues"
Commands Available
DBC: Validate File - Run complete validation
DBC: Fix Syntax Issues - Auto-correct common errors
DBC: Format Document - Format DBC file
DBC: Show Statistics - Display file metrics
🏆 Why Choose DBC Validator?
Industry Leading Features
- 98% DBC specification coverage - most complete support available
- Advanced signal analysis - detects complex overlap scenarios
- Modern protocol support - J1939, CAN-FD extensions included
- Enterprise-grade validation - exceeds commercial tools
Developer Productivity
- Instant feedback - catch errors as you type
- Professional highlighting - easier code reading
- Smart suggestions - learn DBC specification faster
- Performance optimized - handles large files efficiently
📋 Supported DBC Elements
Core Elements
✅ VERSION, NS_, BS_, BO_, SG_, CM_, BA_DEF_, BA_, VAL_
Advanced Features
✅ Multiplexed signals (M/m syntax)
✅ Signal overlap detection
✅ Attribute validation (INT, FLOAT, STRING, ENUM, HEX)
✅ Cross-reference validation
Protocol Extensions
✅ J1939 (automotive commercial vehicles)
✅ CAN-FD (high-speed CAN)
✅ 40+ standard DBC symbols
🛠️ Configuration
{
"dbcValidator.enableRealTimeValidation": true,
"dbcValidator.showStatusBar": true,
"dbcValidator.enableAutoFix": false
}
📈 Example
VERSION ""
NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
BS_:
BU_: Engine ECU Gateway
BO_ 100 EngineStatus: 8 Engine
SG_ EngineRPM : 0|16@1+ (0.25,0) [0|16383.75] "rpm" ECU,Gateway
SG_ EngineTemp : 16|8@1+ (1,-40) [-40|215] "°C" ECU,Gateway
BA_DEF_ "BusType" STRING;
BA_ "BusType" "CAN";
VAL_ 100 EngineRPM 0 "Stopped" 1000 "Idle";
🔧 Requirements
- Visual Studio Code 1.105.0 or higher
- No additional dependencies required
📝 Release Notes
1.0.0
- Initial release with complete DBC validation
- Advanced syntax highlighting
- Real-time error detection
- Cross-reference validation
- J1939 and CAN-FD support
🤝 Contributing
Found a bug or want to contribute?
- 🐛 Report Issues: GitHub Issues
- 💡 Feature Requests: Open an issue with enhancement label
- 🔧 Pull Requests: Contributions welcome!
📄 License
MIT License - see LICENSE file for details.
🏭 Professional Use
Perfect for:
- Automotive Development - Complete J1939 support
- Embedded Systems - Signal validation and analysis
- Industrial IoT - CAN-FD protocol support
- Education - Learn DBC specification with instant feedback
Made with ❤️ for the automotive and embedded systems community
Features
✅ Syntax Validation
- Real-time DBC syntax validation
- Detection of common errors in DBC files
- Validation of message IDs, sizes, and signal definitions
- Verification of identifiers and file structure
🔧 Automatic Correction
- Quick fixes for common errors
- Automatic addition of missing semicolons
- Correction of missing VERSION declarations
- Automatic document formatting
🎨 Syntax Highlighting
- DBC-specific syntax highlighting
- Support for comments, keywords, and identifiers
- Colorization of numbers, strings, and operators
⚙️ Available Commands
DBC: Validate File - Validates the current DBC file
DBC: Fix Syntax Issues - Automatically fixes syntax problems
DBC: Format Document - Formats the DBC document
DBC: Show Statistics - Shows detailed statistics about messages and signals
📊 Status Bar Integration
- Displays real-time count of messages (BO_) and signals (SG_) in the status bar
- Click on the status bar item to see detailed statistics
- Automatically updates when switching between DBC files
- Hidden when non-DBC files are active
- Message IDs: Hover over BO_ message IDs to see hexadecimal, binary, and decimal values
- Message Details: Shows message name, size, transmitter, and CAN ID type (11-bit/29-bit)
- Signal Information: Hover over signal parameters to see bit positions, byte locations, and value ranges
- Real-time Conversion: Automatic conversion between number bases with validation info
Settings
The extension provides the following settings:
dbcValidator.enableAutoValidation (default: true) - Enable automatic validation when file is modified
dbcValidator.enableAutoFix (default: false) - Enable automatic error correction
dbcValidator.maxProblems (default: 100) - Maximum number of problems to display
Development Installation
- Clone the repository
- Run
npm install to install dependencies
- Press
F5 to start a new VS Code window with the extension loaded
- Open a
.dbc file to test the extension
DBC File Structure
The extension validates the standard DBC file structure:
VERSION ""
NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_
CAT_
FILTER
BA_DEF_DEF_
EV_DATA_
ENVVAR_DATA_
SGTYPE_
SGTYPE_VAL_
BA_DEF_SGTYPE_
BA_SGTYPE_
SIG_VALTYPE_
SIGTYPE_VALTYPE_
BO_TX_BU_
BA_DEF_REL_
BA_REL_
BA_DEF_DEF_REL_
BU_SG_REL_
BU_EV_REL_
BU_BO_REL_
SG_MUL_VAL_
BS_:
BU_:
BO_ 1234 ExampleMessage: 8 Vector__XXX
SG_ ExampleSignal : 0|8@1+ (1,0) [0|255] "" Vector__XXX
Supported Validations
- ✅ Mandatory VERSION declaration
- ✅ Message definition syntax (BO_)
- ✅ Signal definition syntax (SG_)
- ✅ Message ID validation (0-0x1FFFFFFF)
- ✅ Message size validation (0-8 bytes)
- ✅ Signal start bit and length validation
- ✅ Missing semicolon detection
- ✅ Identifier length validation
- ✅ NS_ section validation - Distinguishes between standard and custom symbols
- ✅ BO_ prefix confusion detection - Prevents BO_ definitions inside NS_ section
- ✅ Custom symbol warnings - Warns about unknown custom symbols in NS_ section
📋 See DBC_SPECIFICATION_SUPPORT.md for complete list of supported and unsupported DBC elements
🎨 Enhanced Syntax Highlighting
- Standard DBC keywords - Blue highlighting for official DBC symbols
- Standard symbols in NS_ - Green highlighting for recognized NS_ symbols
- Custom symbols - Orange highlighting for custom/vendor-specific symbols
- Invalid symbols - Red highlighting for misplaced BO_ definitions in NS_
- Comments and strings - Gray and string colors respectively
Packaging and Publishing
Prerequisites for Publishing
- Microsoft/Azure DevOps Account: You need an account to access the Visual Studio Marketplace
- Personal Access Token: Create a token at https://dev.azure.com
# Install Visual Studio Code Extension Manager (vsce)
npm install -g @vscode/vsce
Packaging
To create a .vsix file of the extension:
# First compile the extension
npm run package
# Package the extension
vsce package
This will create a dbc-validator-0.0.1.vsix file that can be installed locally.
Local Installation
To install the extension locally for testing:
code --install-extension dbc-validator-0.0.1.vsix
Publishing to Marketplace
Create Personal Access Token:
- Go to https://dev.azure.com
- Navigate to User Settings > Personal Access Tokens
- Create a new token with "Marketplace (manage)" scope
Login to vsce:
vsce login <publisher-name>
Publish:
vsce publish
Publisher Configuration
Before publishing, you need to configure the publisher in package.json:
{
"publisher": "your-publisher-name",
"name": "dbc-validator",
...
}
Versioning
To update the version before publishing:
# Increments patch version (0.0.1 -> 0.0.2)
vsce publish patch
# Increments minor version (0.0.1 -> 0.1.0)
vsce publish minor
# Increments major version (0.0.1 -> 1.0.0)
vsce publish major
Testing Locally
To test the extension in development:
- Press
F5 to open a new VS Code window with the extension loaded
- Open the
example.dbc file included in the project
- Test the commands:
- Ctrl+Shift+P → "DBC: Validate File"
- Ctrl+Shift+P → "DBC: Fix Syntax Issues"
- Ctrl+Shift+P → "DBC: Format Document"
Contributing
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature)
- Commit your changes (
git commit -m 'Add some AmazingFeature')
- Push to the branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
[0.0.1] - 2025-11-05
- Initial release
- Basic DBC syntax validation
- Syntax highlighting
- Validation and correction commands
- Automatic quick fixes
Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
Requirements
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
Extension Settings
Include if your extension adds any VS Code settings through the contributes.configuration extension point.
For example:
This extension contributes the following settings:
myExtension.enable: Enable/disable this extension.
myExtension.thing: Set to blah to do something.
Known Issues
Calling out known issues can help limit users opening duplicate issues against your extension.
Release Notes
Users appreciate release notes as you update your extension.
1.0.0
Initial release of ...
1.0.1
Fixed issue #.
1.1.0
Added features X, Y, and Z.
Following extension guidelines
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
Working with Markdown
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
- Split the editor (
Cmd+\ on macOS or Ctrl+\ on Windows and Linux).
- Toggle preview (
Shift+Cmd+V on macOS or Shift+Ctrl+V on Windows and Linux).
- Press
Ctrl+Space (Windows, Linux, macOS) to see a list of Markdown snippets.
Enjoy!