Alternative to commandline Solution:
Recently I was playing with Services in Mac OS X. I added a service to a folder or file so that I can open that folder or file in Visual Studio Code. I think this could be an alternative to using 'code .' command if you are using the Finder app.
Here are the steps:
- Open Automator App from Application. (Or you can use Spotlight).
- Click on 'New Document' button to create a new script.
- Choose 'Service' as a new type of document.
- Select 'files and folders' in 'Service receives selected' dropdown.
- Search for 'Open Finder Items' action item.
- Drag that action item to the workflow area.
- Select 'Visual Studio Code.app' application in the action 'Open with' dropdown.
- Press 'command + s' to save the service. It will ask a name of service. Give it a name. I gave 'Open with VSCode'. Close the Automator app. Check the image below for more information.
Verify:
- Open the Finder app.
- Right-click on any folder.
- In the context menu, look for 'Open with VSCode' menu option.
- Click on the 'Open with VSCode' menu option.
- The folder should get open in the Visual Studio Code application. Check image below for more info.