hediet / vscode-drawio

This unofficial extension integrates Draw.io (also known as diagrams.net) into VS Code.
https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio
GNU General Public License v3.0
9.09k stars 414 forks source link

Update documentation regarding plugin configuration #326

Open mattwilmott opened 2 years ago

mattwilmott commented 2 years ago

It is unclear how both built-in and custom plugins are loaded using the defined snippets in settings.json

Can the README.md be update please to reflect how to achieve this?

hediet commented 2 years ago

You can list your plugin in hediet.vscode-drawio.plugins. The content of that referenced js file gets injected into the drawio webview.

Here is an example of such a plugin: https://github.com/hediet/vscode-drawio/blob/ea7f2a6f32c2892f86e8f8347772b803ba6b0f10/examples/tooltips-plugin.js

mattwilmott commented 2 years ago

Apologies @hediet,

I meant can the README be updated to reflect how to set the plugin vars in VSCode's workspace settings.json

The following fields need a bit more of a description added: known plugins plugins

And some context in the projects README.md regarding how to load a custom plugin and how to load a built in plugin would be helpful

Example questions

  1. what is the plugin's fingerprint? Is it a md5sum or something that needs to be generated?
  2. are the pluginIds referenced from somewhere or up to the user to assign?
  3. is the file path relative and from where?
  4. how to load the builtin plugins, see list below?
  5. why is there a known_plugin list and a plugin list?

settings

builtin_plugins

martinmoldrup commented 1 year ago

+1 for this

I am trying to enable the svgdata plugin and it is not clear how to do this? Could you please provide some information about how to do this? When adding this to the settings.json

   "hediet.vscode-drawio.plugins": [
        {
            "file": "C:/Users/12345/.vscode/extensions/hediet.vscode-drawio-1.6.6/drawio/src/main/webapp/plugins/svgdata.js"
        }
    ]

I get this error:

Found unknown plugin "file:///c%3A/Users/12345/.vscode/extensions/hediet.vscode-drawio-1.6.6/drawio/src/main/webapp/plugins/svgdata.js" with fingerprint "dde72233a663f0c5509da9642f9840c2ad08406373edef7f8c44e7e891752143"

hediet commented 1 year ago

I get this error:

You have to click the button in the notification to allow this plugin!

hediet commented 1 year ago

what is the plugin's fingerprint? Is it a md5sum or something that needs to be generated?

That's an implementation detail. The extension computes it and shows the user a notification.

are the pluginIds referenced from somewhere or up to the user to assign?

I think knownPlugins should not be a visible setting, but rather a hidden one - the extension manages this.

is the file path relative and from where?

It is absolute, but you can use ${workspaceFolder}

how to load the builtin plugins, see list below?

This is not supported.

why is there a known_plugin list and a plugin list?

knownPlugins is managed by the extension (and should be private). Plugins is managed by the user.