Posted at


More than 1 year has passed since last update.


まずAppCodeのメニューTools->Create Command-line Launcher…でコマンドを作成します。


tell application "Xcode"

set projectPath to path of active workspace document
set projectFolder to characters 1 thru -((offset of "/" in (reverse of items of projectPath as string)) + 1) of projectPath as string

set currentDocument to document 1 whose name ends with (word -1 of (get name of window 1))
set filePath to path of currentDocument

set range to selected paragraph range of currentDocument
set lineNumber to item 1 of range

do shell script "/usr/local/bin/appcode " & projectFolder & " " & filePath & ":" & lineNumber
end tell