Code Monkey home page Code Monkey logo

sourcekitten's Introduction

SourceKitten

An adorable little framework and command line tool for interacting with SourceKit.

SourceKitten links and communicates with sourcekitd.framework to parse the Swift AST, extract comment docs for Swift or Objective-C projects, get syntax data for a Swift file and lots more!

SwiftPM

Installation

Building SourceKitten requires Xcode 13.3 or later or a Swift 5.6 toolchain or later with the Swift Package Manager.

SourceKitten typically supports previous versions of SourceKit.

Homebrew

Run brew install sourcekitten.

Swift Package Manager

Run swift build in the root directory of this project.

Bazel

Add the following to your WORKSPACE file:

SOURCEKITTEN_VERSION = "SOME_VERSION"
SOURCEKITTEN_SHA = "SOME_SHA"
http_archive(
    name = "com_github_jpsim_sourcekitten",
    url = "https://github.com/jpsim/SourceKitten/archive/refs/tags/%s.tar.gz" % (SOURCEKITTEN_VERSION),
    sha256 = SOURCEKITTEN_SHA,
    strip_prefix = "SourceKitten-%s" % SOURCEKITTEN_VERSION
)

Then run: bazel run @com_github_jpsim_sourcekitten//:sourcekitten -- -h

Xcode (via Make)

Run make install in the root directory of this project.

Package

Download and open SourceKitten.pkg from the releases tab.

Command Line Usage

Once SourceKitten is installed, you may use it from the command line.

$ sourcekitten help
OVERVIEW: An adorable little command line tool for interacting with SourceKit

USAGE: sourcekitten <subcommand>

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

SUBCOMMANDS:
  complete                Generate code completion options
  doc                     Print Swift or Objective-C docs as JSON
  format                  Format Swift file
  index                   Index Swift file and print as JSON
  module-info             Obtain information about a Swift module and print as JSON
  request                 Run a raw SourceKit request
  structure               Print Swift structure information as JSON
  syntax                  Print Swift syntax information as JSON
  version                 Display the current version of SourceKitten

  See 'sourcekitten help <subcommand>' for detailed help.

How is SourceKit resolved?

SourceKitten searches for SourceKit in the following order:

  • $XCODE_DEFAULT_TOOLCHAIN_OVERRIDE
  • $TOOLCHAIN_DIR
  • xcrun -find swift
  • /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • ~/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • ~/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain

On Linux, SourceKit is expected to be located in /usr/lib/libsourcekitdInProc.so or specified by the LINUX_SOURCEKIT_LIB_PATH environment variable.

Projects Built With SourceKitten

  • SwiftLint: A tool to enforce Swift style and conventions.
  • Jazzy: Soulful docs for Swift & Objective-C.
  • Sourcery: Meta-programming for Swift, stop writing boilerplate code.
  • SwiftyMocky: Framework for mock generation.
  • SourceKittenDaemon: Swift Auto Completions for any Text Editor.
  • SourceDocs: Command Line Tool that generates Markdown documentation from inline source code comments.
  • Cuckoo: First boilerplate-free mocking framework for Swift.
  • IBAnalyzer: Find common xib and storyboard-related problems without running your app or writing unit tests.
  • Taylor: Measure Swift code metrics and get reports in Xcode, Jenkins and other CI platforms.
See More

Complete

Running sourcekitten complete --file file.swift --offset 123 or sourcekitten complete --text "0." --offset 2 will print out code completion options for the offset in the file/text provided:

[{
  "descriptionKey" : "advancedBy(n: Distance)",
  "associatedUSRs" : "s:FSi10advancedByFSiFSiSi s:FPSs21RandomAccessIndexType10advancedByuRq_S__Fq_Fqq_Ss16ForwardIndexType8Distanceq_ s:FPSs16ForwardIndexType10advancedByuRq_S__Fq_Fqq_S_8Distanceq_ s:FPSs10Strideable10advancedByuRq_S__Fq_Fqq_S_6Strideq_ s:FPSs11_Strideable10advancedByuRq_S__Fq_Fqq_S_6Strideq_",
  "kind" : "source.lang.swift.decl.function.method.instance",
  "sourcetext" : "advancedBy(<#T##n: Distance##Distance#>)",
  "context" : "source.codecompletion.context.thisclass",
  "typeName" : "Int",
  "moduleName" : "Swift",
  "name" : "advancedBy(n: Distance)"
},
{
  "descriptionKey" : "advancedBy(n: Self.Distance, limit: Self)",
  "associatedUSRs" : "s:FeRq_Ss21RandomAccessIndexType_SsS_10advancedByuRq_S__Fq_FTqq_Ss16ForwardIndexType8Distance5limitq__q_",
  "kind" : "source.lang.swift.decl.function.method.instance",
  "sourcetext" : "advancedBy(<#T##n: Self.Distance##Self.Distance#>, limit: <#T##Self#>)",
  "context" : "source.codecompletion.context.superclass",
  "typeName" : "Self",
  "moduleName" : "Swift",
  "name" : "advancedBy(n: Self.Distance, limit: Self)"
},
...
]

To use the iOS SDK, pass -sdk and -target arguments preceded by --:

sourcekitten complete --text "import UIKit ; UIColor." --offset 22 -- -target arm64-apple-ios9.0 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk

Doc

Running sourcekitten doc will pass all arguments after what is parsed to xcodebuild (or directly to the compiler, SourceKit/clang, in the --single-file mode).

Example usage

  1. sourcekitten doc -- -workspace SourceKitten.xcworkspace -scheme SourceKittenFramework
  2. sourcekitten doc --single-file file.swift -- -j4 file.swift
  3. sourcekitten doc --module-name Alamofire -- -project Alamofire.xcodeproj
  4. sourcekitten doc -- -workspace Haneke.xcworkspace -scheme Haneke
  5. sourcekitten doc --objc Realm/Realm.h -- -x objective-c -isysroot $(xcrun --show-sdk-path) -I $(pwd)

Structure

Running sourcekitten structure --file file.swift or sourcekitten structure --text "struct A { func b() {} }" will return a JSON array of structure information:

{
  "key.substructure" : [
    {
      "key.kind" : "source.lang.swift.decl.struct",
      "key.offset" : 0,
      "key.nameoffset" : 7,
      "key.namelength" : 1,
      "key.bodyoffset" : 10,
      "key.bodylength" : 13,
      "key.length" : 24,
      "key.substructure" : [
        {
          "key.kind" : "source.lang.swift.decl.function.method.instance",
          "key.offset" : 11,
          "key.nameoffset" : 16,
          "key.namelength" : 3,
          "key.bodyoffset" : 21,
          "key.bodylength" : 0,
          "key.length" : 11,
          "key.substructure" : [

          ],
          "key.name" : "b()"
        }
      ],
      "key.name" : "A"
    }
  ],
  "key.offset" : 0,
  "key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
  "key.length" : 24
}

Syntax

Running sourcekitten syntax --file file.swift or sourcekitten syntax --text "import Foundation // Hello World" will return a JSON array of syntax highlighting information:

[
  {
    "offset" : 0,
    "length" : 6,
    "type" : "source.lang.swift.syntaxtype.keyword"
  },
  {
    "offset" : 7,
    "length" : 10,
    "type" : "source.lang.swift.syntaxtype.identifier"
  },
  {
    "offset" : 18,
    "length" : 14,
    "type" : "source.lang.swift.syntaxtype.comment"
  }
]

Request

Running sourcekitten request --yaml [FILE|TEXT] will execute a sourcekit request with the given yaml. For example:

key.request: source.request.cursorinfo
key.sourcefile: "/tmp/foo.swift"
key.offset: 8
key.compilerargs:
  - "/tmp/foo.swift"

SourceKittenFramework

Most of the functionality of the sourcekitten command line tool is actually encapsulated in a framework named SourceKittenFramework.

If you’re interested in using SourceKitten as part of another tool, or perhaps extending its functionality, take a look at the SourceKittenFramework source code to see if the API fits your needs.

Note: SourceKitten is written entirely in Swift, and the SourceKittenFramework API is not designed to interface with Objective-C.

License

MIT licensed.

sourcekitten's People

Contributors

1ec5 avatar abl avatar cltnschlosser avatar compnerd avatar dependabot[bot] avatar ikesyo avatar jeremiegirault avatar johennes avatar johnfairh avatar jpsim avatar judemille avatar jverkoey avatar keith avatar kelvinjin avatar klaaspieter avatar larroy avatar lucatorella avatar lukas-stuehrk avatar lukel97 avatar lvsti avatar marcelofabri avatar modocache avatar norio-nomura avatar paultaykalo avatar paulyoung avatar segiddins avatar terhechte avatar tinder-maxwellelliott avatar ulukaya avatar vdka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sourcekitten's Issues

How to extract comments...

So now that I've got source kitten running I can't see how to extract doc-comments from the code. I'm walking the JSON blob that is returned from source kitten and I'm finding elements where I believe there should be a doc comment - but I don't believe the element data contains what I need - I was hoping for either the content of the doc comment or offset/lengths so I can load it from the source file directly.

What am I missing?

          {
            "key.namelength" : 8,
            "key.filepath" : "\/Users\/schwa\/Development\/Source\/Projects\/SwiftGraphics\/SwiftGraphics\/BezierBounds.swift",
            "key.name" : "bounds()",
            "key.bodylength" : 1856,
            "key.nameoffset" : 478,
            "key.typename" : "BezierCurve -> () -> CGRect",
            "key.usr" : "s:FV13SwiftGraphics11BezierCurve6boundsFS0_FT_VSC6CGRect",
            "key.kind" : "source.lang.swift.decl.function.method.instance",
            "key.bodyoffset" : 498,
            "key.parsed_declaration" : "func bounds() -> CGRect",
            "key.attributes" : [
              {
                "key.attribute" : "source.decl.attribute.__raw_doc_comment"
              }
            ],
            "key.length" : 8,
            "key.offset" : 478,
            "key.annotated_decl" : "<Declaration>func bounds() -&gt; <Type usr=\"c:@S@CGRect\">CGRect<\/Type><\/Declaration>",
            "key.substructure" : [

            ]
          },

dyld: Library not loaded: @rpath/libclang.dylib

I'm getting this message when trying to run any sourcekitten command.

dyld: Library not loaded: @rpath/libclang.dylib
  Referenced from: /usr/local/Frameworks/SourceKittenFramework.framework/Versions/A/SourceKittenFramework
  Reason: image not found
Trace/BPT trap: 5

I installed 0.5.1 via the package on the release page. I'm on El Capitan, version 10.11.1 (15B42)

It's been a while since I did anything with SourceKitten but seem to remember encountering this before with an older version.

Support relative paths

I'm getting segfaults on all files from bolt I try to run this on.

(Git/bolt)[master] % sourcekitten --syntax bolt/main.swift
zsh: segmentation fault  sourcekitten --syntax bolt/main.swift
(Git/bolt)[master] % sourcekitten --syntax bolt/TaskList.swift
zsh: segmentation fault  sourcekitten --syntax bolt/TaskList.swift
(Git/bolt)[master] % sourcekitten --syntax bolt/Task.swift
zsh: segmentation fault  sourcekitten --syntax bolt/Task.swift

Complete command use

I'm having troubles using the complete command:

  • every time I try to use it with the --file argument I get a Failed to read file at ... error, while the syntax command works just fine on the same file;
  • completion results do not always show up, as an example: sourcekitten complete --text "[1].m" --offset 4 works just fine and shows all of the available options, sourcekitten complete --text "[1].m" --offset 5 returns an empty array while it should return an option for the map function.

Loving the project.

(SourceKitten 0.5.0 installed via Homebrew, Xcode 7.1)

severalregularfoxterrier

Expose more structural information about function declarations

Hey SourceKitten crew, I've been having some fun creating an Xcode plugin that generates classes implementing swift protocols. I'm using SourceKitten to parse source files and generate an AST-level representation of the file, which I then use to determine what methods are in a given protocol.

When I get the structure back for a given file, I get some high level information about the protocol, the functions inside of it, but a lot of type information is missing (especially the local name and types of arguments, and the return value's type).

For example, I've got a contrived protocol like this for testing

protocol MySpecialProtocol {
    func thisIsATest(receives: Int, someArgs: Array<String>) -> String
}

What I get back from SourceKitten is an XPCDictionary that looks a bit like this (some keys omitted for brevity)

{
  "key.substructure" : [
    {
      "key.kind" : "source.lang.swift.decl.protocol",
      "key.substructure" : [
        {
          "key.kind" : "source.lang.swift.decl.function.method.instance",
          "key.accessibility" : "source.lang.swift.accessibility.internal",
          "key.substructure" : [],
          "key.name" : "thisIsATest(_:someArgs:)"
        }
      ],
      "key.name" : "MySpecialProtocol",
      "key.runtime_name" : "_TtP8__main__17MySpecialProtocol_",
    }
  ]
}

As you can see, all of the substructure for thisIsATest is missing. In File.swift, the resultant XPCDictionary is stripped of any nested elements that are not comments or declarations (excluding parameter declarations). I believe the information I am looking for is mainly in the parameter declarations.

Is there a particular reason why parameter declarations are filtered out of this? I would personally find it incredibly useful.

I'd be more than happy to submit a pull request for this, given that we can reach an understanding of which parameter declarations should be ignored, if any. My current feeling is that none should be ignored, but perhaps I'm being a bit naive?

Thank you for your time and contributions. SourceKitten has really been a boon to my personal project.

Move CLI tool dependencies to Cartfile.private

A consequence of everything being in the same repo and using Carthage is that I unnecessarily need to manage the dependencies of the CLI tool (Commandant, LlamaKit etc) despite only relying on the framework.

To clarify, in my own project that has a CLI component and depends on Commandant and SourceKittenFramework I need to use a version of Commandant that satisfies the SourceKitten CLI tool. The same thing goes for LlamaKit and others.

My framework and CLI tool are in separate repos but consumers of the framework are subject to the same thing.

I understand this is probably just following the structure of the Carthage project itself, and that there is a convenience factor involved.

/cc @jspahrsummers

Line numbers/character ranges for nodes in AST

Hi. I ran across sourcekitten as I was searching for alternatives to -dump-ast for getting at the AST for a Swift program. One thing I don't get from -dump-ast is the portions of source code corresponding to each node. It seems to be there for some nodes and not others. It looks neither the --structure nor the --syntax option with sourcekitten give me what I'm looking for, but do you know if sourcekit could be of use to me?

Edit: Sorry, this was pretty off-topic.

Completion for a project with multiple files

Hey,

I'm trying to get completions for a project with at least two files. I.e. let's say I have
main.swift:

import Foundation

func main() {}

and
ExampleProtocols.swift

import Foundation

public protocol Identifiable {
    var name: String { get }
}

public protocol Accountable {
    var costs: Int { get set }
}

And I'm trying to run sourcekitten with

sourcekitten complete --text "struct A { let u: Int } ; let aa = A(u: 5) ; aa." --offset 48 --compilerargs -- "/path/to/main.swift /path/to/ExampleProtocols.swift -sdk sdk-path -c"

Then I get empty results. If I add a lot of compiler args (basically, everything that Xcode gives to swiftc during building) I get:

89723 Illegal instruction: 4

Is there even a way to run sourcekitten on a project with more than one file and get completions?

Regards & Thanks,
Benedikt

commands don't seem to work at all

None of the sub-commands seem to work (including doc, help, etc):

$ sourcekitten help
Running xcodebuild -dry-run
Build settings from command line:
    CODE_SIGN_IDENTITY = 
    CODE_SIGNING_REQUIRED = NO

xcodebuild: error: Unknown build action 'help'.

'sourcekitten complete --text...' terminated by signal SIGILL (Illegal instruction)

Hey, I ran into this bug and I'm not sure what's the best way of solving it. When I try

sourcekitten complete --text "struct a { var u: Int = 0 } ; let x = a() ; x." --offset 45

Then I get the following error:

'sourcekitten complete --text...' terminated by signal SIGILL (Illegal instruction)

I did some investigation and added a unit test, that does exactly the same:

    func testSimpleCodeCompletion2() {
        let file = "\(NSUUID().UUIDString).swift"
        let contents = "struct a { var u: Int = 0 } ; let x = a() ; x."
        let completionItems = CodeCompletionItem.parseResponse(
            Request.CodeCompletionRequest(file: file, contents: contents, offset: Int64(contents.characters.count) - 1,
                arguments: ["-c", file, "-sdk", sdkPath()]).send())
        print(String(completionItems))
        compareJSONStringWithFixturesName("SimpleCodeCompletion",
            jsonString: String(completionItems))
    }

That generates the correct completions.

So I ran sourcekitten in debug mode to see where it fails. What happens is that in SwiftXPC.swift the fromXPC(xpcObject: xpc_object_t) -> XPCDictionary assumes that xpc_object_t is of type xpc_dictionary_t. However, when running on the commandline with the above arguments, it is actually a xpc_data_t:

ct: xpc_object_t) -> XPCDictionary {
    var dict = XPCDictionary()
    var dx =  NSData(bytes: xpc_data_get_bytes_ptr(xpcObject), length: xpc_data_get_length(xpcObject))
    let abc = String(data: dx, encoding: NSUTF8StringEncoding)
   print(abc)
...
 }

This will print:
"\x01error when parsing the compiler arguments\0"

So apparently between the unit test invocation and the command line invocation, something goes wrong that causes a wrong return type from the xpc call.

(I'm using a git-cloned version of the sourcekitten repo master branch, head). Also, on the machine where this happens, I'm on 10.10 running the Xcode 7.1 gold, the xcode-select is properly set to /Applications/Xcode.app)

Always link to Foundation

Otherwise, code that compiles and uses Foundation symbols but without import Foundation in the file would generate bad USRs (s:F10RealmSwift12migrateRealmERR vs s:F10RealmSwift12migrateRealmFTSS13encryptionKeyGSqCSo6NSData__GSqCSo7NSError_.

Completion limitations

I noticed today that attempting to complete with SourceKitten like this:

sourcekitten complete --text "let a: St" --offset 8

Provides no results. I was just curious if you know what the limitations of completion coming from SourceKit are? The only completions I've seem to be able to get working is right after ..

SourceKittenFramework is built without headers (?)

Hey, I'd like to say first that I really appreciate this framework. It's clear that a lot of work went into it and I'm really excited to use it to build better tooling for swift.

The problem that I'm having seems ... impossible. I'm building the SourceKitten framework and expecting to be able to bring that into an OS X project and link against it, but I'm finding that the SourceKitten.h umbrella header doesn't exist.

make installables
# build output here #

± ls -lsh /usr/local/Frameworks/SourceKittenFramework.framework
total 16
8 lrwxr-xr-x  1 root  wheel    26B Oct 11 12:16 Resources -> Versions/Current/Resources
8 lrwxr-xr-x  1 root  wheel    38B Oct 11 12:16 SourceKittenFramework -> Versions/Current/SourceKittenFramework
0 drwxr-xr-x  4 root  wheel   136B Oct 11 12:16 Versions

I haven't used frameworks that mix Obj-C with Swift before, but my expectation is that there should still be an umbrella header here in the Headers directory.

sourcekitd.framework fails detecting function's parameter when using `@noescape` and `rethrows`

This issue happens when both of @noescape and rethrows are used as following:

func f1(@noescape p1: () throws -> Void) rethrows { try p1() }

sourcekitten structure's output does not contain "source.lang.swift.decl.var.parameter" as following:

% sourcekitten structure --text "func f1(@noescape p1: () throws -> Void) rethrows { try p1() }"
{
  "key.substructure" : [
    {
      "key.kind" : "source.lang.swift.decl.function.free",
      "key.offset" : 0,
      "key.attributes" : [
        {
          "key.attribute" : "source.decl.attribute.rethrows"
        }
      ],
      "key.nameoffset" : 5,
      "key.namelength" : 35,
      "key.bodyoffset" : 51,
      "key.bodylength" : 14,
      "key.accessibility" : "source.lang.swift.accessibility.internal",
      "key.substructure" : [
        {
          "key.kind" : "source.lang.swift.expr.call",
          "key.offset" : 60,
          "key.nameoffset" : 60,
          "key.namelength" : 2,
          "key.bodyoffset" : 63,
          "key.bodylength" : 0,
          "key.length" : 4,
          "key.name" : "p1"
        }
      ],
      "key.name" : "f1(_:)",
      "key.length" : 66
    }
  ],
  "key.offset" : 0,
  "key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
  "key.length" : 67
}

Without @noescape, that contains "source.lang.swift.decl.var.parameter" as following:

% sourcekitten structure --text "func f1(p1: () throws -> Void) rethrows { try p1() }"
{
  "key.substructure" : [
    {
      "key.kind" : "source.lang.swift.decl.function.free",
      "key.offset" : 0,
      "key.attributes" : [
        {
          "key.attribute" : "source.decl.attribute.rethrows"
        }
      ],
      "key.nameoffset" : 5,
      "key.namelength" : 25,
      "key.bodyoffset" : 41,
      "key.bodylength" : 10,
      "key.accessibility" : "source.lang.swift.accessibility.internal",
      "key.substructure" : [
        {
          "key.kind" : "source.lang.swift.decl.var.parameter",
          "key.offset" : 8,
          "key.nameoffset" : 0,
          "key.namelength" : 0,
          "key.length" : 2,
          "key.typename" : "() throws -> Void",
          "key.name" : "p1"
        },
        {
          "key.kind" : "source.lang.swift.expr.call",
          "key.offset" : 46,
          "key.nameoffset" : 46,
          "key.namelength" : 2,
          "key.bodyoffset" : 49,
          "key.bodylength" : 0,
          "key.length" : 4,
          "key.name" : "p1"
        }
      ],
      "key.name" : "f1(_:)",
      "key.length" : 52
    }
  ],
  "key.offset" : 0,
  "key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
  "key.length" : 52
}

When using throws instead of rethrows, that contains "source.lang.swift.decl.var.parameter" as following:

sourcekitten structure --text "func f1(@noescape p1: () throws -> Void) throws { try p1() }"
{
  "key.substructure" : [
    {
      "key.kind" : "source.lang.swift.decl.function.free",
      "key.offset" : 0,
      "key.nameoffset" : 5,
      "key.namelength" : 35,
      "key.bodyoffset" : 49,
      "key.bodylength" : 10,
      "key.accessibility" : "source.lang.swift.accessibility.internal",
      "key.substructure" : [
        {
          "key.kind" : "source.lang.swift.decl.var.parameter",
          "key.offset" : 18,
          "key.attributes" : [
            {
              "key.attribute" : "source.decl.attribute.noescape"
            }
          ],
          "key.nameoffset" : 0,
          "key.namelength" : 0,
          "key.length" : 2,
          "key.typename" : "() throws -> Void",
          "key.name" : "p1"
        },
        {
          "key.kind" : "source.lang.swift.expr.call",
          "key.offset" : 54,
          "key.nameoffset" : 54,
          "key.namelength" : 2,
          "key.bodyoffset" : 57,
          "key.bodylength" : 0,
          "key.length" : 4,
          "key.name" : "p1"
        }
      ],
      "key.name" : "f1(_:)",
      "key.length" : 60
    }
  ],
  "key.offset" : 0,
  "key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
  "key.length" : 60
}

It seems sourcekitd.framework in swift-2.2-SNAPSHOT-2015-12-31-a has same issue.

This issue causes realm/SwiftLint#323

Could not parse swift file

The error:

Parsing SyncClient.swift (1/1)
sourcekit: [1:connection-event-handler:5907: 0.0000] Connection interrupt
sourcekit: [1:pingService:5907: 0.0008] pinging service
sourcekit: [1:sourcekitd_send_request_sync:779: 0.0021] request dropped while restoring service
Could not parse `SyncClient.swift`. Please open an issue at https://github.com/jpsim/SourceKitten/issues with the file contents.

when tempting to make jazzy documentation for https://github.com/aerogear/aerogear-ios-sync-client/blob/master/AeroGearSyncClient/SyncClient.swift#L25

the line causing the issue is :

public class SyncClient<CS:ClientSynchronizer, D:DataStore where CS.T == D.T, CS.D == D.D, CS.P.E == CS.D> : WebSocketDelegate

if you remove the where clause like:

public class SyncClient<CS:ClientSynchronizer, D:DataStore where CS.T == D.T, CS.D == D.D, CS.P.E == CS.D> : WebSocketDelegate

parsing is ok.

Make errors on fresh install, using Xcode 6.3

When I clone then make, these errors happen:

The following build commands failed:
    CompileSwift normal x86_64 /opt/sourcekitten/Carthage/Checkouts/SwiftXPC/SwiftXPC/XPCType.swift
    CompileSwift normal x86_64 /opt/sourcekitten/Carthage/Checkouts/SwiftXPC/SwiftXPC/SwiftXPC.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
    CompileSwift normal x86_64 /opt/sourcekitten/Carthage/Checkouts/Commandant/Carthage/Checkouts/LlamaKit/LlamaKit/Result.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(5 failures)

In case it's relevant, I'm using OSX 10.10.3, Xcode 6.3.

I tried running carthage and got this:

$ carthage update
*** Cloning SwiftXPC
*** Cloning Commandant
*** Cloning xcconfigs
*** Cloning LlamaKit
*** Checking out SwiftXPC at "0.0.2"
*** Checking out LlamaKit at "v0.6.0"
*** Downloading Commandant at "0.5: You Get an Error, and YOU Get an Error"
*** Checking out xcconfigs at "0.8"
*** xcodebuild output can be found in /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/carthage-xcodebuild.CHaLIv.log
*** Building scheme "LlamaKit-iOS" in LlamaKit.xcodeproj
** BUILD FAILED **

The log file says:

Build settings from command line:
    SDKROOT = iphonesimulator8.3

=== BUILD TARGET LlamaKit-iOS OF PROJECT LlamaKit WITH CONFIGURATION Release ===

Check dependencies

** BUILD SUCCEEDED **

Build settings from command line:
    SDKROOT = iphoneos8.3

=== BUILD TARGET LlamaKit-iOS OF PROJECT LlamaKit WITH CONFIGURATION Release ===

Check dependencies
Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID <E2><80><9C>(null)
<E2><80><9D> were found.
CodeSign error: code signing is required for product type 'Framework' in SDK 'iOS 8.3'

Parse XML

key.doc_as_full_xml returns XML and it'd be great if SourceKitten could parse that instead of jazzy. We'll eventually need to do this for Clang output too.

Swift file could not be parsed

Hello,

I am opening this ticket in response to a new error encountered while using the jazzy documentation generator:

"BasicDeepLinkSupportConfiguration.swift could not be parsed. Please open an issue at https://github.com/jpsim/sourcekitten/issues with the file contents."

So, as requested, that's what I'm doing. :)

The content of the file in question is:

//
//  BasicDeepLinkSupportConfiguration.swift
//  Gilt Cleanroom
//
//  Created by Evan Maloney on 1/2/15.
//  Copyright (c) 2015 Gilt Groupe. All rights reserved.
//

import Foundation

/**
A `DeepLinkRouterConfiguration` that provides basic support for handling
deep links. It enables default support for creating view controllers from
deep links, and displaying those view controllers onscreen in an appropriate
way. In addition, this adds support for handling deep links that are only
intended to activate the app.
*/
public class BasicDeepLinkSupportConfiguration: DeepLinkRouterConfigurationImpl
{
    /**
    The initializer.
    */
    override public init()
    {
        super.init()
        displayOptionsFactories = [DefaultDeepLinkDisplayOptionsFactory()]
        navigators = [DeepLinkActivateNavigator(), DeepLinkViewControllerNavigator()]
    }
}

I'm encountering this error using jazzy 0.0.19 and 0.0.20.

Please let me know if there's more information I can provide that will be helpful.

Thanks!
Evan

Break down code structure into several files

I haven't even started thinking seriously about how to do this yet, but it's becoming very difficult to use Xcode when editing main.swift, and I'm sure there's a more OO way to encapsulate what sourcekitten does.

Performance regression on 0.7.0

Sorry, I have introduced performance regression by #111.
I think func byteRangeToNSRange(start start: Int, length: Int) -> NSRange? needs caching result.

Use LlamaKit.Result throughout SourceKittenFramework

This will allow returning errors directly from SourceKittenFramework instead of just logging them to stderr.

This should be straightforward enough that anyone with experience handling monadic results could do this. Feel free to file a PR, otherwise I'll get to it eventually.

Structure command ignoring return types

I was playing around with the SourceKitten and I found myself stuck on missing a return type information in the output of sourcekitten structure --text "protocol pA { func test() -> String }".

Is it missing in SourceKitten or the SourceKit itself?

Byte offset

I'm trying to use sourcekitten to power a vim syntax highlighting plugin for swift. The current issue I have is that sourcekit returns the offsets excluding the bytes of newline characters (bytes in vim also start at 1 but that's a much simpler problem to handle on the vim side). The vim functions I need to use with this (byte2line() and line2byte()) take newlines into account. Here's an example of the difference:

var a
let bar = "hi"
          ^ to sourcekit this is byte 16, in vim this is byte 18

In vim this is byte 18 because bytes are not zero indexed. What I really want from sourcekitten here is 17.

To achieve this I imagine a few things would have to change. This function which prints the XPCDictionary would have to be altered (probably duplicated) to take newlines from the given file into account. I imagine those steps looking something like this:

  1. Read the offset from sourcekit.
  2. Count that many bytes from the beginning of the string
  3. If a newline is hit before the offset, increment the offset and all trailing offsets
  4. Repeat

Let me know if this makes sense.

SourceKittenFrame.framework.zip has no header files

This means I can't actually import it into a project when Carthage downloads the framework binary. Framework folder structure diff between the download and a locally compiled binary:

$ diff -r SourceKittenFramework.framework SourceKittenFramework.local.framework | grep "Only in"
Only in SourceKittenFramework.local.framework: Headers
Only in SourceKittenFramework.local.framework: Modules
Only in SourceKittenFramework.local.framework/Versions/A: Headers
Only in SourceKittenFramework.local.framework/Versions/A: Modules
Only in SourceKittenFramework.local.framework/Versions/Current: Headers
Only in SourceKittenFramework.local.framework/Versions/Current: Modules

I'm guessing it's something in the way the build script is configured?

Getting crashing trying to jazzy doc project

Hi, I’m getting a crash trying to document this project:

https://github.com/RubyNative/RubyKit

$ brew install sourcekitten
Warning: sourcekitten-0.5.0 already installed

Running xcodebuild
Parsing main.swift (1/26)
Parsing Object.swift (2/26)
Parsing Kernel.swift (3/26)
Parsing Array.swift (4/26)
Parsing String.swift (5/26)
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.3.1/lib/jazzy/executable.rb:35:in `execute_command': /Library/Ruby/Gems/2.0.0/gems/jazzy-0.3.1/lib/jazzy/SourceKitten/bin/sourcekitten "doc"

The crashdump is:

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000

Application Specific Information:
fatal error: unexpectedly found nil while unwrapping an Optional value


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib              0x000000010674093c _TTSf4s_s_d_d___TFSs18_fatalErrorMessageFTVSs12StaticStringS_S_Su_T_ + 44
1   com.sourcekitten.SourceKittenFramework  0x000000010657ced5 _TFV21SourceKittenFramework4FileP33_C13880BB1D10F84AB560DC044F1EF1219insertDocfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__6parentGS1_SSPS3___6offsetVSs5Int64_GSqGS1_SSPS3____ + 629
2   com.sourcekitten.SourceKittenFramework  0x000000010657dd39 _TFV21SourceKittenFramework4FileP33_C13880BB1D10F84AB560DC044F1EF1219insertDocfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__6parentGS1_SSPS3___6offsetVSs5Int64_GSqGS1_SSPS3____ + 4313
3   com.sourcekitten.SourceKittenFramework  0x000000010657dd39 _TFV21SourceKittenFramework4FileP33_C13880BB1D10F84AB560DC044F1EF1219insertDocfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__6parentGS1_SSPS3___6offsetVSs5Int64_GSqGS1_SSPS3____ + 4313
4   com.sourcekitten.SourceKittenFramework  0x000000010657c923 _TFV21SourceKittenFramework4File24furtherProcessDictionaryfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__22documentedTokenOffsetsGSaSi_17cursorInfoRequestCSo8NSObject9syntaxMapVS_9SyntaxMap_GS1_SSPS3___ + 2339
5   com.sourcekitten.SourceKittenFramework  0x00000001065539fd _TFV21SourceKittenFramework9SwiftDocsCfMS0_FT4fileVS_4File10dictionaryGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__S0_ + 1821
6   com.sourcekitten.SourceKittenFramework  0x0000000106553197 _TFV21SourceKittenFramework9SwiftDocsCfMS0_FT4fileVS_4File9argumentsGSaSS__S0_ + 567
7   com.sourcekitten.SourceKittenFramework  0x0000000106592482 _TFFV21SourceKittenFramework6Moduleg4docsGSaVS_9SwiftDocs_U_FSSGSqS1__ + 3410
8   com.sourcekitten.SourceKittenFramework  0x000000010658cf56 _TPA__TFFV21SourceKittenFramework6Moduleg4docsGSaVS_9SwiftDocs_U_FSSGSqS1__ + 294
9   com.sourcekitten.SourceKittenFramework  0x000000010659320a _TTRXFo_oSS_oGSqV21SourceKittenFramework9SwiftDocs__XFo_iSS_iGSqS0___ + 74
10  com.sourcekitten.SourceKittenFramework  0x000000010658d041 _TPA__TTRXFo_oSS_oGSqV21SourceKittenFramework9SwiftDocs__XFo_iSS_iGSqS0___ + 81
11  libswiftCore.dylib              0x00000001066ff4cc _TFVSs17MapCollectionViewg9subscriptFQQ_5IndexQ0_ + 172

Could you take a look?

Tried to myself but got a variation on the the Xcode 7 blues :(

carthage update
*** Fetching xcconfigs
*** Fetching Commandant
*** Fetching SWXMLHash
*** Fetching SwiftXPC
Failed to check out repository into /Users/johnholdsworth/Library/Caches/org.carthage.CarthageKit/dependencies/SWXMLHash: No object named "xcode-7.0” exists

fatal error: unexpectedly found nil while unwrapping an Optional value

When I use jazzy to parse my project, but encounter such error:

fatal error: unexpectedly found nil while unwrapping an Optional value
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.2.1/lib/jazzy/sourcekitten.rb:84:in `run_sourcekitten'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.2.1/lib/jazzy/doc_builder.rb:53:in `block in build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.2.1/lib/jazzy/doc_builder.rb:51:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.2.1/lib/jazzy/doc_builder.rb:51:in `build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.2.1/bin/jazzy:15:in `<top (required)>'
    from /usr/bin/jazzy:23:in `load'
    from /usr/bin/jazzy:23:in `<main>'

It seems that something goes wrong when in sourcekitten stage.
I don't know how to collect more logs and how to diagnose the error. Any suggestion? Thanks!

A function with only a comment in its body suppresses all output for its containing file

Head of the sourcekitten output for the project at https://github.com/brennon/SimpleGame:

h80ad15c5:SimpleGame brennon$ sourcekitten
Running xcodebuild -dry-run
[
parsing GameScene.swift (1/3)

,
parsing GameViewController.swift (2/3)
GameViewController.swift is 12% documented
...

And with the comment removed from GameScene.update:

h80ad15c5:SimpleGame brennon$ sourcekitten
Running xcodebuild -dry-run
[
parsing GameScene.swift (1/3)
GameScene.swift is 100% documented
{
  "key.offset" : 0,
...

Illegal instruction: 4

I'm getting the error Illegal instruction: 4 on a specific file. Is there a verbose mode so I can get more detail about what is causing the error? The project compiles fine (swift 2 Xcode 7)

Non-ASCII characters in Objective-C produce incorrect output

If I run sourcekitten doc --objc MGLMapView.h -x objective-c -isysroot $(xcrun --show-sdk-path) -I $(pwd) with the following (stripped-down) contents of MGLMapView.h, I get the output I expect:

#import <Foundation/Foundation.h>

/**
 ’’’
 */
@interface MGLMapView : NSObject

#pragma mark Initializing a Map View

/**
 Initializes and returns a newly allocated map view with the specified frame and the default style.
 */
- (instancetype)initWithFrame:(NSRect)frame;

#pragma mark Manipulating the Visible Portion of the Map

/**
 The coordinate bounds visible in the receiver’s viewport.
 */
@property (nonatomic) int visibleCoordinateBounds;

#pragma mark Converting Map Coordinates

/**
 Converts a point in the specified view’s coordinate system to a map coordinate.
 */
- (int)convertPoint:(NSPoint)point toCoordinateFromView:(nullable NSObject *)view;

/**
 Converts a map coordinate to a point in the specified view.

 @param view The view in whose coordinate system you want to locate the specified map coordinate. If this parameter is `nil`, the returned point is specified in the window’s coordinate system. If `view` is not `nil`, it must belong to the same window as the map view.
 */
- (CGPoint)convertCoordinate:(int)coordinate toPointToView:(nullable NSObject *)view;

#pragma mark Styling the Map

/**
 URL of the style currently displayed in the receiver.

 The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s map ID (`mapbox://styles/my_user_name/abcd1234`).
 */
@property (nonatomic, null_resettable) NSURL *styleURL;

/**
 Returns a Boolean value indicating whether the style class with the given identifier is currently active.
 */
- (BOOL)hasStyleClass:(NSString *)styleClass;

#pragma mark Annotating the Map

/**
 The complete list of annotations associated with the receiver. (read-only)
 */
@property (nonatomic, readonly, nullable) NSArray *annotations;

#pragma mark Annotating the Map 2

/**
 The complete list of annotations associated with the receiver. (read-only)
 */
@property (nonatomic, readonly, nullable) NSArray *annotations2;

@end

However, if I add one more Unicode character (such as or ) to the MGLMapView class’s documentation comment, #pragma mark sections go missing and character indices get knocked out of place:

8c8
<           "key.doc.comment" : "’’’",

---
>           "key.doc.comment" : "’’’’",
117c117
<               "key.doc.line" : 36,

---
>               "key.doc.line" : 35,
119c119
<               "key.parsed_scope.start" : 36,

---
>               "key.parsed_scope.start" : 35,
121c121
<               "key.parsed_scope.end" : 36,

---
>               "key.parsed_scope.end" : 35,
153,162d152
<               "key.kind" : "sourcekitten.source.lang.objc.mark",
<               "key.doc.file" : "\/Users\/mxn\/Desktop\/MGLMapView.h",
<               "key.doc.line" : 49,
<               "key.name" : "Annotating the Map",
<               "key.parsed_scope.start" : 49,
<               "key.doc.column" : 1,
<               "key.parsed_scope.end" : 49,
<               "key.filepath" : "\/Users\/mxn\/Desktop\/MGLMapView.h"
<             },
<             {
179c169
<               "key.doc.line" : 56,

---
>               "key.doc.line" : 55,
181c171
<               "key.parsed_scope.start" : 56,

---
>               "key.parsed_scope.start" : 55,
183c173
<               "key.parsed_scope.end" : 56,

---
>               "key.parsed_scope.end" : 55,

As far as I can tell, the issue seems to be that String.pragmaMarks(_:excludeRanges:limitRange:) in String+SourceKitten.swift works with NSString indices, whereas clang_getSpellingLocation() appears to be reporting byte offsets.

/cc @friedbunny

Crash documenting NonNilMatcherWrapper.swift in Nimble

2015-01-31 13:02:54.266 sourcekitten[79734:4969998] *** -[__NSCFString substringWithRange:]: Range {77, 18446744073709551614} out of bounds; string length 2027. This will become an exception for apps linked after 10.10 and iOS 8. Warning shown once per app execution.
Could not parse `NonNilMatcherWrapper.swift`. Please open an issue at https://github.com/jpsim/SourceKitten/issues with the file contents.

Process:               sourcekitten [79634]
Path:                  /usr/local/Cellar/rbenv/0.4.0/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/sourcekitten
Identifier:            sourcekitten
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        sourcekitten [79560]
Responsible:           iTerm [76404]
User ID:               501

Date/Time:             2015-01-31 13:02:38.243 -0800
OS Version:            Mac OS X 10.10.1 (14B25)
Report Version:        11
Anonymous UUID:        3E4575A5-B4CA-50C4-AAE9-3C9C16E49CF9

Sleep/Wake UUID:       547454EE-67DD-4C14-81EC-D0067D9C9AB9

Time Awake Since Boot: 300000 seconds
Time Since Wake:       7600 seconds

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000

VM Regions Near 0:
--> 
    __TEXT                 000000010c64f000-000000010c666000 [   92K] r-x/rwx SM=COW  /usr/local/Cellar/rbenv/0.4.0/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/sourcekitten

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation        0x00007fff8fadd57c CFStringCreateCopy + 28
1   libswiftFoundation.dylib        0x000000010cab0dc4 _TF10Foundation24_convertNSStringToStringFCSo8NSStringSS + 148
2   SourceKittenFramework           0x000000010c6db50f _TFE21SourceKittenFrameworkCSo8NSString17filteredSubstringfS0_FTSi3endSi_SS + 431
3   SourceKittenFramework           0x000000010c6db5e2 _TToFE21SourceKittenFrameworkCSo8NSString17filteredSubstringfS0_FTSi3endSi_SS + 50
4   SourceKittenFramework           0x000000010c6dfbf8 _TFV21SourceKittenFramework4File16parseDeclarationfS0_FGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__GSqSS_ + 1544
5   SourceKittenFramework           0x000000010c6e1d6e _TFV21SourceKittenFramework4File17processDictionaryfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GS1_SSPS3___ + 1198
6   SourceKittenFramework           0x000000010c6eab27 _TFFV21SourceKittenFramework4File15newSubstructureFS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GSqGSaPS3____U0_FPS3__PS3__ + 471
7   SourceKittenFramework           0x000000010c6e7aa2 _TPA__TFFV21SourceKittenFramework4File15newSubstructureFS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GSqGSaPS3____U0_FPS3__PS3__ + 226
8   libswiftCore.dylib              0x000000010c7f6426 _TFVSs17MapCollectionViewg9subscriptFQQ_5IndexQ0_ + 342
9   libswiftCore.dylib              0x000000010c7f8727 _TTWVSs17MapCollectionViewSs14CollectionTypeFS0_g9subscriptFQQPS0_5IndexQQS1_9Generator7Element + 935
10  libswiftCore.dylib              0x000000010c7f3c0e _TTWVSs26LazyRandomAccessCollectionSs14CollectionTypeFS0_g9subscriptFQQPS0_5IndexQQS1_9Generator7Element + 478
11  libswiftCore.dylib              0x000000010c759d59 _TFSs34_copyCollectionToNativeArrayBufferUSs14CollectionType_USs13GeneratorType__Ss16ForwardIndexType_Ss18_SignedIntegerType_Ss33_BuiltinIntegerLiteralConvertible___FQ_GVSs22_ContiguousArrayBufferQQ_8_Element_ + 873
12  libswiftCore.dylib              0x000000010c7f39f6 _TTWVSs26LazyRandomAccessCollectionSs12SequenceTypeFS0_oi2tgUS0__USs13GeneratorType___fMQPS0_FTS2_TVSs24_CopyToNativeArrayBufferT___GVSs22_ContiguousArrayBufferQQS2_9Generator7Element_ + 406
13  libswiftCore.dylib              0x000000010c778593 _TFSa3mapU__fGSaQ__U__FFQd__Q_GSaQ__ + 1283
14  SourceKittenFramework           0x000000010c6e3c26 _TFV21SourceKittenFramework4File15newSubstructurefS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GSqGSaPS3____ + 918
15  SourceKittenFramework           0x000000010c6e224c _TFV21SourceKittenFramework4File17processDictionaryfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GS1_SSPS3___ + 2444
16  SourceKittenFramework           0x000000010c6c5242 _TFV21SourceKittenFramework9SwiftDocsCfMS0_FT4fileVS_4File10dictionaryGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__S0_ + 578
17  SourceKittenFramework           0x000000010c6c4f99 _TFV21SourceKittenFramework9SwiftDocsCfMS0_FT4fileVS_4File9argumentsGSaSS__S0_ + 521
18  sourcekitten                    0x000000010c651b6f _TFV12sourcekitten10DocCommand18runSwiftSingleFilefMS0_FGSaSS_GO8LlamaKit6ResultT__ + 2127
19  sourcekitten                    0x000000010c6536e2 _TFFV12sourcekitten10DocCommand3runFS0_FO10Commandant11CommandModeGO8LlamaKit6ResultT__U_FVS_10DocOptionsGS4_T__ + 338
20  sourcekitten                    0x000000010c653ae8 _TTRXFo_oV12sourcekitten10DocOptions_oGO8LlamaKit6ResultT___XFo_iS0__oGS2_T___ + 56
21  net.robnapier.LlamaKit          0x000000010c73574e _TFO8LlamaKit6Result7flatMapU__fGS0_Q__U__FFQd__GS0_Q__GS0_Q__ + 334
22  sourcekitten                    0x000000010c650559 _TFV12sourcekitten10DocCommand3runfS0_FO10Commandant11CommandModeGO8LlamaKit6ResultT__ + 233
23  sourcekitten                    0x000000010c652f17 _TTWV12sourcekitten10DocCommand10Commandant11CommandTypeFS2_3runUS2___fRQPS2_FOS1_11CommandModeGO8LlamaKit6ResultT__ + 119
24  Commandant                      0x000000010c695ddf _TFC10Commandant15CommandRegistry10runCommandfS0_FTSS9argumentsGSaSS__GSqGO8LlamaKit6ResultT___ + 431
25  Commandant                      0x000000010c6969e1 _TFC10Commandant15CommandRegistry4mainfS0_FT14defaultCommandPS_11CommandType_12errorHandlerFCSo7NSErrorT__T_ + 1825
26  sourcekitten                    0x000000010c65ee7e top_level_code + 1630
27  sourcekitten                    0x000000010c65eeaa main + 42
28  libdyld.dylib                   0x00007fff8b8f65c9 start + 1

Thread 1:
0   libsystem_kernel.dylib          0x00007fff905d6946 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff95cc14a1 start_wqthread + 13

Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x00007fff905d722e kevent64 + 10
1   libdispatch.dylib               0x00007fff93c7ba6a _dispatch_mgr_thread + 52

Thread 3:
0   libsystem_kernel.dylib          0x00007fff905d6946 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff95cc14a1 start_wqthread + 13

Thread 4:
0   libsystem_kernel.dylib          0x00007fff905d6946 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff95cc14a1 start_wqthread + 13

Thread 5:
0   libsystem_kernel.dylib          0x00007fff905d6946 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff95cc14a1 start_wqthread + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000000000000  rcx: 0x00007fff79b2f7a8  rdx: 0x0000000000000000
  rdi: 0x0000000000000000  rsi: 0x0000000000000000  rbp: 0x00007fff535aab60  rsp: 0x00007fff535aab20
   r8: 0x00007fff535aa6a0   r9: 0x0000000000000000  r10: 0x00000000000094c8  r11: 0x000000010cab0d30
  r12: 0x00007fff535abb20  r13: 0x000000010c776700  r14: 0x0000000000000000  r15: 0x0000000000000000
  rip: 0x00007fff8fadd57c  rfl: 0x0000000000010246  cr2: 0x0000000000000000

Logical CPU:     0
Error Code:      0x00000004
Trap Number:     14


Binary Images:
       0x10c64f000 -        0x10c665fff +sourcekitten (0) <FA805787-A002-3C06-8A33-D2CDD9B6C206> /usr/local/opt/rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/sourcekitten
       0x10c684000 -        0x10c69ffff +Commandant (0) <AF595E85-C7B5-364A-A0BC-E5FDD949A10B> /usr/local/Cellar/rbenv/0.4.0/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/Commandant.framework/Commandant
       0x10c6be000 -        0x10c6fcff7 +SourceKittenFramework (0) <4357B006-B026-3A35-8C3D-13F2466FBAEA> /usr/local/Cellar/rbenv/0.4.0/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/SourceKittenFramework.framework/SourceKittenFramework
       0x10c734000 -        0x10c73afff +net.robnapier.LlamaKit (1.0 - 1) <580A6D96-6ABE-37DC-A47E-73E5B935C99D> /usr/local/Cellar/rbenv/0.4.0/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/LlamaKit.framework/Versions/A/LlamaKit
       0x10c748000 -        0x10c8fdff7 +libswiftCore.dylib (1.1 - 600.0.56.1) <CEC002F8-8921-3AF7-BC7C-4B3EB2408A24> /Library/Frameworks/SourceKittenFramework.framework/Versions/Current/Frameworks/libswiftCore.dylib
       0x10ca5f000 -        0x10ca77fff +libswiftCoreGraphics.dylib (1.1 - 600.0.56.1) <2C8F72B7-2B3F-360E-9C0D-27D536ED32EA> /Library/Frameworks/SourceKittenFramework.framework/Versions/Current/Frameworks/libswiftCoreGraphics.dylib
       0x10ca8f000 -        0x10ca94fff +libswiftDarwin.dylib (1.1 - 600.0.56.1) <0FC957E0-02C3-3072-8C60-C4DD70279C0C> /Library/Frameworks/SourceKittenFramework.framework/Versions/Current/Frameworks/libswiftDarwin.dylib
       0x10caa3000 -        0x10caa4fff +libswiftDispatch.dylib (1.1 - 600.0.56.1) <903C3320-4A99-3834-B52C-DE560DB17B62> /Library/Frameworks/SourceKittenFramework.framework/Versions/Current/Frameworks/libswiftDispatch.dylib
       0x10caaf000 -        0x10caffff7 +libswiftFoundation.dylib (1.1 - 600.0.56.1) <02C1CF5A-5126-398C-96AE-AD472A2101E7> /Library/Frameworks/SourceKittenFramework.framework/Versions/Current/Frameworks/libswiftFoundation.dylib
       0x10cb32000 -        0x10cb36fff +libswiftObjectiveC.dylib (1.1 - 600.0.56.1) <E322D758-937A-3908-A301-13AC7E10FC4C> /Library/Frameworks/SourceKittenFramework.framework/Versions/Current/Frameworks/libswiftObjectiveC.dylib
       0x10cb44000 -        0x10cb44ff7 +libswiftSecurity.dylib (1.1 - 600.0.56.1) <F9671369-8416-3A75-81ED-0758CCAF78EA> /Library/Frameworks/SourceKittenFramework.framework/Versions/Current/Frameworks/libswiftSecurity.dylib
       0x10cb4e000 -        0x10d5e1fff +libclang.dylib (600.0.56) <AF31E840-5A20-3151-A9EB-71996DA85AB4> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib
       0x10d77f000 -        0x10d7d8ff7  com.apple.sourcekitd (1.0 - 600.0.56.1) <58C89ADF-9024-3277-B63F-CFB5D0E4F174> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/sourcekitd.framework/Versions/A/sourcekitd
       0x10d801000 -        0x10d80efff +com.jpsim.SwiftXPC (0.0.1 - 1) <61238D1C-1C04-3E36-86A1-1003EB3787EE> /Library/Frameworks/SourceKittenFramework.framework/Versions/Current/Frameworks/SwiftXPC.framework/Versions/A/SwiftXPC
    0x7fff68c5f000 -     0x7fff68c95837  dyld (353.2.1) <4696A982-1500-34EC-9777-1EF7A03E2659> /usr/lib/dyld
    0x7fff88a87000 -     0x7fff88ba9ff7  com.apple.LaunchServices (644.12 - 644.12) <D7710B20-0561-33BB-A3C8-463691D36E02> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
    0x7fff88bba000 -     0x7fff88bc2fff  libsystem_platform.dylib (63) <64E34079-D712-3D66-9CE2-418624A5C040> /usr/lib/system/libsystem_platform.dylib
    0x7fff88bc3000 -     0x7fff88bdcff7  com.apple.CFOpenDirectory (10.10 - 187) <0ECA5D80-A045-3A2C-A60C-E1605F3AB6BD> /System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpenDirectory.framework/Versions/A/CFOpenDirectory
    0x7fff88bdd000 -     0x7fff88bddfff  com.apple.Accelerate (1.10 - Accelerate 1.10) <C7278843-2462-32F6-B0E3-D33C681399A2> /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
    0x7fff88be1000 -     0x7fff88be1fff  libOpenScriptingUtil.dylib (162) <EFD79173-A9DA-3AE6-BE15-3948938204A6> /usr/lib/libOpenScriptingUtil.dylib
    0x7fff88be2000 -     0x7fff88beaffb  com.apple.CoreServices.FSEvents (1210 - 1210) <782A9C69-7A45-31A7-8960-D08A36CBD0A7> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents
    0x7fff88ced000 -     0x7fff88d9cfe7  libvMisc.dylib (512) <AFBA45DE-7F55-3E4E-B8DF-5E8E21C407AD> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib
    0x7fff88ea8000 -     0x7fff88eaaff7  libquarantine.dylib (76) <DC041627-2D92-361C-BABF-A869A5C72293> /usr/lib/system/libquarantine.dylib
    0x7fff88f20000 -     0x7fff88f25ff7  libunwind.dylib (35.3) <BE7E51A0-B6EA-3A54-9CCA-9D88F683A6D6> /usr/lib/system/libunwind.dylib
    0x7fff88f26000 -     0x7fff88f2fff7  libsystem_notify.dylib (133.1.1) <61147800-F320-3DAA-850C-BADF33855F29> /usr/lib/system/libsystem_notify.dylib
    0x7fff89f31000 -     0x7fff8a25fff7  com.apple.Foundation (6.9 - 1151.16) <18EDD673-A010-3E99-956E-DA594CE1FA80> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
    0x7fff8a267000 -     0x7fff8a290ffb  libxslt.1.dylib (13) <AED1143F-B848-3E73-81ED-71356F25F084> /usr/lib/libxslt.1.dylib
    0x7fff8a3dd000 -     0x7fff8a4cffff  libxml2.2.dylib (26) <B834E7C8-EC3E-3382-BC5A-DA38DC4D720C> /usr/lib/libxml2.2.dylib
    0x7fff8afb5000 -     0x7fff8afe0ff3  libarchive.2.dylib (30) <8CBB4416-EBE9-3574-8ADC-44655D245F39> /usr/lib/libarchive.2.dylib
    0x7fff8b3b5000 -     0x7fff8b69cffb  com.apple.CoreServices.CarbonCore (1108.1 - 1108.1) <55A16172-ACC0-38B7-8409-3CB92AF33973> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
    0x7fff8b69d000 -     0x7fff8b8a0ff3  com.apple.CFNetwork (720.1.1 - 720.1.1) <A82E71B3-2CDB-3840-A476-F2304D896E03> /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
    0x7fff8b8d8000 -     0x7fff8b8d8ff7  liblaunch.dylib (559.1.22) <8A988924-8BE7-35FE-BF7D-322E90EFE49E> /usr/lib/system/liblaunch.dylib
    0x7fff8b8d9000 -     0x7fff8b8daffb  libremovefile.dylib (35) <3485B5F4-6CE8-3C62-8DFD-8736ED6E8531> /usr/lib/system/libremovefile.dylib
    0x7fff8b8f3000 -     0x7fff8b8f6ff7  libdyld.dylib (353.2.1) <19FAF435-C165-3374-9DEF-D7BBA7D61DB6> /usr/lib/system/libdyld.dylib
    0x7fff8b962000 -     0x7fff8b9daff7  com.apple.SystemConfiguration (1.14 - 1.14) <C269BCFD-ACAB-3331-BC7C-0430F0E84817> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
    0x7fff8b9e6000 -     0x7fff8b9e6ff7  libunc.dylib (29) <5676F7EA-C1DF-329F-B006-D2C3022B7D70> /usr/lib/system/libunc.dylib
    0x7fff8ba1f000 -     0x7fff8ba20fff  liblangid.dylib (117) <B54A4AA0-2E53-3671-90F5-AFF711C0EB9E> /usr/lib/liblangid.dylib
    0x7fff8bd22000 -     0x7fff8bd28ff7  libsystem_networkextension.dylib (167.1.10) <29AB225B-D7FB-30ED-9600-65D44B9A9442> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff8bd29000 -     0x7fff8bd2bfff  libsystem_configuration.dylib (699.1.5) <9FBA1CE4-97D0-347E-A443-93ED94512E92> /usr/lib/system/libsystem_configuration.dylib
    0x7fff8bd32000 -     0x7fff8bdaffff  com.apple.CoreServices.OSServices (640.3 - 640.3) <28445162-08E9-3E24-84E4-617CE5FE1367> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
    0x7fff8bdb0000 -     0x7fff8c018ffb  com.apple.security (7.0 - 57031.1.35) <96141D1F-614E-32C4-8AC2-F47481F23F43> /System/Library/Frameworks/Security.framework/Versions/A/Security
    0x7fff8d8f9000 -     0x7fff8d8fcfff  com.apple.IOSurface (97 - 97) <D4B4D2B2-7B16-3174-9EA6-55E0A10B452D> /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface
    0x7fff8dbc9000 -     0x7fff8dc0fff7  libauto.dylib (186) <A260789B-D4D8-316A-9490-254767B8A5F1> /usr/lib/libauto.dylib
    0x7fff8dc2c000 -     0x7fff8dc34fff  libsystem_dnssd.dylib (561.1.1) <62B70ECA-E40D-3C63-896E-7F00EC386DDB> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff8f02f000 -     0x7fff8f031ff7  libsystem_coreservices.dylib (9) <41B7C578-5A53-31C8-A96F-C73E030B0938> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff8f31d000 -     0x7fff8f502267  libobjc.A.dylib (646) <3B60CD90-74A2-3A5D-9686-B0772159792A> /usr/lib/libobjc.A.dylib
    0x7fff8f5d8000 -     0x7fff8f5f3ff7  libCRFSuite.dylib (34) <D64842BE-7BD4-3D0C-9842-1D202F7C2A51> /usr/lib/libCRFSuite.dylib
    0x7fff8f920000 -     0x7fff8f958ffb  libsystem_network.dylib (411) <C0B2313D-47BE-38A9-BEE6-2634A4F5E14B> /usr/lib/system/libsystem_network.dylib
    0x7fff8f97e000 -     0x7fff8fac4fef  libsqlite3.dylib (168) <8B78BED1-7B9B-3943-80DC-0871015AEAC4> /usr/lib/libsqlite3.dylib
    0x7fff8fac5000 -     0x7fff8fe5bfff  com.apple.CoreFoundation (6.9 - 1151.16) <F2B088AF-A5C6-3FAE-9EB4-7931AF6359E4> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff9022a000 -     0x7fff90255fff  com.apple.DictionaryServices (1.2 - 229) <6789EC43-CADA-394D-8FE8-FC3A2DD136B9> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
    0x7fff90256000 -     0x7fff902c7ff7  com.apple.framework.IOKit (2.0.2 - 1050.1.21) <ED3B0B22-AACC-303B-BFC8-20ECD1AF6BA2> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
    0x7fff902c8000 -     0x7fff902e2ff7  liblzma.5.dylib (7) <1D03E875-A7C0-3028-814C-3C27F7B7C079> /usr/lib/liblzma.5.dylib
    0x7fff9041d000 -     0x7fff90421fff  libcache.dylib (69) <45E9A2E7-99C4-36B2-BEE3-0C4E11614AD1> /usr/lib/system/libcache.dylib
    0x7fff904ad000 -     0x7fff905bfff7  libvDSP.dylib (512) <DD5517F5-F7F7-3AA1-B6FA-CD98DBC3C651> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib
    0x7fff905c0000 -     0x7fff905ddfff  libsystem_kernel.dylib (2782.1.97) <93E0E0A9-75B6-3904-BB4E-4BC7C05F4B6B> /usr/lib/system/libsystem_kernel.dylib
    0x7fff90872000 -     0x7fff90873fff  libsystem_secinit.dylib (18) <581DAD0F-6B63-3A48-B63B-917AF799ABAA> /usr/lib/system/libsystem_secinit.dylib
    0x7fff909c3000 -     0x7fff909daff7  libLinearAlgebra.dylib (1128) <E78CCBAA-A999-3B65-8EC9-06DB15E67C37> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib
    0x7fff90a2d000 -     0x7fff91266ff3  com.apple.CoreGraphics (1.600.0 - 772) <936D081F-37B3-3DA3-B725-118D0B07DDD2> /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics
    0x7fff91296000 -     0x7fff91298fff  com.apple.loginsupport (1.0 - 1) <35A2A071-606C-39A5-8C11-E4CAF98D934C> /System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport
    0x7fff9133b000 -     0x7fff91748ff7  libLAPACK.dylib (1128) <F9201AE7-B031-36DB-BCF8-971E994EF7C1> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
    0x7fff91775000 -     0x7fff9195aff3  libicucore.A.dylib (531.30) <EF0E7544-E317-3550-A962-6AE65E78AF17> /usr/lib/libicucore.A.dylib
    0x7fff91ef7000 -     0x7fff91efafff  com.apple.xpc.ServiceManagement (1.0 - 1) <7E9E6BB7-AEE7-3F59-BAC0-59EAF105D0C8> /System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement
    0x7fff928bf000 -     0x7fff928c6fff  com.apple.NetFS (6.0 - 4.0) <1581D25F-CC07-39B0-90E8-5D4F3CF84EBA> /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS
    0x7fff92916000 -     0x7fff92918ff7  libsystem_sandbox.dylib (358.1.1) <DB9962EF-8898-31CC-9B87-E01F8CE74C9D> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff92919000 -     0x7fff92923ff7  com.apple.NetAuth (5.0 - 5.0) <B9EC5425-D38D-308C-865F-207E0A98BAC7> /System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth
    0x7fff92977000 -     0x7fff9297bff7  com.apple.TCC (1.0 - 1) <AFC32F8F-BCD5-313C-B66E-5AB8591EC066> /System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC
    0x7fff929b8000 -     0x7fff92aaaff7  libiconv.2.dylib (42) <2A06D02F-8B76-3864-8D96-64EF5B40BC6C> /usr/lib/libiconv.2.dylib
    0x7fff92aab000 -     0x7fff92adbff7  libncurses.5.4.dylib (44) <F09809A4-53B9-3E91-A8FA-D3F584C03AA3> /usr/lib/libncurses.5.4.dylib
    0x7fff92c41000 -     0x7fff92c4cff7  libkxld.dylib (2782.1.97) <CB1A1B57-54BE-3573-AE0C-B90ED6BAEEE2> /usr/lib/system/libkxld.dylib
    0x7fff92c4d000 -     0x7fff92ca1fff  libc++.1.dylib (120) <1B9530FD-989B-3174-BB1C-BDC159501710> /usr/lib/libc++.1.dylib
    0x7fff92ca2000 -     0x7fff92fbdfcf  com.apple.vImage (8.0 - 8.0) <1183FE6A-FDB6-3B3B-928D-50C7909F2308> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage
    0x7fff9311f000 -     0x7fff93125fff  libsystem_trace.dylib (72.1.3) <A9E6B7D8-C327-3742-AC54-86C94218B1DF> /usr/lib/system/libsystem_trace.dylib
    0x7fff931c9000 -     0x7fff931daff7  libz.1.dylib (55) <88C7C7DE-04B8-316F-8B74-ACD9F3DE1AA1> /usr/lib/libz.1.dylib
    0x7fff933cb000 -     0x7fff93432ff7  com.apple.datadetectorscore (6.0 - 396.1) <5D348063-1528-3E2F-B587-9E82970506F9> /System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore
    0x7fff93496000 -     0x7fff93522fff  libsystem_c.dylib (1044.1.2) <C185E862-7424-3210-B528-6B822577A4B8> /usr/lib/system/libsystem_c.dylib
    0x7fff93608000 -     0x7fff93608ff7  libkeymgr.dylib (28) <77845842-DE70-3CC5-BD01-C3D14227CED5> /usr/lib/system/libkeymgr.dylib
    0x7fff9386e000 -     0x7fff9386fff7  libsystem_blocks.dylib (65) <9615D10A-FCA7-3BE4-AA1A-1B195DACE1A1> /usr/lib/system/libsystem_blocks.dylib
    0x7fff938e7000 -     0x7fff93903ff7  libsystem_malloc.dylib (53.1.1) <19BCC257-5717-3502-A71F-95D65AFA861B> /usr/lib/system/libsystem_malloc.dylib
    0x7fff93904000 -     0x7fff93963ff3  com.apple.AE (681 - 681) <7F544183-A515-31A8-B45F-89A167F56216> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
    0x7fff93bd8000 -     0x7fff93c76fff  com.apple.Metadata (10.7.0 - 916.1) <CD389631-0F23-3A29-B43A-E3FFB5BC9438> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
    0x7fff93c77000 -     0x7fff93ca1ff7  libdispatch.dylib (442.1.4) <502CF32B-669B-3709-8862-08188225E4F0> /usr/lib/system/libdispatch.dylib
    0x7fff93e44000 -     0x7fff93eb3fff  com.apple.SearchKit (1.4.0 - 1.4.0) <BFD6D876-36BA-3A3B-9F15-3E2F7DE6E89D> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
    0x7fff94155000 -     0x7fff94155fff  com.apple.CoreServices (62 - 62) <9E4577CA-3FC3-300D-AB00-87ADBDDA2E37> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
    0x7fff949c8000 -     0x7fff949c9fff  libDiagnosticMessagesClient.dylib (100) <2EE8E436-5CDC-34C5-9959-5BA218D507FB> /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff94a0b000 -     0x7fff94a16fff  libcommonCrypto.dylib (60061) <D381EBC6-69D8-31D3-8084-5A80A32CB748> /usr/lib/system/libcommonCrypto.dylib
    0x7fff94b36000 -     0x7fff94e69ff7  libmecabra.dylib (666.1) <CAFBC813-4894-3352-9B22-FFF116773A06> /usr/lib/libmecabra.dylib
    0x7fff94e6c000 -     0x7fff94e7dfff  libcmph.dylib (1) <46EC3997-DB5E-38AE-BBBB-A035A54AD3C0> /usr/lib/libcmph.dylib
    0x7fff956ad000 -     0x7fff956baff7  libbz2.1.0.dylib (36) <2DF83FBC-5C08-39E1-94F5-C28653791B5F> /usr/lib/libbz2.1.0.dylib
    0x7fff956c4000 -     0x7fff956c4fff  com.apple.Accelerate.vecLib (3.10 - vecLib 3.10) <01E92F9F-EF29-3745-8631-AEA692F7F29C> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
    0x7fff95aff000 -     0x7fff95b0cff7  libxar.1.dylib (254) <CE10EFED-3066-3749-838A-6A15AC0DBCB6> /usr/lib/libxar.1.dylib
    0x7fff95b0d000 -     0x7fff95b0efff  libSystem.B.dylib (1213) <DA954461-EC6A-3DF0-8551-6FC810627627> /usr/lib/libSystem.B.dylib
    0x7fff95b60000 -     0x7fff95b88fff  libxpc.dylib (559.1.22) <9437C02E-A07B-38C8-91CB-299FAA63083D> /usr/lib/system/libxpc.dylib
    0x7fff95cc0000 -     0x7fff95cc9fff  libsystem_pthread.dylib (105.1.4) <26B1897F-0CD3-30F3-B55A-37CB45062D73> /usr/lib/system/libsystem_pthread.dylib
    0x7fff95cf0000 -     0x7fff95d01ff7  libsystem_coretls.dylib (35.1.2) <EBBF7EF6-80D8-3F8F-825C-B412BD6D22C0> /usr/lib/system/libsystem_coretls.dylib
    0x7fff95d85000 -     0x7fff95d9bff7  libsystem_asl.dylib (267) <F153AC5B-0542-356E-88C8-20A62CA704E2> /usr/lib/system/libsystem_asl.dylib
    0x7fff95d9c000 -     0x7fff95dacff7  libbsm.0.dylib (34) <A3A2E56C-2B65-37C7-B43A-A1F926E1A0BB> /usr/lib/libbsm.0.dylib
    0x7fff95e94000 -     0x7fff9610efff  com.apple.CoreData (110 - 526) <AEEDAF00-D38F-3A15-B3C9-73732940CC55> /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
    0x7fff9610f000 -     0x7fff96169ff7  com.apple.LanguageModeling (1.0 - 1) <ACA93FE0-A0E3-333E-AE3C-8EB7DE5F362F> /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling
    0x7fff9638a000 -     0x7fff9638efff  libsystem_stats.dylib (163.1.4) <1DB04436-5974-3F16-86CC-5FF5F390339C> /usr/lib/system/libsystem_stats.dylib
    0x7fff966ce000 -     0x7fff9685cfff  libBLAS.dylib (1128) <497912C1-A98E-3281-BED7-E9C751552F61> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
    0x7fff9685d000 -     0x7fff96861fff  libpam.2.dylib (20) <E805398D-9A92-31F8-8005-8DC188BD8B6E> /usr/lib/libpam.2.dylib
    0x7fff96862000 -     0x7fff96869ff7  libcompiler_rt.dylib (35) <BF8FC133-EE10-3DA6-9B90-92039E28678F> /usr/lib/system/libcompiler_rt.dylib
    0x7fff96a57000 -     0x7fff96a87fff  libsystem_m.dylib (3086.1) <1E12AB45-6D96-36D0-A226-F24D9FB0D9D6> /usr/lib/system/libsystem_m.dylib
    0x7fff96ab3000 -     0x7fff96adbfff  libsystem_info.dylib (459) <B85A85D5-8530-3A93-B0C3-4DEC41F79478> /usr/lib/system/libsystem_info.dylib
    0x7fff97918000 -     0x7fff97943fff  libc++abi.dylib (125) <88A22A0F-87C6-3002-BFBA-AC0F2808B8B9> /usr/lib/libc++abi.dylib
    0x7fff97944000 -     0x7fff9794cffb  libcopyfile.dylib (118.1.2) <0C68D3A6-ACDD-3EF3-991A-CC82C32AB836> /usr/lib/system/libcopyfile.dylib
    0x7fff9799a000 -     0x7fff97a10fe7  libcorecrypto.dylib (233.1.2) <E1789801-3985-3949-B736-6B3378873301> /usr/lib/system/libcorecrypto.dylib
    0x7fff97a11000 -     0x7fff97a16ff7  libmacho.dylib (862) <126CA2ED-DE91-308F-8881-B9DAEC3C63B6> /usr/lib/system/libmacho.dylib
    0x7fff97a17000 -     0x7fff97a1cfff  com.apple.DiskArbitration (2.6 - 2.6) <0DFF4D9B-2AC3-3B82-B5C5-30F4EFBD2DB9> /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
    0x7fff982bc000 -     0x7fff982d6ff7  libextension.dylib (55.1) <ECBDCC15-FA19-3578-961C-B45FCC994BAF> /usr/lib/libextension.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 1963885
    thread_create: 6
    thread_set_state: 24487

VM Region Summary:
ReadOnly portion of Libraries: Total=142.8M resident=77.7M(54%) swapped_out_or_unallocated=65.1M(46%)
Writable regions: Total=64.2M written=1816K(3%) resident=3356K(5%) swapped_out=0K(0%) unallocated=61.0M(95%)

REGION TYPE                      VIRTUAL
===========                      =======
Dispatch continuations             16.0M
Kernel Alloc Once                     4K
MALLOC                             37.2M
MALLOC (admin)                       16K
STACK GUARD                        56.0M
Stack                              10.1M
VM_ALLOCATE                          44K
__DATA                             5324K
__LINKEDIT                         73.3M
__TEXT                             69.5M
__UNICODE                           544K
shared memory                         4K
===========                      =======
TOTAL                             267.9M

Model: MacBookPro11,3, BootROM MBP112.0138.B11, 4 processors, Intel Core i7, 2.5 GHz, 16 GB, SMC 2.19f12
Graphics: Intel Iris Pro, Intel Iris Pro, Built-In
Graphics: NVIDIA GeForce GT 750M, NVIDIA GeForce GT 750M, PCIe, 2048 MB
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343147533641465238412D50422020
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343147533641465238412D50422020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x134), Broadcom BCM43xx 1.0 (7.15.124.12.10)
Bluetooth: Version 4.3.1f2 15015, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM0512F, 500.28 GB
USB Device: Internal Memory Card Reader
USB Device: Hub
USB Device: DasKeyboard
USB Device: USB2.0 Hub
USB Device: Razer DeathAdder 2013
USB Device: Apple Internal Keyboard / Trackpad
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 17.1

`make install` fails on xcode6p3b branch

/Carthage/Checkouts/Commandant/Carthage/Checkouts/LlamaKit/LlamaKit/Result.swift:108:52: error: 'autoclosure' attribute is now an attribute of the parameter declaration, not its type
public func ??<T>(result: Result<T>, defaultValue: @autoclosure () -> T) -> T {

Crash when processing a file with multibyte characters

Hi, I tried to run jazzy with multibyte texts and
I found it doesn't work with multibyte texts.

It can be reproduced by parsing this code.

/**
 ほげ
 */
class ClassA {
}

I’ve investigated a little bit and I seems like below.
In values from sourcekitd(?) like offset or bodyoffset, a Japanese character is counted as 3.
But NSRange in filteredSubstring counts a multibyte character as 1.
As a result, the range index will be out of bounds.

*** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFString substringWithRange:]: Range {31, 17} out of bounds; string length 47'
abort() called
terminating with uncaught exception of type NSException

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff9517625c __exceptionPreprocess + 172
1   libobjc.A.dylib                     0x00007fff940e2e75 objc_exception_throw + 43
2   CoreFoundation                      0x00007fff9517610c +[NSException raise:format:] + 204
3   CoreFoundation                      0x00007fff95095b4d -[__NSCFString substringWithRange:] + 125
4   SourceKittenFramework               0x000000010850d4ef _TFE21SourceKittenFrameworkCSo8NSString17filteredSubstringfS0_FTSi3endSi_SS + 415
5   SourceKittenFramework               0x000000010850d5d2 _TToFE21SourceKittenFrameworkCSo8NSString17filteredSubstringfS0_FTSi3endSi_SS + 50
6   SourceKittenFramework               0x0000000108511be8 _TFV21SourceKittenFramework4File16parseDeclarationfS0_FGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__GSqSS_ + 1544
7   SourceKittenFramework               0x0000000108513d5e _TFV21SourceKittenFramework4File17processDictionaryfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GS1_SSPS3___ + 1198
8   SourceKittenFramework               0x000000010851cb17 _TFFV21SourceKittenFramework4File15newSubstructureFS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GSqGSaPS3____U0_FPS3__PS3__ + 471
9   SourceKittenFramework               0x0000000108519a92 _TPA__TFFV21SourceKittenFramework4File15newSubstructureFS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GSqGSaPS3____U0_FPS3__PS3__ + 226
10  libswiftCore.dylib                  0x0000000108621426 _TFVSs17MapCollectionViewg9subscriptFQQ_5IndexQ0_ + 342
11  libswiftCore.dylib                  0x0000000108623727 _TTWVSs17MapCollectionViewSs14CollectionTypeFS0_g9subscriptFQQPS0_5IndexQQS1_9Generator7Element + 935
12  libswiftCore.dylib                  0x000000010861ec0e _TTWVSs26LazyRandomAccessCollectionSs14CollectionTypeFS0_g9subscriptFQQPS0_5IndexQQS1_9Generator7Element + 478
13  libswiftCore.dylib                  0x0000000108584d59 _TFSs34_copyCollectionToNativeArrayBufferUSs14CollectionType_USs13GeneratorType__Ss16ForwardIndexType_Ss18_SignedIntegerType_Ss33_BuiltinIntegerLiteralConvertible___FQ_GVSs22_ContiguousArrayBufferQQ_8_Element_ + 873
14  libswiftCore.dylib                  0x000000010861e9f6 _TTWVSs26LazyRandomAccessCollectionSs12SequenceTypeFS0_oi2tgUS0__USs13GeneratorType___fMQPS0_FTS2_TVSs24_CopyToNativeArrayBufferT___GVSs22_ContiguousArrayBufferQQS2_9Generator7Element_ + 406
15  libswiftCore.dylib                  0x00000001085a3593 _TFSa3mapU__fGSaQ__U__FFQd__Q_GSaQ__ + 1283
16  SourceKittenFramework               0x0000000108515c16 _TFV21SourceKittenFramework4File15newSubstructurefS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GSqGSaPS3____ + 918
17  SourceKittenFramework               0x000000010851423c _TFV21SourceKittenFramework4File17processDictionaryfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__GS1_SSPS3___ + 2444
18  SourceKittenFramework               0x00000001084f7232 _TFV21SourceKittenFramework9SwiftDocsCfMS0_FT4fileVS_4File10dictionaryGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__S0_ + 578
19  SourceKittenFramework               0x00000001084f6f89 _TFV21SourceKittenFramework9SwiftDocsCfMS0_FT4fileVS_4File9argumentsGSaSS__S0_ + 521
20  sourcekitten                        0x000000010847ab6f _TFV12sourcekitten10DocCommand18runSwiftSingleFilefMS0_FGSaSS_GO8LlamaKit6ResultT__ + 2127
21  sourcekitten                        0x000000010847c6e2 _TFFV12sourcekitten10DocCommand3runFS0_FO10Commandant11CommandModeGO8LlamaKit6ResultT__U_FVS_10DocOptionsGS4_T__ + 338
22  sourcekitten                        0x000000010847cae8 _TTRXFo_oV12sourcekitten10DocOptions_oGO8LlamaKit6ResultT___XFo_iS0__oGS2_T___ + 56
23  LlamaKit                            0x000000010856574e _TFO8LlamaKit6Result7flatMapU__fGS0_Q__U__FFQd__GS0_Q__GS0_Q__ + 334
24  sourcekitten                        0x0000000108479559 _TFV12sourcekitten10DocCommand3runfS0_FO10Commandant11CommandModeGO8LlamaKit6ResultT__ + 233
25  sourcekitten                        0x000000010847bf17 _TTWV12sourcekitten10DocCommand10Commandant11CommandTypeFS2_3runUS2___fRQPS2_FOS1_11CommandModeGO8LlamaKit6ResultT__ + 119
26  Commandant                          0x00000001084c5ddf _TFC10Commandant15CommandRegistry10runCommandfS0_FTSS9argumentsGSaSS__GSqGO8LlamaKit6ResultT___ + 431
27  Commandant                          0x00000001084c69e1 _TFC10Commandant15CommandRegistry4mainfS0_FT14defaultCommandPS_11CommandType_12errorHandlerFCSo7NSErrorT__T_ + 1825
28  sourcekitten                        0x0000000108487e7e top_level_code + 1630
29  sourcekitten                        0x0000000108487eaa main + 42
30  libdyld.dylib                       0x00007fff8c85d5fd start + 1
31  ???                                 0x0000000000000033 0x0 + 51

Extensions pick up documentation from other elements

SourceKitten pulls documentation from other elements for extensions. Here's an example where SourceKitten ignores an extension’s doc comment and instead copies the extended class’s doc comment.

That example is innocuous enough, almost reasonable, but I noticed this problem in a more complex project where a public extension was pulling a :nodoc: from who knows where. Both the extension and the class it extended were public, but Jazzy ignored the extension because of this spurious SourceKitten behavior. (The extension that got the mystery :nodoc: is here. I worked around it locally with a cludge in jazzy to ignore nodoc whenever it appears on an extension.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.