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

Add code link support for hierarchical document symbols #303

Closed TheOneKevin closed 2 years ago

TheOneKevin commented 2 years ago

This PR adds the ability to create code links to hierarchical document symbols. The main contribution of this PR is the addition of a new command:

hediet.vscode-drawio.linkSymbolWithSelectedNode

Some notes:

TheOneKevin commented 2 years ago

Updated with new changes 😄

hediet commented 2 years ago

Awesome! Can you update the changelog file and set a prerelease version? (See history) Then it will get released automatically after I merge this.

hediet commented 2 years ago

Awesome! Did you test this feature?

hediet commented 2 years ago

Please fix formatting, then I can merge this! Probably will do some refactoring later though. Thanks a lot for this cool feature!

TheOneKevin commented 2 years ago

The only testing I did was with the files under examples/linking. I added some nodes to cover the new cases. Other than that, I ran Prettier so it should conform to the style guides now.

hediet commented 2 years ago

Thank you! Will soon be available in Draw.io insiders!

janklostermann commented 6 months ago

Thanks so much for this incredible plugin!

If I understood this feature right, it allows to link a node in a draw.io-drawing to another file (e.g. a CAD-File, or another drawio-File) within the VScode controlled folder (and/or?) workspace. Click on the node would then open the other file (within VSCode if appropriate) I was very hopeful to have it already available, as in 2022 it was "soon be available".

Maybe I am just to stupid to find it or understand how it works.

Could you please add this feature and usecase to your documentation and usage examples to allow me and others to easily understand and use it? (Or did I just did not see it? And you could point me to it?)

TheOneKevin commented 6 months ago

@janklostermann: Hey! Check out docs/code-link.md for examples on this. The examples/linking/ directory also contains examples on how to use this. If I remember correctly, this linking feature allows you to link symbols inside a document -- I believe you need a language server support for this? Not sure about arbitrary files.

janklostermann commented 6 months ago

@TheOneKevin That's exactly where I tried to find it. But as you already mentioned, it seems to support only symbols.

Are files of a folder or workspace considered as symbols? (I don't actually know what symbols mean exactly in this context.) Otherwise an function extention might be needed to allow relative paths or links to files within the workspace, when symbols within these files are not available.

By the way, for a more specific usecase: Linking to another *.drawio[.png/.svg]: Do these drawio-files (languages?) provide symbols?

That would already resolve my current problem to expanding a box in a .drawio.png-file by clicking on it to open another .drawio.png file, showing the content of that box. (needed, as neither png nor svg support multi-pages, and I would like to use one of these more generally compatible formats in my repository. Great thanks they exist!!!)