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.
- Opens a preview button when a
.dfdfile is opened. - Generates an SVG file from the
.dfdfile using the commanddata-flow-diagram <file-path>. - Displays the generated SVG in a webview panel.
-
Install the data-flow-diagram tool. You can install it globally using
pip:pip install data-flow-diagram
-
Configure the command path in your VS Code
settings.jsonfile. Add the following configuration:{ "dfd.commandPath": "path/to/data-flow-diagram" }- Replace
path/to/data-flow-diagramwith the actual path to thedata-flow-diagramcommand. If installed globally, it might just bedata-flow-diagram.
- Replace
-
Ensure that the
data-flow-diagramcommand is accessible from your terminal. You can verify this by running:data-flow-diagram --version
-
Open a
.dfdfile in VS Code, and click on the "Preview dfd" button to generate and preview the corresponding SVG diagram.
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"
}- Open a
.dfdfile 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.
-
If the preview does not work, ensure that:
- The
data-flow-diagramcommand is installed and accessible. - The
dfd.commandPathinsettings.jsonis correctly configured. - The
.dfdfile is valid and follows the expected syntax.
- The
-
To debug, check the VS Code output panel for any error messages from the extension.
-
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
F5to run the extension in a new Extension Development Host window.
Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for more details.