Open vault in VSCode plugin

This plugin makes a ribbon button and a command to open your vault as a Visual Studio Code workspace. You can find it in community plugins or on github.

You can use VSCode for various purposes with your vault, such as for git version control, markdown formatting with Prettier, linting with markdownlint, mass formatting files and more.

The icons work with light and dark mode.

light and dark

You can also use it as a command and assign hotkeys to it.

Compatibility

The plugin was tested in Obsidian v0.11.13 and subsequent versions, but probably works with older versions.

Installation

You can install the plugin via the Community Plugins tab within Obsidian. You can also manually copy from releases to your .obsidian/plugins/open-vscode folder.

Issues

VSCode can’t open a workspace without a further confirmation dialog (that you just can hit enter on) for security reasons. See this issue for more infomation.

Credits

Thank you to the makers of the DEVONlink plugin, as it was a great starting point for working with ribbon icons in Obsidian. I got the icon from icon-icons.com and resized it with iLoveIMG.

Support

If you like this plugin you can support me on PayPal here: Paypal

9 Likes

Being in VSCode, It would be also nice to open the vault in Dendron and make it play with its features as it is already made with Logseq.

2 Likes

Do you want it to have the effect of opening dendron.code-workspace?. I don’t use Dendron, so I’m not sure. That would mean a more than minor rewrite, as the VSCode URL scheme doesn’t seem to support that, or anything other than opening a file or folder.
Do you mind opening a pull request for this on the plugin’s GitHub?

1 Like

Thank you. It’s ok. It will be easier to use the plugin as it is. Then, once the vault is open in a VSCode workspace I can add it to Dendron as another vault or as another workspace. An experiment to play with.

1 Like

The plugin now uses templatable commands instead of URLs (but you can still use URLs).
You can basically set and run any command that you can in a shell, and pass the vault to as an argument to it, using the ribbon button or the Obsidian command.

I tried code {{vaultpath}}/dendron.code-workspace as a template, and it opens the Dendron workspace of the vault. I hope this works for you.

2 Likes

That should actually be {{vaultpath}}/../dendron.code-workspace to make sense. That’s because Dendron needs a parent folder to contain the vault.

But I can’t get this to work. I disabled Use URL, but nothing happens when I click on the ribbon icon.
I tried to set the template to code {{vaultpath}}/../dendron.code-workspace and still nothing happens.

1 Like

Got it, thanks to the debugging session at Plugin doesn't open my vault in VS Code · Issue #3 · NomarCub/obsidian-open-vscode · GitHub .

On macOS, a full path was required for some reason:

/usr/local/bin/code "{{vaultpath}}/dendron.code-workspace"
2 Likes

I am familiar with VSC a bit and have given Dendron the once-over;

I played around with OBS / Dendron and what I noticed is for the notes to appear in the Dendron Tree the notes must be at the vault level not in any folders. I guess this is where the Dendron hierarchical note structure comes into play. So in order to use this feature in Dendron; #1 the OBS files need to be free of any folders; #2 all notes need to be written with the “Note.Subnote” naming convention inside OBS.

Why would someone want to use the Dendron workspace for OBS? I realize the Tree feature some might find interesting, but I think that is similar to setting up folders in the OBS Explorer. The Explorer might not be as clean as using the Tree but it effectively accomplishes the same thing I believe. Having notes inside the Dendron vault seems a little messy with the admin files in there such as .vscode root assets json yml and maybe one or two more I don’t think these can be moved elsewhere? I don’t know Dendron well but I suspect anything else it can do can also be accomplished using a blank workspace with a few extensions without having to fool around with the Dendron vault. I am not making a case for or against Dendron just understanding why someone would want to incorporate OBS with another program that does essentially the same thing and less. I myself use VSC with a few extensions to simplify editing and navigating where OBS might be a little clumsy so it makes OBS more appealing to me. So what benefit would be gained by opening OBS in a Dendron vault and merging two programs?

1 Like

I gave integration Dendron a shot (not being a Dendron user), and I found the Note.Subnote naming too restrictive. I like the more free-form folder names in Obsidian. I suspect there won’t be any users who go back and forth between the two apps.

1 Like

Just out of interest, which VSC extensions do you use for that?

1 Like

Not clear on the question, you mean which vsc extensions I enable when working with the obs files? I just want to be clear I do not use vsc to do something obs is not capable of or even does better for that matter it is all relative, I use is because it is lighter and more intuitive for those of use that have a short fuse on our learning curve it just makes the obs interfce less painful to work with at my current level.

Extensions I use are the basic; 1. Markdown All in One 2. Markdown Memo. 3. MarkDown Link Suggestions 4. Markdown Preview Enhanced. I also don’t use the vsc plugin I just open vsc and created an obs workspace and added the vault folder. Using this method all changes made on either side are instant vs when launched from the vsc plugin inside of obs. When using the plugin I believe the files need to be saved in vsc for changes to reflect in obs, at least that was my experience when I first started using the plugin, not sure that is the way it is supposed to work or maybe I was doing something wrong but my changes were not instant using the plugin method.

Off topic but related; I would like to see obs ditch the electron platform. Trying to navigate around electron reminds me of working on a virtual desktop with a server located on the other side of the world. Factor in the learning curve for MD language and endless plugins and ongoing platform updates and it ends up being a perfect storm for giving up on the app. So the vsc option allows for simplification for me at least.

1 Like

@anon93829851 many thanks for your detailed answer, that is what I wanted to understand from you. It is clear. Many thanks for that.

As for Electron, I cannot really comment. Virtually all the comments I have ever seen about it are negative: cumbersome, slow, plus more ……

In my very modest opinion Licat has done a sterling job with Electron by demonstrating that it does not feel like a, let’s say awkward app at all; for those apps that make it seem awkward is because the dev does not know Electron sufficiently.

Personally I don’t think Licat will drop Electron simply because it is THE most appropriate way to simultaneously handle different platforms, as I understand it.

The problem with Dendron is that it has an extremely rigid regulatory framework for its use to remain operational. This makes it difficult or even impossible to integrate it with other markdown tools such as Obsidian. The future is in the integration of markdown tools and not in super-differentiation. Many will ask, why do I want to integrate two tools that do basically the same thing? Why would you want to use Obsidian and let’s say Roam Research at the same time? The future of markdown is working in collaborative Second Brains while preserving the personal layer and if there is no integration the possibility of collaboration is greatly reduced. Hopefully the developer comes across this comment.