-
-
Notifications
You must be signed in to change notification settings - Fork 6
Add "Open with VS Code" option to file/folder context menu #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Open with VS Code" option to file/folder context menu #15
Conversation
Hey @quinn-p-mchugh! |
@quinn-p-mchugh I'll merge this in a week, with some modification to your code and a logo change. If you have anything you want to change you have until then, or you can do it in a new PR later. |
Hi @NomarCub, thanks for your patience here. I just tested the changes in a basic Obsidian vault and everything works great. Please feel free to merge when you get the chance. Also, thanks for refactoring and fixing the menu item icon. Adding a file input parameter that defaults to the active file makes the code much more readable. |
Just made a release with this in https://github.com/NomarCub/obsidian-open-vscode/releases/tag/1.3.0, thank you for your contribution! |
@NomarCub Looking forward to taking advantage of this small but handy feature. |
This pull request is to satisfy feature request #14 (Add "Open in VS Code" to folder context menu).
New Behavior
Template for executing the "code" command
){{filepath}}
and{{folderpath}}
variables used in the above setting with the path of the selected file/folder.Code Changes
fileMenuHandler
to add the new context menu item when the user right-clicks a file/folder.openVSCode
function with a new input parameter calledfileContextMenuPath
(the path of the file/folder that was right-clicked).openVSCode
function to set thefilePath
andfolderPath
variables to thefileContextMenuPath
variable instead of the path/folder of the currently open file.Future Work
openVSCode
function and relies on the same CLI command (Template for executing the "code" command
) used by the existing "VSCode" command button, this update might result in some confusion for users looking to achieve different behavior when opening VS Code using the "VSCode" command button v.s. the file/folder context menu item.Template for executing the
code` setting into two: one that is evoked when clicking the VS Code command button and the other that is evoked when clicking the file/folder context menu item.