Code Monkey home page Code Monkey logo

vscode-swift-development-environment's Introduction

Swift Development Environment

Build Status Visual Studio Code Version Swift Version SwiftPM compatible Platforms License Apache

SDE adds Swift code completion and hover help to Visual Studio Code on macOS and Linux.

Fork Notice: This is the new home of SDE initially been developed by @jinmingjian. It is now maintained by @vknabel. jinmingjian/sde is no longer maintained and does only support Swift 3. This fork supports Swift 3 and 4.

preview

Installation

  1. Install the extension itself.

  2. Install the companion project sourcekite.

    $ git clone https://github.com/vknabel/sourcekite
    $ cd sourcekite
    
    # For Linux
    # Ensure LD_LIBRARY_PATH contains /your/swift/usr/lib
    # And have sudo ln -s /usr/lib/sourcekitdInProc /your/swift/usr/lib/libsourcekitdInProc.so
    $ swift build -Xlinker -l:sourcekitdInProc -c release
    
    # For macOS (when using swiftenv or multiple Toolchains)
    $ swift build -Xswiftc -framework -Xswiftc sourcekitd -Xswiftc -F -Xswiftc /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/lib -Xlinker -rpath -Xlinker /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/lib -c release
    
    # For macOS (using Xcode's Toolchain)
    $ swift build -Xswiftc -framework -Xswiftc sourcekitd -Xswiftc -F -Xswiftc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ -Xlinker -rpath -Xlinker /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ -c release
  3. Add the absolute path to your compiled sourcekite binary swift.path.sourcekite to your vscode settings as /path/to/your/sourcekite-bin/.build/release/sourcekite.

If you experience any problems during installation, file an issue or write me an email. All kind of feedback helps especially when trying to automate this.

Debugging

SDE has a built-in Swift debugger which has been deprecated. Instead use LLDB Debugger which powers more features and is more stable.

An example config can be seen below. program should contain the path to your built executable, the preLaunchTask is optional, but will run swift build before each debug session to keep your binaries up to date.

Note: Currently I don't know of any reliable solution to debug your Swift tests. If you do, please file an issue or write me an email.

// .vscode.json/launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Run your Executable",
            "program": "${workspaceFolder}/.build/debug/your-executable",
            "args": [],
            "cwd": "${workspaceFolder}",
            "preLaunchTask": "swift-build"
        }
}
// .vscode.json/tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "swift-build",
            "type": "shell",
            "command": "swift build"
        }
}

Contributors

FAQ

How to contribute to this project?

Any feedback helps.

If you mean contributions to the sources, this is truely another topic. The experience of using an editor is much different than that of developing one. It might be a bit more painful than you think. But if you would like to, welcome!

There aren't too much documents about the development of this project. If you have any questions or interests, don't hesitate to file an issue or write me an email. I will help you and then drop more readings as time goes by. This is the way of "open source".

How do I get autocompletion for UIKit?

Just add "sde.sourcekit.compilerOptions": ["-target", "arm64-apple-ios11.0"] to your workspace settings in Visual Studio Code and restart it.

Other questions?

If so, file an issue, please :)

License

Apache License v2.

3rd-party Sources Thanks

  1. dbgmits, very nice structure of sources, but of which in my heavy modification to support non-MI and much more

vscode-swift-development-environment's People

Contributors

felix91gr avatar jinmingjian avatar vknabel 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.