├── demo.gif ├── Open in VS Code.app.zip └── README.md /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamxiaoz/open-folder-with-vs-code/HEAD/demo.gif -------------------------------------------------------------------------------- /Open in VS Code.app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamxiaoz/open-folder-with-vs-code/HEAD/Open in VS Code.app.zip -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # open-folder-with-vs-code 2 | A Finder toolbar icon to open current selected file/folder with VS Code. 3 | 4 | ![](/demo.gif) 5 | 6 | ## How to use? 7 | - Download [the zip file](https://github.com/hamxiaoz/open-folder-with-vs-code/raw/master/Open%20in%20VS%20Code.app.zip) 8 | - Unzip to Applications folder (or any folder that you won't mistakenly delete the app) 9 | - Right-click to open to pass the Mac security check 10 | - **if you cannot open**, try this: (thanks [@d0972058277](https://github.com/d0972058277) and [@ksmarty](https://github.com/ksmarty)) 11 | ``` 12 | cd Downloads/Open\ in\ VS\ Code.app/Contents/MacOS/ 13 | chmod +x droplet 14 | ``` 15 | - Hold `Option+CMD` and drag the application to toolbar 16 | - **Mojave users**: to disable the system warning "Allowing control will provide access to documents and data..." when using the app, [add the application in preferences -> security and privacy -> privacy -> accessibility](https://apple.stackexchange.com/a/335850) 17 | - Enjoy 18 | 19 | ## How to create the app manually? 20 | Open AppleScript Editor, copy the following source and export as Application. 21 | 22 | ``` 23 | (* 24 | Open in VS Code 25 | To use: 26 | * Drag Open In VS Code to the toolbar of any finder 27 | window to add it to the toolbar 28 | *) 29 | 30 | on run 31 | tell application "Finder" 32 | if selection is {} then 33 | set finderSelection to folder of the front window as string 34 | else 35 | set finderSelection to selection as alias list 36 | end if 37 | end tell 38 | 39 | subl(finderSelection) 40 | end run 41 | 42 | -- script was drag-and-dropped onto 43 | on open (theList) 44 | subl(theList) 45 | end open 46 | 47 | -- open in Visual Studio Code 48 | on subl(listOfAliases) 49 | tell application "Visual Studio Code" 50 | activate 51 | open listOfAliases 52 | end tell 53 | end subl 54 | ``` 55 | 56 | ## Looking the same thing for Sublime? 57 | Please see this repo [open-folder-with-sublime](https://github.com/hamxiaoz/open-folder-with-sublime) 58 | 59 | ## Credits 60 | 61 | Thanks for the following github users for feedback & suggestion: 62 | 63 | - [@d0972058277](https://github.com/d0972058277) 64 | - [@ksmarty](https://github.com/ksmarty) 65 | - [@aravind-murthy](https://github.com/aravind-murthy) 66 | 67 | For icons, you can find them here: 68 | - https://icons8.com/icons/set/visual-studio-code 69 | --------------------------------------------------------------------------------