NomarCub / obsidian-open-vscode

Open vault in VSCode button for Obsidian.md
MIT License
99 stars 6 forks source link

Move `open-in-vscode-via-url` to a separate command #6

Closed ptim closed 2 years ago

ptim commented 2 years ago

Follow-up to https://github.com/NomarCub/obsidian-open-vscode/pull/5

Hi @NomarCub ! Many apologies for the very slow reply...

The changes somehow appear more sweeping than I originally intended, but I think it's for the best - the commits are granular, so if anything rubs you up the wrong way (eg - hope you don't mind the dev helpers), let me know and I can adjust / remove!

I'm not sure why this PR is "Can't automatically merge".. it merged cleanly on my fork...

I tried to make some modifications before merging, but fucked something up, so I merged anyway. Do you mind opening another PR with some adjustments?

On Windows, due to the dialog that comes up with URL, the second window.open never manifests. This also means that you can't specify to not open the file currently active in Obsidian.

Aha - I don't have a windows machine to test on, but I would have thought that this might cause a failure on the first invocation, but would work on subsequent invocations after the user had satisfied the dialog... Are you finding that you have to address a dialog every time?

I've made a toggle for "Open file", so users should be able to find a config that works well for them.

For me it'd make sense if the useWorkspace was a checkable setting, transparent to the user.

Gotcha... as I was reviewing this, I thought it was cleaner to have two separate commands; in this way it's transparent to the user in that they can set shortcuts as desired 👍

For me, it's as simple as 'set my keyboard command to open-in-vscode-via-url', then the defaults are good. Changes I made to CLI command have been reverted, and it remains bound to the Button (this could be a setting if you think it's important).

It'd also be nice if you could use the {{}} variables in the the URL workspace path setting.

Done! (for {{vaultpath}} - the URL protocol is not as flexible as the CLI, so filepath doesn't make sense in this context, I think, as we have a toggle for this purpose)

Hope that helps - let me know what you think, Tim

screenshot - 2022-06-21 - test vault - Obsidian v0 15 2 - 2022-06-21 at 21 48

ptim commented 2 years ago

Doh.. must have had some faulty config in my git client - just couldn't see your most recent changes for some reason! Cherrypicked branch over here: https://github.com/NomarCub/obsidian-open-vscode/pull/7