Giter Club home page Giter Club logo

sourcekittendaemon's Introduction

SourceKittenDaemon

Swift Auto Completion Helper

This is a simple daemon that can read Xcode Swift projects and offers auto completion for Swift files and more over a built-in webserver. Effectively, this allows any kind of editor like Vim, Emacs, Sublime, or Atom to support Swift, Auto Completion, and Xcode projects.

It includes an example, very simple, Xcode like, editor (see SwiftCode folder) which explains how to use / embedd the actual SourceKittenDaemon.

Here's a video showing the example editor in action:

SwiftCode Editor Example

Features

  • Get completions for current position in document
  • Get completions for edited, unsaved files (via temporary files)
  • Return files in project
  • Parse Xcode project and understand compiler arguments, targets, etc
  • Communication over http for easy integration in various editors

SourceKit

This app uses the fantastic SourceKitten framework without which none of this would be possible. SourceKittenDaemon is really just a small wrapper that keeps an Xcode Project indexer running and offers a nice way to query Xcode Project properties and completions via a comfortable interface.

Using It

Have a look at the Protocol.org file, which explains how to start and use the daemon.

Building / Installation

PKG

You'll find an installable package under the releases tab

Source

  1. Clone the repository
  2. Update the submodules git submodule update --init --recursive
  3. Build the frameworks carthage bootstrap --no-use-binaries --platform Mac
  4. Install via make install

SwiftCode Example Editor

You'll find a zip file under the releases tab

Using it in an editor

Have a look at the SwiftCode example project, or at the existing editor integrations (below). Alternatively, the communication protocol is outlined in the Protocol.org file in this repository.

Editor Integrations

Emacs

SourceKittenDaemon is used in the company-sourcekit Emacs Swift plugin:

TextMate

There's a working implementation for TextMate here.

TextMate Example

YouTube Video

SwiftCode

This is a very simple, featureless reference implementation to see how to embed SourceKittenDaemon into an editor. It offers:

  • Reading Xcode Projects
  • Selecting / Editing / Saving files
  • Getting completions for files either when you enter a "." or when you hit the ESC key.

This is a very simple editor and no sane person should try to write code with it. It is only meant to show how to embed the daemon.

Linux

SourceKittenDaemon is not Linux-Ready yet, but I'll investigate this in the next days. Also, since it is very dependent upon the SourceKitten and Taylor frameworks, it won't work under Linux until those have been ported, too. The background daemon, SourceKitD, is available as Open Source via Apple's Swift repository.

Thanks

A lot of thanks go to Nathan Kot who wrote most parts of this.

sourcekittendaemon's People

Contributors

terhechte avatar nathankot avatar lucasderraugh avatar

Watchers

Carabineiro avatar

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.