NomarCub / obsidian-open-vscode

Open vault in VSCode button for Obsidian.md
MIT License
97 stars 5 forks source link

Feature Request: Add "Open in VS Code" to folder context menu #14

Open quinn-p-mchugh opened 11 hours ago

quinn-p-mchugh commented 11 hours ago

Hi there,

I'd like to request a small quality of life improvement to make it easier to open folders in VS Code:

Existing Workaround

As discussed in #8, users can configure this plugin to open a specific folder in VS Code by:

  1. Navigating to the plugin's settings page.
  2. Updating the Template for executing the "code" command setting to code "{{vaultpath}}/{{folderpath}}".
  3. Opening a file in Obsidian that is in the top-level directory of the desire folder.
  4. Clicking the VSCode command button on the left sidebar.

Proposed Enhancement

The goal of this enhancement would be to reduce the number of steps it takes to open a folder in VSCode from Obsidian.

To achieve this, I propose adding a new context menu item called Open in VS Code, displayed when the user right-clicks a folder in the Obsidian file explorer. Clicking this menu item would open the selected folder in VS Code.

The new workflow would be as follows:

  1. Navigate to the desired folder in the Obsidian file explorer.
  2. Right-click the folder.
  3. Select "Open in VS Code" in the folder context menu. image

To accommodate user preferences, the plugin should provide the ability to enable/disable this context menu item via the plugin settings.

Rationale

My Obsidian vault contains several Git repositories that I frequently need to open in VS Code to make edits and commit changes. This enhancement would make it easier to open these repositories without needing to navigate to specific files within them.

Thanks for the consideration!

NomarCub commented 11 hours ago

Hi! I like the idea. Unfortunately I probably won't have the time to work on it until december. But I'll accept PRs if someone wants to implement it before then.

quinn-p-mchugh commented 11 hours ago

Hi @NomarCub,

Thanks for the approval!

I may give this a try, but like you, I probably won't be able to prioritize this until December/January. I'll keep you posted.

NomarCub commented 10 minutes ago

This plugin has a Create Code File context menu item in the file explorer, that might be a good start: https://github.com/sunxvming/obsidian-vscode-editor.

And now that I look at it, you also have some items in your screenshot that are from plugins, @quinn-p-mchugh. What are those from, above Rename...?