I have output in my iTerm that is like:
File project/path/path/file.py:56:54 extra text information
How can I open this file in IntelliJ with a single click?
IntelliJ has a command line features that you can check out here:
https://www.jetbrains.com/help/idea/2024.1/working-with-the-ide-features-from-command-line.html
iTerm as well enable launch a command line order when we use cmd and click
over a file path pattern.
You only have to go to iTerm Preferences, Profiles, Advanced, Semantic History
In Semantic History check "Run Comand.." and add as a command:
/Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea --line \2 \1
IntelliJ has to be in the current project. You can enforce a project:
/Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea <project_path> --line \2 \1
or event use \5
as a project path, \5
is a pwd in the current terminal directory.
I had better results with the first configuration.
Note: with IntelliJ Idea 2019.1 i used: /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea --line \2 \1
I move to pycharm, and I am currently using this line:
/Applications/PyCharm.app/Contents/MacOS/pycharm --line \2 \1
UPDATE
Several people in the comments and other responses have suggested using --line \2 \1
instead of \1 --line \2
. So, I've updated this in the answer in several places.