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.02k stars 406 forks source link

`hediet.vscode-drawio.plugins` paths don't resolve properly with WSL2 #376

Open adamfk opened 1 year ago

adamfk commented 1 year ago

Normally the .vscode/settings.json file will be something like this:

{
    "hediet.vscode-drawio.plugins": [
        {
            "file": "${workspaceFolder}/my-plugin.js"
        }
    ]
}

This works fine with windows, but if I open vscode from within WSL2, then hediet.vscode-drawio.plugins won't resolve the path to ${workspaceFolder}/my-plugin.js properly and the user sees an error message like:

image

The current workaround is to use a hard coded windows specific absolute path:

{
    "hediet.vscode-drawio.plugins": [
        {
            "file": "C:\\some_path\\another_path\\my-plugin.js" // not ideal
        }
    ]
}

Does this make sense? I can create a gif showing how to reproduce the problem if that would help.

hediet commented 1 year ago

The path is resolved here: https://github.com/hediet/vscode-drawio/blob/master/src/Config.ts#L591

However, the StateSmith-drawio-plugin should be distributed as VS Code extension. VS Code Extensions can extend this drawio extension through this API: https://github.com/hediet/vscode-drawio/blob/master/src/DrawioExtensionApi.ts#L35

Here is an example of such an extension: https://github.com/nopeslide/drawio_mermaid_plugin/tree/master/vscode

adamfk commented 1 year ago

Thanks! That's great news. I didn't realize that was possible.

It might take me a while to get to creating a vs code extension. Is it OK to rely on the settings.json "hediet.vscode-drawio.plugins" until then? I'm preparing to recommend that all StateSmith users migrate to using this.

hediet commented 1 year ago

It would be awesome if you could come up with a PR to fix this bug!

adamfk commented 1 year ago

I'm starting to shift my StateSmith efforts into attracting and supporting contributors. Hopefully a new StateSmith contributor will help solve this issue. If not, I'll do it. I love programming, but there's only so much time in a day :)