Reputation: 340118
IntelliJ IDEA 2020 can (finally!) simply open a file to be edited, without a project being involved. This is called LightEdit mode.
At this point in a JetBrains video, we see the host platform's file manager app opening a file via IntelliJ while noting that all such files should be opened using that same tool.
The problem for me is that I am a happy user of JetBrains Toolbox app to automatically install, upgrade, and open IntelliJ. So in my "Applications" folder on macOS, I have no "IntelliJ" application to choose in the Mac Finder when trying to open a file.
Is there some other way or trick to getting the Finder to know to open files with IntelliJ? And preferably with the latest version, as I believe Toolbox may keep around the older versions.
Basically, I am asking the same as this Question, How to make available “open this project in IntelliJ IDEA” option in Windows context menu, if IntelliJ IDEA has been installed via JetBrains Toolbox?, but for macOS instead of MS Windows. The Answer on that other Question is Windows-specific.
Upvotes: 11
Views: 1201
Reputation: 622
Use the app's menu: IntelliJ IDEA -> Preferences -> Editor -> File Types
Then press the Associate File Types with IntelliJ IDEA
button.
A window will open with file groups you could choose from, and then press the OK button, then Apply and another OK.
After this, a MacOS restart is required.
Upvotes: 6
Reputation: 47648
As a Toolbox user you still have access to the "generated shell scripts" (/usr/local/bin/idea
, or things like /usr/local/bin/phpstorm
, /usr/local/bin/pycharm
, etc for individual applications).
But, these are shell scripts, and cannot be used for this because they lack the application identifiers needed by the OS for launching apps.
What you can do is wrap any of this with an Automator application. By wrapping the shell script directly, it should remain updated (since the shell script is itself a Toolbox generated wrapper that points to the latest installed version).
To do so:
phpstorm
with idea
or whatever IDE you have installed):
for file in "$@"
do
/usr/local/bin/phpstorm -e "$file"
done
Once that one is saved, you'll be able to use it to launch files from Finder, or even set it as default for a file type:
Upvotes: 6