A VS Code extension for C4 DSL ModelsDescriptionThis is a VS Code extension for specifying software architecture models with the Structurizr DSL. Structurizr DSL, an example of the diagram as text trend, is the textual representation of the C4 model. Technically there is language server built on top of the origin Structurizr DSL parser. Pre-requisitesA Java VM is required for running the language server. Java 17 or higher is required. Since some users seem to encounter occasional issues with VS Code automatically finding the correct Java installation, starting from version 3.6.0, there is the option to explicitly set the path to the Java installation via the setting 'c4.languageserver.java'. The extension will first search for the corresponding Java installation in this path. If nothing is found here, it will fall back to the JAVA_HOME environment variable.
You must open a workspace that contains your models, which need to have the file extension Multiple workspaces are supported. Diagram PreviewEvery C4 view in the editor will be enriched with a code lense in order to render the corresponding view, either with a kroki.io server (if rendering type is 'plantuml' or with the structurizr.com server (if rendering type is 'structurizr'). In either way your c4 model will be sent as a Base64-encoded string to any of the public webservices for rendering purposes. This feature is deactivated by default, in case of you have concerns making your diagrams public. You can activate the feature by setting the corresponding configuration property c4.diagram.structurizr.enabled or c4.diagram.plantuml.enabled to true.
PlantUML ExportYou can trigger the export of all views from one dsl file into plantuml code, either in the context view of the explorer or the editor. Output folder and Plant UML Renderer are configurable. Language Server feaature
Text DecorationsWhen describing C4 models textually, there are plenty of raw strings describing different aspects and meta data of a model element. They are visually difficult to distinguish from each other. Therefore a text decoration option is provided, in order to highlight the different aspects with inline labels, such as This feature can become pretty expensive in case of large models. You can switch it off with setting 'c4.decorations.enabled' to 'off'. Configuration
ExamplesThe architecture (i.e. its diagrams) of this extension is modeled with - guess what - the C4 DSL itself.
Just open The workspace folder also contains some basic examples from the structurizr dsl website. Known IssuesThe !include is not yet fully supported, i.e. it might not work correctly, in case the entire model is not self-contained in one file. Issues Feel free to submit an issue in case you recognize a shortcoming or if you want to request a feature. Please attach the corresponding dsl file or its content to the issue, so that the problem can be reproduced. |