Data Flow Diagram Preview Extension
This Visual Studio Code extension provides a preview feature for .dfd
files. When a .dfd
file is opened, a preview button will appear, allowing users to generate and view the corresponding SVG representation of the data flow diagram.
data-flow-diagram is a python command about generate data flow diagram from code.
Features
- Opens a preview button when a
.dfd
file is opened.
- Generates an SVG file from the
.dfd
file using the command data-flow-diagram <file-path>
.
- Displays the generated SVG in a webview panel.
Dependence
Install the data-flow-diagram tool. You can install it globally using pip
or pip3
:
pip3 install data-flow-diagram
the data-flow-diagram need to install graphviz. You can install it globally using apt
or yum
.
apt install graphviz
Configure the command path in your VS Code settings.json
file. Add the following configuration:
{
"dfd.commandPath": "path/to/data-flow-diagram"
}
- Replace
path/to/data-flow-diagram
with the actual path to the data-flow-diagram
command. If installed globally, it might just be data-flow-diagram
.
Ensure that the data-flow-diagram
command is accessible from your terminal. You can verify this by running:
data-flow-diagram --version
Open a .dfd
file in VS Code, and click on the "Preview dfd" button to generate and preview the corresponding SVG diagram.
Example Configuration
If you installed data-flow-diagram
globally, your settings.json
might look like this:
{
"dfd.commandPath": "data-flow-diagram"
}
If you installed it in a virtual environment or a specific directory, provide the full path:
{
"dfd.commandPath": "/home/user/.local/bin/data-flow-diagram"
}
Usage
- Open a
.dfd
file in the editor.
- Click the "Preview" button that appears in the editor toolbar.
- The SVG representation of the data flow diagram will be displayed in a new panel.
[
]
Troubleshooting
If the preview does not work, ensure that:
- The
data-flow-diagram
command is installed and accessible.
- The
dfd.commandPath
in settings.json
is correctly configured.
- The
.dfd
file is valid and follows the expected syntax.
To debug, check the VS Code output panel for any error messages from the extension.
development
Clone the repository:
git clone <repository-url>
Navigate to the project directory:
cd vscode-dfd-preview
Install the dependencies:
npm install
Open the project in Visual Studio Code.
Press F5
to run the extension in a new Extension Development Host window.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
License
This project is licensed under the MIT License. See the LICENSE file for more details.