I would have expected to be able to use just code -n "$*", but for some reason, the PATH used by the automator's shell seems to be different from that used in the terminal. Paste this code in the shell command field /usr/local/bin/code -n "$*" or replace with your path to the code executable if it differs from this one.(drag and drop the "Run Shell Script" object) Add a new Run Shell Script action to the workflow.Workflow receives current files and folders from Finder.You should get the code executable path looking somethin like /usr/local/bin/code Provided that you have the code CLI command installed (if not, go to VS Code and do CMD+SHIT+P>"Shell Command: install 'code' in PATH") If VS Code is already running it just switches the focus to a running instance of VS Code. Indeed the accepted solution by just opens VS Code for me, but not the desired folder. Here is an alternative derived from the accepted answer. Make sure your Shortcut’s Name is selected. First open the Sublime Or VS Code, then use the File -> Open menu Right click to use Services (in case you have services setup) Click on the toolbar icon to.Open a new ‘Finder’ Instance, right-click on a folder, go to ‘Quick Actions’ > ‘Customize.’.Be sure to set a cool name for your new Shortcut! I named mine a boring “Open in VSCode”.Set ‘Pass Input:’ option to ‘as arguments’.A pop must appear, choose ‘File Path’ and just click anywhere else. Click on the ‘Shortcut Input’ tag that appears.In the newly added action called ‘Run Shell Script’ write “code “ and right-click to get the below pop-up, go ahead ‘Insert variable’ and then ‘Shortcut Input’. ![]() In the shortcut details (on the right pane), make sure Use as Quick Action is ticked and so are ‘Finder’ and ‘Service Menu’.This will add the action to the Shortcut’s flow. Drag and drop the ‘Run Shell Script’ onto the main pane. Click on ‘Action Library’ on the right pane and search for ‘shell’. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |