qjebbs / vscode-plantuml

Rich PlantUML support for Visual Studio Code.
MIT License
1.1k stars 159 forks source link

Export on Save #200

Open xinyi-joffre opened 5 years ago

xinyi-joffre commented 5 years ago

It would be great if plantuml could have a setting like:

"plantuml.exportCurrentDiagramOnSave": true

It could be defaulted to false to keep current behavior. We have a large number of diagrams, and people may forget to autogenerate the pictures before making a PR. It would be great if the exportCurrentDiagramOnSave could export the png to the configured out directory each time the file is actually saved (not while typing).

ghuntley commented 5 years ago

I would love this. Happy to shout a beer for whomever ships it.

jertje260 commented 4 years ago

I actually got this working in combination with another extension: Trigger Task on Save

I created a task in the tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "generatePlantumlPng",
            "command": "${command:plantuml.exportDocument}",
            "isBackground": true,
        },
    ]
}

and added in my settings.json:

{
    "plantuml.exportFormat": "png",
    "triggerTaskOnSave.tasks": {
        "generatePlantumlPng": [
            "**/*.wsd",
            "**/*.pu",
            "**/*.puml",
            "**/*.plantuml",
            "**/*.iuml",
        ]
    },
}

This will actually export your diagram as a png on save.

I tried doing this also for exporting all diagrams in the workspace, but this is not working because of the task execution in vscode adding arguments.

retorquere commented 3 years ago

Can I set this up to save the export alongside the plantuml file?