“code .” Not working in Command Line for Visual Studio Code on OSX/Mac

前端 未结 25 2399
日久生厌
日久生厌 2020-12-12 09:13

The command \"code .\" doesn\'t work in this manual?

All the other steps before that worked. How can I call the Visual Studio Code in OSX terminal?

         


        
25条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 09:33

    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.

提交回复
热议问题