Home

Awesome

skit

skit is a dead simple CLI for interacting with sourcekit.

Usage

Here's an example of a request that returns the structure of the source:

Create a request.yaml:

key.request: source.request.editor.open
key.name: "example.swift"
key.sourcetext: "struct Foo {}"

Run skit:

$ skit request.yaml

Get the response from sourcekitd:

{
  "key.offset": 0,
  "key.length": 14,
  "key.diagnostic_stage": "source.diagnostic.stage.swift.parse",
  "key.syntaxmap": [
    {
      "key.kind": "source.lang.swift.syntaxtype.keyword",
      "key.offset": 0,
      "key.length": 6
    },
    {
      "key.kind": "source.lang.swift.syntaxtype.identifier",
      "key.offset": 7,
      "key.length": 3
    }
  ],
  "key.substructure": [
    {
      "key.kind": "source.lang.swift.decl.struct",
      "key.accessibility": "source.lang.swift.accessibility.internal",
      "key.name": "Foo",
      "key.offset": 0,
      "key.length": 13,
      "key.nameoffset": 7,
      "key.namelength": 3,
      "key.bodyoffset": 12,
      "key.bodylength": 0
    }
  ]
}

sourcekit supports many request types, for details on what you can do see the protocol documentation.

Installation

Homebrew

$ brew install keith/formulae/skit

Docker (hub page)

$ docker pull smileykeith/skit:TAG

NOTE: The tags for docker line up with the git tags on this repo.

Manually

$ make install

Resources