Open a folder in vscode through Finder in macOS?

If you want to do it in Finder, you can write an Automator script to do it (it's easier than it sounds, AND shows you the power of the OS).

  1. Launch Automator

  2. Create New Document

  3. Create a new Quick Action Select "Quick Action"

  4. Add the Action...

    • Workflow receives current files or folders from Finder.
    • Add a new Run Shell Script action to the workflow. (drag the "Run Shell Script" object, highlighted in the screenshot, to the empty window on the right)
  5. Configure the Workflow

    • Set the Pass Input to be as arguments
    • Paste the following in the input box:
    open -n -b "com.microsoft.VSCode" --args "$*" 
    

    Screenshot of Workflow

  6. Save the action using a name like Open in Visual Studio Code.

You may now right-click on the folder and find your newly created task under Quick Actions.

enter image description here


Well you need to understand. macOS has different ways to do things than windows and initially it might be a challenge. For starters you start to make use of Terminal. its beautiful.

Now answering your question.

Open your VS code and then, press CMD + SHIFT + P, type shell command and select Install code command in path. Afterwards, navigate to any project from the terminal and type code . from the directory to launch the project using VS Code.


The simplest solution is to create a Quick Action with Open Finder Items: This way you don't need a shell script that might break with an OS update or VS Code update

  1. Launch Automator and select Quick Action or File > New > Quick Action If Automator is already open.

Quick Action

  1. Set Quick Action receives selected to files or folders and in to Finder. Files and Folders

  2. Choose an Image (icon) select Choose.. and double click Visual Studio Code in the window that pops up, this will set your quick action icon to the same as VS Code

  3. Add Open Finder Items, Choose open with as Other.. select Visual Studio Code and save your Quick Action as Open in VSCode optionally choose an Image for your Quick Action job done.

Choose VS Code as the app to open