Skip to content

Instantly share code, notes, and snippets.

@danydodson
Last active November 15, 2022 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danydodson/3162b6afa73d2efdc03efec90b4c338b to your computer and use it in GitHub Desktop.
Save danydodson/3162b6afa73d2efdc03efec90b4c338b to your computer and use it in GitHub Desktop.
vscode quick action

Open in Visual Studio Code

  • Open Automator
  • Quick Action
  • Set "Service receives selected" to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to the following
    for f in "$@"; do
      open -a 'Visual Studio Code' "$@"
    done
  • Set "Pass input" to as arguments
  • Save as Open in VSCode

Keyboard Shortcuts

You can assign a global shortcut to run the services we just created

  • Open "System Preferences"
  • Select "Keyboard" then the "Shortcuts" tab
  • In the left pane, click on "Services"
  • In the right pane, scroll to "Files and Folders"
  • Select "Open in Visual Studio Code" click "add shortcut"
  • Select a shortcut

Edit Context Menu items

You might want to rename or edit the items we just created

  • Activate Finder
  • Click on "Finder" in the Apple menu, select "Services" then "Services Preferences"
  • In the right pane, scroll to "Files and Folders" and scroll to the item you want to edit
  • Right click the item and select "Open in Visual Studio Code"
  • Edit and save

Alternatively, you can edit the workflow (e.g. ~/Library/Services/Open in VSCode.workflow) in your preferred text editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment