Open in Visual Studio Code on macOS

Open in Visual Studio Code on macOS using Automator.

1. Open Automator
2. Choose a new Quick Action

Open in Visual Studio Code on macOS

3. Search for the Run Shell Script action

Open in Visual Studio Code on macOS

4. Configure the command with the following settings

  • Workflow receives current: files or folders
  • In: Finder
  • Image (Optional): I used this image
  • Pass Input: as arguments
  • Command: open -n -b “com.microsoft.VSCode” –args “$1”

Open in Visual Studio Code on macOS

5. Save your new quick action and name it something like Open with Visual Studio Code
6. Open Finder
7. Choose a folder you want to open with Visual Studio Code
8. Double-tap or right-click depending on your input device
9. Choose Open with Visual Studio Code
10. Tada!




Visual Studio Code and opening a file by file type

Visual Studio Code

Visual Studio Code and open the program that is associated with the file’s extension. This article covers both Mac and Windows.

Mac

  1. CMD-Shift-P
  2. Tasks: Configure Task
  3. Add this JSON to the task

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Open file",
            "type": "shell",
            "command": "open",
            "args": ["${file}"]
        }
    ]
}

Windows

  1. Ctrl-Shift-P or F1
  2. Tasks: Configure Task
  3. Add this JSON to the task file

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Open file",
            "type": "shell",
            "command": "explorer.exe",
            "args": ["${file}"]
        }
    ]
}