xed is XCode's official command-line invocation tool. One would expect it to work perfectly.

Unfortunately, even when xed is used in its simplest form, XCode currently happens to stall for a couple seconds or even crash when a file is opened.

This is obviously an XCode bug, as the issue also arises when AppleScript is used to tell XCode to open the file.

Thankfully, there is a very efficient workaround which consists in using the open command to first open the file, then AppleScript to jump to the specific line number.

Here are the instructions to follow.

  • Save this gist into some xed.sh file and chmod +x.

  • In CodeStory preferences, create a custom editor like this:

    Custom settings in preferences

Hyperclick on Live Code View tokens

As you may know, the beauty of Live Code Views is that they work both ways.

All IDEs have APIs that allowed us to provide extensions that support Live Code View tokens highlighting and hyperclick to reveal related notes in CodeStory.

Currently, XCode Extensions APIs are unfortunately too limited to provide such functionality.

But we came up with a very acceptable workaround!

CodeStory implements a custom URL scheme which can be used in addition to the command line invocation.

XCode comments support URL syntax highlighting and hyperclick, but not for any scheme. It turns out that the cid:// url scheme is supported, although it is to our knowledge never used at system level, as it is used to reference internal content in electronic mails.

CodeStory now registers cid:// urls scheme (along with codestory://) and implements a special usage.

XCode screenshot. Command-click on cid:// links to open the token in CodeStory!