Hello,
Since Finder is obviously developed by Apple, I'm not sure if this would be possible or not. Is there any way to right-click a folder in Finder, and "open with VS Code?" You can do this with individual files, but it would be a nice, small workflow enhancement to be able to open a _folder_ with VS Code, directly from Finder, as well. If not, no big deal. This would be a fault with Finder, rather than VS Code.
Here's a screenshot of right-clicking a folder ... there's no "Open With" option. Maybe the Share option could work somehow?
Cheers,
Trevor Sullivan
Microsoft MVP: PowerShell
You can open a folder by drag-and-dropping it on the VSCode icon on the dock. I personally don't like apps that clutter the right click menu.
@joaomoreno fyi.
I love @takumif's suggestion, this is also our recommendation.
I am from windows environment and VS Code provides the same option there. I do not know why the hell it is doing discrimination with osx and not providing the same here.
it is not impossible and we need it
Simply because this is not common behaviour in OS X.
You are free to create a global Service which does this for you.
I work in both Windows and OSX (often on the same project), and I would also like to have this behavior.
Just like some people don't like apps cluttering up the right click menu, I don't like apps cluttering up my dock (which does not include VS Code right now).
It is pretty easy to disable the shortcut in the Keyboard preferences, so I do not see a lot of negative impact to having it.
Sure, we could totally create a global Service... but why don't we have it built-in? Quite a reasonable request, Atlassian Source Tree did it :D You can't really describe it as uncommon behavior
I mean, I've done it in like 3 minutes. Why can't you guys at Microsoft do it out-of-the-box to provide a better user experience?
Write some scripts that create a global service for us!
P/s: Can't really say that it cluster the right-click menu as it is grouped under service tab.
@rocketspacer Care to contribute a PR which adds a Service?
I know it's not nice to just ask you to do stuffs but I'm not really doing desktop development or electron. :D I've done some research and found some leads on how to do it in Objective-C, doesn't sure how it works in electron though
http://stackoverflow.com/questions/3732142/writing-a-snow-leopard-service-for-finder-app
I've confirmed that Atlassian wrote Source Tree natively for each OS (C# for Windows, Objective-C for OSX)
I made the service myself in 2 minutes. It seems like all we need is to, is add a prebuilt .workflow folder with files to the ~/Library/Services/
folder, and we should be good to go.
However, I'm not sure how to achieve this automatically when installing VS Code. Maybe we can create a command, that the users can choose to run at any time if they like? Or we can run it on firstRun of VS Code.
any thoughts @joaomoreno ?
Having a command in the Command Palette which installs this for the user would be nice.
Okay, I'll try to start work on it soon.
Or we can run it on firstRun of VS Code.
If it only does this on the first run, users who already have VS Code installed would have to know both, that the option exists, and how to get the command onto the command palette. To be honest most of us deal with so many updates, we probably aren't paying very close attention to the release notes. So I might suggest that if we have to manually do something to enable this, that there is some thought into making sure we know the feature is there and what to do.
So I might suggest that if we have to manually do something to enable this, that there is some thought into making sure we know the feature is there and what to do.
We could create a dialog with something like "would you like to enable the 'Open in VSCode' context menu?", and save wether or not the user has been presented with this dialog before. Then, on new installs, the dialog would appear on firstRun, because the user has never seen it. And users that update would see it once when they have updated, because they have never seen it before either.
I would need some guidance though, on how and where to save this macOSContextHasPrompted
state. I can only think of doing it like a userSetting, but that would be a really bad idea for multiple reasons. There must be some way to internally save stuff like this.
+1 for the feature :)
I can't seem to find the time to implement this, so if anyone wants to give it a try, please do. All that have to be done is to copy the content of
this zip file into the folder: ~/Library/Services
(the zip-file contains a folder called Open in VS Code.workflow
@JReinhold It works.
I have found this app that really helps with this issue
@thewinger freaking awesome <3 this is exactly what we needed, if only Microsoft gave more crap about MacOS users instead of having @joaomoreno 's attitude to us, it would be a better place.
Just made one and will pull a request some day... after my exams
@csujedihy @thewinger @jd-carroll @sebolio Just build one tested on 10.13, have a try.
Will eliminate several bugs after exams. Just drag it to Application folder and check it in the Preference Panel.
SzContext.app.zip
@RoadToDream - Can you send a link to the source for this / future PR? I would be interested in seeing how this all works
(Good luck on your exams)
Will open a repo but after made it a more versatile and complete project.
Any updates on this one?
I found this github repo:
https://github.com/Sankra/OpenFolderInVSCode
@lukehoban So maybe have a try of mine.
The Quick Actions context menu workflow is just "Run Shell Script" receiving "files or folders" in "Finder":
exec /bin/bash --login -c 'for f in "$@"; do /usr/local/bin/code "$f"; done' dummy.sh "$@"
Note you must start bash
in login
mode so that the newly launched Code process gets the correct environment variable, because Automator's shell script doesn't get the desired PATH
. I'm no expert in creating installation program for VS Code that installs this. Help yourself.
Note A caveat is that the option doesn't appear when you open the context menu on the background of (blank space inside) a folder. It seems to me that OneDrive is able to add items to that context menu, consult them to find out how to add "Open with Code" there -- I don't think you can drag & drop the background of a folder (nor the folder's tab) to the Code icon.
I can't seem to find the time to implement this, so if anyone wants to give it a try, please do. All that have to be done is to copy the content of
this zip file into the folder:~/Library/Services
(the zip-file contains a folder calledOpen in VS Code.workflow
Thanks a lot, it's worked for me
I can't seem to find the time to implement this, so if anyone wants to give it a try, please do. All that have to be done is to copy the content of
this zip file into the folder:~/Library/Services
(the zip-file contains a folder calledOpen in VS Code.workflow
Thanks a lot, it works on my macOS
Just made one and will pull a request some day... after my exams
@RoadToDream That's what I want it, really I love it, there has been a long time if you're here, is it possible to share the link?
I always show making as services, but I want to do like your style.
Most helpful comment
You can open a folder by drag-and-dropping it on the VSCode icon on the dock. I personally don't like apps that clutter the right click menu.