All Projects → keith → skit

keith / skit

Licence: MIT license
yaml -> sourcekit -> json

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to skit

Swiftshield
🔒 Swift Obfuscator that protects iOS apps against reverse engineering attacks.
Stars: ✭ 1,906 (+6472.41%)
Mutual labels:  sourcekit
Jazzy
Both Swift and Objective-C projects are supported.
Stars: ✭ 7,078 (+24306.9%)
Mutual labels:  sourcekit
coc-sourcekit
Swift language server extension using sourcekit-lsp for coc.nvim.
Stars: ✭ 61 (+110.34%)
Mutual labels:  sourcekit
emacs-sourcekit-lsp
Emacs LSP client for SourceKit-LSP (https://github.com/apple/sourcekit-lsp), a Swift/Objective-C/C++ language server created by Apple
Stars: ✭ 25 (-13.79%)
Mutual labels:  sourcekit
Bridgecraft
Generate Swift interface for ObjC bridging headers
Stars: ✭ 62 (+113.79%)
Mutual labels:  sourcekit

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

  • The protocol documentation defines most of the requests you can use with sourcekit

  • SourceKitten provides a much better interface for specific requests, meaning you don't need to deal with the implementation details of sourcekit

  • sourcekit is open source! so you can read the source for more details on how the pieces fit together

  • JP Simard (the author of SourceKitten) has written some blog posts and done a talk about how sourcekit works

  • If you're interested in reproducing something that Xcode does, you can see the communication between Xcode and sourcekitd by setting SOURCEKIT_LOGGING=3 and launching Xcode

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].