Create Diagrams in VS Code with Draw.io
github.com
github.com
For more information about graphviz: https://graphviz.org/
https://github.com/asciidoctor/asciidoctor-vscode/blob/maste...
I often resign myself to using it for generating the first structure, and then laying it out better in an svg editor. Of course that way I lose some of the maintainability of it.
I had to brush off Graphviz today; I dumped a dependency graph from CMake into a series of dot diagrams, and now I'm trying to figure out how to force the SVG generated by dot to space itself out - by default, the edges are so densely packed that you can't see anything on the diagram :/.
Either the OP shared because they found a useful tool and wanted others to be able to know too, in which case sharing another related tool is in the spirit of what OP intended.
Or, OP wanted to use HN as a sales platform to pitch their work. In this case, sorry pal but HN is not your personal marketing megaphone. You want to put something out into the public here, you should expect it to be scrutinized and compared against alternatives. IMO, HN as a platform should put readers first, not authors.
Edit: Just want to add that in this particular case, I think both the draw.io and graph viz plugins are awesome. Love to see these kinds of tools.
You likely mean something structured and readable, like ‘literate diagramming’.
The top comment’s first phrase explained that rationale.
When I open threads like these I am mostly interested in:
- Interesting features that this tool has
- Experiences from the developers of this and similar tools
- Alternatives as well as their pros/cons
Meanwhile you want to deny that experience from me in order to not hurt something as irrelevant as the OPs pride.
- draw.io and graphviz have similar use cases (otherwise it wouldn't have been mentioned)
- Both have VS code plugins
- graphviz is a more structured language
- graphviz is more mature
- graphviz can be used from command line
because HN isn't a place to merely advertise a product to gain traction and marketing. These alternatives and comments on other competitors shed light on the entire eco system, and prevent astroturfing as well as group think. It may even widen somebody's lack of knowledge.
Today I learned.
Is it, though? I feel like lately you could ask five different people what HN “is” and get ten different answers.
Even if a particular project isn't that interesting to me, the landscape surrounding the project may be. The community here provides some context for the world this project lives in and that's pretty valuable, IMHO.
Is it to draw the call graph? How it's actualy done, with printfs or some lib?
https://www.graphviz.org/pdf/dottyguide.pdf.
Section 3.2.2 ldbx, on page 19, (21 in PDF), gives an example of using graphs for debugging a C application.
Although it's supported by Microsoft, it's heavily influenced by the Open-Source community. I believe that's the reason it's so popular and user-friendly for both developers and users.
Can you imagine someone trying to implement this extension on a proprietary platform like Visual Studio or IntelliJ? ... going through proprietary documentation with no access of the Source-Code to the underlying system... It would be a nightmare
And the structure of VSCode probably makes it easier to write standard code that doesn't perform poorly (it's a browser after all).
And it is still not good as the equivalent Jetbrains products. Jetbrains products have almost no restrictions either in the free version or in the personally paid versions as far as I remember.
IntelliJ also has a very good git support story, and I find myself using less and less cli git for anything from rebase to selectively staging certain chunks of code.
(Although I’ll grant that WebKit itself is a fork of KHTML from the KDE project).
Where is WebKit source and issue management anyway? It's not on GitHub. I don't imagine Apple providing very well for people, who ask for endless options on a product like VS Code.
I suppose the open source Swift language might be comparable, but I don't think it's anywhere in the same league as VS Code regarding the number of users.
That said, I do really enjoy being able to go to the source for libraries I use, recently in Go. What helps with that is that the code is consistent and readable no matter what project I open up.
Sadly for IntelliJ the documentation is lacking. There is some very general documentation online but they do not publish a generated API documentation, so as an extension developer you are often in the dark trying to figure out what classes / methods to use, unless you learn how to compile the documentation yourself.
I wish more apps have such extensibility, so that it's easy to embed apps within, and that apps be made more modular so that they can be embedded.
Microsoft had the same vision with their COM architecture, which allowed apps to be embedded inside other apps. But sadly it's too complicated, and difficult to really use (so you won't have seen much other than microsoft's own apps using such features to embed other microsoft apps).
And the web would've been a great API/protocol level for an app to be embedded via such a way, but a lot of apps dislike being framed/embedded.
Isn't it developed by an external studio in switzerland which just happend to be attatched with microsoft? I always got the impression this independance from the old Redmond-Cancer is a main reason why it could propsper so well.
By which I mean that in Redmond there seems to be some gangwars going on between the different departments, projects and generations of developers, which in external Studios seems to mostly non-existent. There was also that studio in israel which seem to propser quite well. Maybe Microsoft is accidently a perfect example for diversity in culture working out beneficial with software-projects?
It needs a sequence embed, but basically you load draw in embed mode within an iFrame, do a handshake using postMessage, then load and save is direct between parent and frame, again using postMessage.
The idea is to be able to embed into hosts that are capable of storing the diagram data, without any code changes to draw. It can embed either the main site (which was renamed to app.diagrams.net), or a locally hosted/internally packaged version of the project.
Additional information on the embed format:
https://github.com/jgraph/drawio-integration
https://desk.draw.io/support/solutions/articles/16000042544-...
Very neat!
Plus, there is a VS Code extension for it as well, which auto generates the diagrams when you save.
Do you create actual UML diagrams or just use the shapes and constructs available in PlantUML to create a more ad-hoc diagrams?
> waste minutes fiddling with getting the arrows all matched up
I can resonate with this!
[1] https://marketplace.visualstudio.com/items?itemName=jebbs.pl...
However sometimes PlantUML does not lay things out optimally (for a person) and the layout can only be tweaked so much.
That being said, for most of my purposes non-optimally laid out PlantUML diagrams were effective enough for the communication I needed to get through.
mermaid js website : https://mermaidjs.github.io/#/
It’s only popular among programmers who wants an IDE not a programmable environment like emacs. Emacs attract scientists and researchers and people who write OS, compilers, DB, language specs, HPC systems and algorithms, design algorithms, performant OS utilities etc. VSCode attract web development crowd which mostly spend time on building web forms (making it dynamic using JavaScript with some framework may be react) on top of database schema or some document storage. Given this I doubt it will be anywhere as programmable as emacs.
MS has done an amazing job optimizing VSCode.
Nevertheless, they have a somewhat easy path to migrate in the form of AssemblyScript which is a subset of Typescript that compiles to webassembly. The future of VScode is exciting!!
Performance details in the release notes are really interesting to follow.
Despite my qualms about memory use and latency, VS Code is a fully programmable editor just like Emacs, except using Javascript in place of Lisp. I don’t see much of a difference, except that JavaScript is much more popular (and thus the VS Code ecosystem develops faster) and Electron is a much more modern runtime, which enables easier integration of visual tools.
I think rather than criticizing Code all the time, we should look and learn. Clearly, Code is doing a lot of things right. And it’s not just the web dev crowd. I have seen a lost of Rust folks go to either Code or IntelliJ.
I agree that VSCode is unlikely to reach the level of emacs in terms of being a fully programmable environment. But what it does offer is an easy and modern out-of-the-box experience.
https://code.visualstudio.com/docs/languages/cpp
https://code.visualstudio.com/docs/languages/java
https://code.visualstudio.com/docs/languages/csharp
https://code.visualstudio.com/docs/languages/go
https://marketplace.visualstudio.com/items?itemName=rust-lan...
Yeah, about that. What do you think those extensions do? Do you think they all cross-compile to Javascript and plug into the famed C-bindings for React? :-D
VS Code is used for a lot of things these days.
> Given this I doubt it will be anywhere as programmable as emacs.
Customizing can be a curse. Seeking it purely for the sake of customizing is an harmful poison. VS Code has some areas for improvement, but it's good enough as it is now. It doesn't need to be as programmable as emacs.
Also just learned that Draw.io is migrating to Diagrams.net: https://www.diagrams.net/blog/move-diagrams-net
And this is frankly, amazing!
Question to author(s) - how can I support your development of draw.io?
If you wish to donate, maybe the author of this integration, Henning, has a route for that.
I think you can support draw.io by spreading it or blogging about how to use their embed mode. You can also implement custom plugins.
If you want to support the development of this extension, feel free to ping me on github or twitter!
https://marketplace.visualstudio.com/items?itemName=auchenbe...
2. The files are saved on my filesystem, which would be more of a hassle to keep in sync if I used the online version.
3. It slightly lowers the friction for me to work on a diagram, which completely changes how often I instinctively reach for a tool.
What's the point of embedding it in vscode especially?
It is going to be very useful to be able to just edit the diagram within the same editor as the rest of the files in the same working directory. You just double click the file in VS Code, and it opens there.
I am looking forward for the completion of the PNG part so that it is even more seamless.
But I think I figured why: I installed it during remote development, and it does not appear to work on the remote host. After installing it locally, it works (for local files only, though).
Is it a known issue that it does not work as a remote extension? I do all my development remotely so it would be nice if that worked.
EDIT: Just saw https://github.com/hediet/vscode-drawio/issues/8 -- disabling offline mode does indeed make it work in remote development. Awesome! :) (Would be cool if you could somehow integrate File -> Export so that it could export directly to a file on the remote host)
Neat project.