• Stars
    star
    528
  • Rank 83,941 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Swift Auto Completions for any Text Editor

SourceKittenDaemon

Swift Auto Completion Helper

Travis

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

Homebrew

(Coming Soon)

Source

  1. Clone the repository
  2. 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:

Atom

autocomplete-swift is a working Atom plugin offering Swift auto completion support via SourceKittenDaemon.

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

Linux support is currently in development. If you're interested in helping out, here're the steps to run it on Linux:

  1. Install docker
  2. Install the Swift Dockerfile (i.e. docker pull ibmcom/swift-ubuntu)
  3. Run make linuxtest

Troubleshooting

Byte offset vs character offset

The X-Offset header takes a byte offset as opposed to a character offset. For most characters this will make no difference. However special characters such as ยฉ are counted as two bytes is UTF8. See this issue for more details.

Thanks

  • A lot of thanks go to Nathan Kot who wrote most parts of this.
  • Tomoya Kose for updating the project so it works with Homebrew again

More Repositories

1

Ebou

A cross platform Mastodon Client written in Rust
Rust
464
star
2

CoreValue

Lightweight Framework for using Core Data with Value Types
Swift
457
star
3

postsack

Visually cluster your emails by sender, domain, and more to identify waste
Rust
347
star
4

twitvault

Easily Archive and Search Your Twitter Data with our Syncable Desktop App
Rust
143
star
5

appventure-blog

My Clojure/Static-Based Blog.
CSS
82
star
6

OceanBar

A fancy Digital Ocean API client for Mac OS X 10.9+
Objective-C
70
star
7

gitsi

Git Status Interactive
C
36
star
8

bevy_quickmenu

A simple-to-use menu system for Bevy which supports gamepad, keyboard or mouse navigation
Rust
23
star
9

Swijito

An Apple iCloud Photostream Client written in Swift
Swift
21
star
10

TextMateSwiftCompletion

Swift Completions for Textmate
Swift
19
star
11

SwiftWadReader

Example of how to use Swift 3 in order to read a Doom WAD file
Swift
18
star
12

rust-catalyst-example

Example Project to show how to build a Catalyst static library with Rust
Swift
17
star
13

navicula

Rust
14
star
14

rust-ios-android-example

Rust
13
star
15

VimConfiguration

My new, personal, vim configuration. Based on Vundle.
Vim Script
13
star
16

CX11.swift

Swift Package for X11
Swift
13
star
17

swift-x11-example

A simple example that shows how to write a X11 app on Linux in Swift using the new package manager
Swift
12
star
18

NSSpain2020Code

The code for my NSSpain 2020 Talk: GeometryReader, View Preferences and Anchors - SwiftUI tales from the Hyperdeck
Swift
9
star
19

Parsepaper

Link Taskpaper files with Git commit so that commit messages automatically include the @done tasks from the task paper file.
Ruby
9
star
20

Difflocal

Compare Localizable.strings files for changes
Python
8
star
21

pragma2017-example-code

Unidirectional Data Flow Examples
Swift
6
star
22

tryswift-macos-workshop

Swift
6
star
23

watchout

Automatically run scripts and reload images
Rust
6
star
24

SpacemacsConfig

My personal Spacemacs config.
Emacs Lisp
5
star
25

belum

A lightweight, experimental, type-safe dependency injection container (cough) for Swift
Swift
5
star
26

cljs-animated-wwdc2014

Animated WWDC 2014 Logo in ClojureScript
JavaScript
4
star
27

luapsql

A high speed C binding to PostgreSQL's libpq for quick access to databases. Includes support for array columns and json columns. Forked from Luis Carvalho.
C
3
star
28

SwiftHeroesCatalystAppKit

Swift
3
star
29

nsspain18-cocoa-bindings-workshop

Swift
3
star
30

Cederic

Agents for Swift: Non-blocking, thread-safe, asynchrounous access & modification of shared data/state
Swift
3
star
31

timezone-abbreviations

Translate non-standardized abbreviations such as 'GMT' to timezone information on a best guess basis.
Rust
3
star
32

senor-pacbomber

The unholy combination of PacMan and Bomberman: El Seรฑor Pacbomber. For the Bevy Jam #2
Rust
2
star
33

tted

Render rich text and emoji on the GPU or CPU using Forma
Rust
2
star
34

cryptsy-python-api

A Python implementation of the Cryptsy-API (https://www.cryptsy.com/)
Python
2
star
35

appventure.me-codebase

The Jekyll Code that powers appventure.me + The git that has all the posts
Ruby
2
star
36

Google-Web-History-Downloader

Google Web History Downloader
Ruby
2
star
37

uniffi-swift-async-example

Quick example showing how to use uniffi with swift and async
Swift
2
star
38

nsspain2023workshop

Rust
2
star
39

aargh

No Chrome Fullscreen Mac OS X Browser for HTML5 Slideshows/Presentations
Objective-C
1
star
40

CatalystMaterial

Swift
1
star
41

appventure

Appventure Codebase
HTML
1
star
42

techou

Custom Rust static site engine. Terrible code, probably full of bugs. Works for my use cases.
Rust
1
star
43

appbuilders2022

Shell
1
star
44

PhotoSetManager

Group loads of pictures based on metadata
Objective-C
1
star
45

lempel

Gzip for Swift as a Carthage-Compatible framework
Swift
1
star
46

emlx

Parse Apple Mail.app `Emlx` Files.
Rust
1
star
47

EmacsConfiguration

My private Emacs configuration utilizing Evil to feel almost like vim
Emacs Lisp
1
star
48

Vim---Bash-Configuration

My Vim Configuration, based on http://github.com/evilchelu/braid, and my Bash Config
Python
1
star
49

GameAssetOrganizer

A Mac tool that helps in sorting game assets into a level pack / level structure so that these can be transformed into sprite sheets.
Objective-C
1
star
50

stripe_bug_cocoa_example

There's an issue on Mac OS X 10.8 and 10.9 where CSS/JS Animation heavy contents in a Layer-Backed WebView do not draw correctly. This affects the Stripe Checkout form which does not display at all on those older operating systems. The bug seems to be fixed in 10.10 Yosemite.
Objective-C
1
star
51

parse_most_visited_websites

A Simple collection for scripts to generate a list of frequently visited websites and analyze it in order to find out which is the best partitioning scheme for a PostgreSQL database partitioning. Also includes code to generate the necessary SQL.
Clojure
1
star