Skip to content

Commit

Permalink
post pull request fixes after #7, bump version to 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NomarCub committed Jun 24, 2022
1 parent efb00c1 commit 04f53b1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 36 deletions.
38 changes: 18 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

This plugin for [Obsidian](https://obsidian.md/) makes a ribbon button and two commands to open your vault as a Visual Studio Code workspace:

- `open-vscode`: Uses `child_process` to launch VSCode with the `code` command. Currently, this is the command bound to the ribbon button.
- `open-vscode-via-url`: Open VSCode using a `vscode://` URL _(Windows users, please see [notes regarding the UX of this command](#caveats-regarding-the-url-command-for-windows-users))_
- `open-vscode`: Uses `child_process` to launch VSCode with the `code` command. Currently, this is the command bound to the ribbon button.
- `open-vscode-via-url`: Open VSCode using a `vscode://` URL *(Windows users, please see [notes regarding the UX of this command](#caveats-regarding-the-url-command-for-windows-users))*

It's functionality is probably made redundant now using the [Shell commands](https://github.com/Taitava/obsidian-shellcommands) and [Customizable Sidebar](https://github.com/phibr0/obsidian-customizable-sidebar) (or [Buttons](https://github.com/shabegom/buttons)) plugins, but it'll be maintained for the foreseeable future.

Expand All @@ -20,8 +20,8 @@ You can also use it as a command and assign hotkeys to it. You can disable the r

## Settings

- **Display Ribbon Icon**
- **Ribbon opens via `code`** (can alteratively open via URL method)
- **Display Ribbon Icon**
- **Ribbon opens via `code`** (can alteratively open via URL method)

### Template for executing the `code` command

Expand All @@ -36,34 +36,32 @@ The default template is `code "{{vaultpath}}" "{{vaultpath}}/{{filepath}}"`, whi

On some systems, this may be faster than using the `child_process` approach.

- **Open file**
- **Open file**

Open the current file rather than the root of the Obsidian vault.
Open the current file rather than the root of the Obsidian vault.

- **Path to VSCode Workspace**
- **Path to VSCode Workspace**

Defaults to the {{vaultpath}} template variable. You can set this to an absolute
path to a ".code-workspace" file if you prefer to use a Multi Root workspace
file: https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces
Defaults to the {{vaultpath}} template variable. You can set this to an absolute path to a ".code-workspace" file if you prefer to use a [Multi Root workspace file](https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces)

- **Open VSCode using a `vscode-insiders://` URL**
- **Open VSCode using a `vscode-insiders://` URL**

The first time you use the URL method for opening, VSCode displays a confirmation dialog (that you just can hit enter on) for security reasons. See [this issue](https://github.com/microsoft/vscode/issues/95670) for more infomation.

### Caveats regarding the URL command for Windows users

TLDR; We recommend that Windows users prefer the `open-via-code` command.
TLDR; We recommend that Windows users prefer the `open-vscode` command (and not the URL one).

Due to security updates in VSCode, the user experience of using opening VSCode via URL comes with some known issues!

On Windows, when opening via URL, you are prompted to allow VSCode to access the file. At present there's no option in VSCode to whitelist safe locations (ie your Obsidian vault), so you get this dialog every time ☹️.

Worse, if you are opening via URL, _and_ have toggled the "Open File" setting on, then VSCode will attempt to open a _second_ instance of VSCode, and will warn that there's another instance of Code running but not responding.
Worse, if you are opening via URL, *and* have toggled the "Open File" setting on, then VSCode will attempt to open a *second* instance of VSCode, and will warn that there's another instance of Code running but not responding.

If this issue affects you, please consider watching and voting for the following VSCode issues:

- [Prompt users when opening vscode://file/... URIs · Issue #95252 · microsoft/vscode](https://github.com/microsoft/vscode/issues/95252)
- [URL protocol: confirmation dialog · Issue #95670 · microsoft/vscode](https://github.com/microsoft/vscode/issues/95670)
- [Prompt users when opening vscode://file/... URIs · Issue #95252 · microsoft/vscode](https://github.com/microsoft/vscode/issues/95252)
- [URL protocol: confirmation dialog · Issue #95670 · microsoft/vscode](https://github.com/microsoft/vscode/issues/95670)

## Installation

Expand All @@ -82,11 +80,11 @@ and DX commands to refresh settings are activated.

## Credits

Toggle ribbon setting by [@ozntel](https://github.com/ozntel).
Original plugin by [NomarCub](https://github.com/NomarCub)
If you like this plugin you can support me on PayPal here: [![Paypal](https://img.shields.io/badge/paypal-nomarcub-yellow?style=social&logo=paypal)](https://paypal.me/nomarcub)

[Toggle ribbon setting](https://github.com/NomarCub/obsidian-open-vscode/pull/1) by [ozntel](https://github.com/ozntel).
[UseURL: open file in workspace](https://github.com/NomarCub/obsidian-open-vscode/pull/5) [feature](https://github.com/NomarCub/obsidian-open-vscode/pull/7) and resturcture by [ptim](https://github.com/ptim)

Thank you to the makers of the [DEVONlink](https://github.com/ryanjamurphy/DEVONlink-obsidian) plugin, as it was a great starting point for working with ribbon icons in Obsidian.
The icon is from [icon-icons.com](https://icon-icons.com/icon/visual-studio-code-logo/144754) and was resized with [iLoveIMG](https://www.iloveimg.com/resize-image/resize-svg).

## Support

If you like this plugin you can support me on PayPal here: [![Paypal](https://img.shields.io/badge/paypal-nomarcub-yellow?style=social&logo=paypal)](https://paypal.me/nomarcub)
20 changes: 10 additions & 10 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"id": "open-vscode",
"name": "Open vault in VSCode",
"version": "1.1.3",
"minAppVersion": "0.14.8",
"description": "Ribbon button and command to open vault as a Visual Studio Code workspace",
"author": "NomarCub",
"authorUrl": "https://github.com/NomarCub",
"isDesktopOnly": true
}
{
"id": "open-vscode",
"name": "Open vault in VSCode",
"version": "1.2.0",
"minAppVersion": "0.14.8",
"description": "Ribbon button and command to open vault as a Visual Studio Code workspace",
"author": "NomarCub",
"authorUrl": "https://github.com/NomarCub",
"isDesktopOnly": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open-vscode",
"version": "1.1.3",
"version": "1.2.0",
"description": "Open vault in Visual Studio Code ribbon button and command for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ addIcon('vscode-logo', svg);

type AppWithPlugins = App & {
plugins: {
disablePlugin: (id: string) => {};
enablePlugin: (id: string) => {};
disablePlugin: (id: string) => unknown;
enablePlugin: (id: string) => unknown;
enabledPlugins: Set<string>;
plugins: Record<string, any>;
};
Expand Down
7 changes: 4 additions & 3 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"1.0.0": "0.11.13"
}
{
"1.0.0": "0.11.13",
"1.2.0": "0.14.8"
}

0 comments on commit 04f53b1

Please sign in to comment.