I tried to integrate Goland with Hook and found that the current IntelliJ IDEA integration is not ideal.
Current Goland/IDEA supports internal jetbrains://
links to project, file in the project, and cursor position.
I created a script for creating a link and getting a nice name.
Get link
This script creates a link to the whole project because the link to the cursor position or file is pretty unuseful. It can be easily updated to get a link to file instead.
Preparation
You need to setup a keyboard shortcut for āCopy pathā¦Toolbox URLā from keymap settings. In my case its āā§ā„ā+Š”, if you choose differently ā youāll need to update the script.
Also, for IDEA/rubymine/pycharm users - you need to update application id from com.jetbrains.goland
to id of your app. You can find this ID by passing to console osascript -e 'id of app "Goland"'
Script
set the clipboard to ""
tell application id "com.jetbrains.goland"
activate
end tell
tell application "System Events"
keystroke "c" using {shift down, command down, option down, control down}
delay 0.1
set fp to the clipboard
end tell
set AppleScript's text item delimiters to ":"
set theTextItems to every text item of fp
set result to (text items 1 thru ((length of theTextItems) - 2) of theTextItems as string)
get result
Get pretty name
The same thing, donāt forget about the custom shortcut.
set the clipboard to ""
tell application id "com.jetbrains.goland"
activate
end tell
tell application "System Events"
keystroke "c" using {shift down, command down, option down, control down}
delay 0.1
set fp to the clipboard
end tell
set AppleScript's text item delimiters to "project="
set parsePjName1 to text item 2 of (every text item of fp)
set AppleScript's text item delimiters to "&"
set result to text items 1 thru ((length of every text item of parsePjName1) - 1) of parsePjName1
get result as string
I assume that the first script may need to be updated to create a link based on project name, but on another side, some of you may want to have a link to the specific file, instead of the link to the project, so I decided to leave the first version of the script as more hackable option.