diff --git a/.vscode/snippets/diagram.json b/.vscode/C4.code-snippets similarity index 76% rename from .vscode/snippets/diagram.json rename to .vscode/C4.code-snippets index f71395c..b9f2910 100644 --- a/.vscode/snippets/diagram.json +++ b/.vscode/C4.code-snippets @@ -1,5 +1,6 @@ { "C4_Person": { + "scope": "diagram", "prefix": "Person", "body": [ "Person(${1:alias}, \"${2:label}\")", @@ -8,6 +9,7 @@ "description": "Add Person to C4 diagram" }, "C4_Person_Descr": { + "scope": "diagram", "prefix": "Person with Description", "body": [ "Person(${1:alias}, \"${2:label}\", \"${3:description}\")", @@ -16,7 +18,11 @@ "description": "Add Person with Description to C4 diagram" }, "C4_Person_Ext": { - "prefix": "External Person", + "scope": "diagram", + "prefix": [ + "External Person", + "Person (External)" + ], "body": [ "Person_Ext(${1:alias}, \"${2:label}\")", "$0" @@ -24,7 +30,11 @@ "description": "Add External Person to C4 diagram" }, "C4_Person_Ext_Descr": { - "prefix": "External Person with Description", + "scope": "diagram", + "prefix": [ + "External Person with Description", + "Person (External) with Description" + ], "body": [ "Person_Ext(${1:alias}, \"${2:label}\", \"${3:description}\")", "$0" @@ -32,6 +42,7 @@ "description": "Add External Person with Description to C4 diagram" }, "C4_Container": { + "scope": "diagram", "prefix": "Container", "body": [ "Container(${1:alias}, \"${2:label}\", \"${3:technology}\")", @@ -40,6 +51,7 @@ "description": "Add Container to C4 diagram" }, "C4_Container_Descr": { + "scope": "diagram", "prefix": "Container with Description", "body": [ "Container(${1:alias}, \"${2:label}\", \"${3:technology}\", \"${4:description}\")", @@ -48,7 +60,11 @@ "description": "Add Container with Description to C4 diagram" }, "C4_Container_Boundary": { - "prefix": "Container Boundary", + "scope": "diagram", + "prefix": [ + "Container Boundary", + "Boundary for Container" + ], "body": [ "Container_Boundary(${1:alias}, \"${2:label}\"){", "\t$0", @@ -57,6 +73,7 @@ "description": "Add a Container Boundary to C4 diagram" }, "C4_Component": { + "scope": "diagram", "prefix": "Component", "body": [ "Component(${1:alias}, \"${2:label}\", \"${3:technology}\")", @@ -65,6 +82,7 @@ "description": "Add Component to C4 diagram" }, "C4_Component_Descr": { + "scope": "diagram", "prefix": "Component with Description", "body": [ "Component(${1:alias}, \"${2:label}\", \"${3:technology}\", \"${4:description}\")", @@ -73,6 +91,7 @@ "description": "Add Component with Description to C4 diagram" }, "C4_System": { + "scope": "diagram", "prefix": "System", "body": [ "System(${1:alias}, \"${2:label}\")", @@ -81,6 +100,7 @@ "description": "Add System to C4 diagram" }, "C4_System_Descr": { + "scope": "diagram", "prefix": "System with Description", "body": [ "System(${1:alias}, \"${2:label}\", \"${3:description}\")", @@ -89,7 +109,11 @@ "description": "Add System with Description to C4 diagram" }, "C4_System_Ext": { - "prefix": "External System", + "scope": "diagram", + "prefix": [ + "External System", + "System (External)" + ], "body": [ "System_Ext(${1:alias}, \"${2:label}\")", "$0" @@ -97,7 +121,11 @@ "description": "Add External System to C4 diagram" }, "C4_System_Ext_Descr": { - "prefix": "External System with Description", + "scope": "diagram", + "prefix": [ + "External System with Description", + "System (External) with Description" + ], "body": [ "System_Ext(${1:alias}, \"${2:label}\", \"${3:description}\")", "$0" @@ -105,7 +133,11 @@ "description": "Add External System with Description to C4 diagram" }, "C4_System_Boundary": { - "prefix": "System Boundary", + "scope": "diagram", + "prefix": [ + "System Boundary", + "Boundary for System" + ], "body": [ "System_Boundary(${1:alias}, \"${2:label}\"){", "\t$0", @@ -114,6 +146,7 @@ "description": "Add a System Boundary to C4 diagram" }, "C4_Relationship": { + "scope": "diagram", "prefix": "Relationship", "body": [ "Rel(${1:from_alias}, ${2:to_alias}, \"${3:label}\")", @@ -122,6 +155,7 @@ "description": "Add unidirectional Relationship to C4 diagram" }, "C4_Relationship_Techn": { + "scope": "diagram", "prefix": "Relationship with Technology", "body": [ "Rel(${1:from_alias}, ${2:to_alias}, \"${3:label}\", \"${4:technology}\")", @@ -130,6 +164,7 @@ "description": "Add unidirectional Relationship with Technology to C4 diagram" }, "C4_Layout_Right": { + "scope": "diagram", "prefix": "Layout to Right side", "body": [ "Lay_R(${1:from_alias}, ${2:to_alias})", @@ -138,11 +173,22 @@ "description": "Add hidden layout line to put {to} to the right of {from}" }, "C4_Layout_Left": { + "scope": "diagram", "prefix": "Layout to Left side", "body": [ "Lay_L(${1:from_alias}, ${2:to_alias})", "$0" ], "description": "Add hidden layout line to put {to} to the left of {from}" + }, + "C4_Boundary": { + "scope": "diagram", + "prefix": "Boundary", + "body": [ + "package \"${1:alias}\" <> as ${2:alias} {", + "\t$0", + "}" + ], + "description": "Add a generic boundary to C4 diagram." } } \ No newline at end of file diff --git a/README.md b/README.md index 1360646..882653f 100644 --- a/README.md +++ b/README.md @@ -90,12 +90,12 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS") ## Snippets for Visual Studio Code -Because the PlantUML support inside of Visual Studio Code is excellend with the [PlantUML extension](https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml), you can also find VS Code snippets for C4-PlantUML at [.vscode/snippets/diagram.json](.vscode/snippets/diagram.json). +Because the PlantUML support inside of Visual Studio Code is excellent with the [PlantUML extension](https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml), you can also find VS Code snippets for C4-PlantUML at [.vscode/C4.code-snippets](.vscode/C4.code-snippets). -It is possible to save them directly inside VS Code: [Creating your own snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_creating-your-own-snippets). +Project level snippets are now supported in [VSCode 1.28](https://code.visualstudio.com/updates/v1_28#_project-level-snippets). +Just include the `C4.code-snippets` file in the `.vscode` folder of your project. -Or you can use the [Project Snippets extension](https://marketplace.visualstudio.com/items?itemName=rebornix.project-snippets). -Now it is possible to have workspace/project level code snippets. +It is possible to save them directly inside VS Code: [Creating your own snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_creating-your-own-snippets). ![C4-PlantUML Snippets Video](images/vscode_c4plantuml_snippets.gif)