dtsfmt
A Visual Studio Code extension that provides formatting support for DeviceTree (.dts) files using the dtsfmt formatter.
Features
- Format DeviceTree files with the
dtsfmt command-line tool
- Integrates seamlessly with VS Code's built-in formatting commands
- Automatically detects workspace folder for proper formatting context
Requirements
- dtsfmt must be installed and available in your system PATH
Usage
To set dtsfmt as the default formatter for DeviceTree files, add the following to your VS Code settings:
{
"[dts]": {
"editor.defaultFormatter": "mskelton.dtsfmt"
}
}
You can also set it through the VS Code UI:
- Open a
.dts file
- Right-click and select "Format Document With..."
- Choose "Configure Default Formatter..."
- Select "dtsfmt"
Development
To contribute or modify the extension:
- Clone the repository
- Install dependencies:
npm install
- Compile TypeScript:
npm run compile
- Open in VS Code and press
F5 to run the extension in a new Extension Development Host window
Available Scripts
npm run compile - Compile TypeScript to JavaScript
npm run watch - Watch for changes and recompile
npm run fmt - Format source code with Prettier
npm run package - Package the extension for distribution
| |