GithubHelp home page GithubHelp logo

ikesyo / sourcekit-lsp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apple/sourcekit-lsp

0.0 2.0 0.0 713 KB

Language Server Protocol implementation for Swift and C-based languages

License: Apache License 2.0

Swift 97.43% C 1.19% Python 1.33% C++ 0.04%

sourcekit-lsp's Introduction

SourceKit-LSP

SourceKit-LSP is an implementation of the Language Server Protocol (LSP) for Swift and C-based languages. It provides features like code-completion and jump-to-definition to editors that support LSP. SourceKit-LSP is built on top of sourcekitd and clangd for high-fidelity language support, and provides a powerful source code index as well as cross-language support. SourceKit-LSP supports projects that use the Swift Package Manager.

Getting Started

SourceKit-LSP is under heavy development! The best way to try it out is to install a recent Swift development toolchain from https://swift.org/download/#snapshots. Make sure you build your package with the same toolchain as you got sourcekit-lsp from to ensure compatibility.

Using a Swift Toolchain from Swift.org

  1. Install the latest master or 5.1 development toolchain snapshot from https://swift.org/download/#snapshots.

  2. Configure your editor to use the sourcekit-lsp executable from the toolchain snapshot. See Editors for more information about editor integration.

  3. Build the project you are working on with swift build using the same toolchain snapshot. The language server depends on the build to provide module dependencies and to update the global index.

Development

For more information about developing SourceKit-LSP itself, see Development.

Indexing While Building

SourceKit-LSP uses a global index called IndexStoreDB to provide features that cross file or module boundaries, such as jump-to-definition or find-references. To efficiently create an index of your source code we use a technique called "indexing while building". When the project is compiled for debugging using swift build, the compiler (swiftc or clang) automatically produces additional raw index data that is read by our indexer. Producing this information during compilation saves work and ensures that any time the project is built the index is updated and fully accurate.

In the future we intend to also provide automatic background indexing so that we can update the index in between builds or to include code that's not always built like unit tests. In the meantime, building your project should bring our index up to date.

Status

SourceKit-LSP is still in early development, so you may run into rough edges with any of the features. The following table shows the status of various features when using the latest development toolchain snapshot. See Caveats for important known issues you may run into.

Feature Status Notes
Swift
C/C++/ObjC As of swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a clangd is available but hitting frequent assertion failures.
Code completion
Quick Help (Hover)
Diagnostics
Fix-its
Jump to Definition
Find References
Background Indexing Build project to update the index using Indexing While Building
Workspace Symbols
Refactoring
Formatting
Folding
Syntax Highlighting Not currently part of LSP.
Document Symbols

Caveats

  • SwiftPM build settings are not updated automatically after files are added/removed.

    • Workaround: close and reopen the project after adding/removing files
  • SourceKit-LSP does not update its global index in the background, but instead relies on indexing-while-building to provide data. This only affects global queries like find-references and jump-to-definition.

    • Workaround: build the project to update the index

sourcekit-lsp's People

Contributors

abdullahselek avatar aciidb0mb3r avatar adamnemecek avatar ainopara avatar akyrtzi avatar benlangmuir avatar chiroptical avatar danielmartin avatar davidgoldman avatar dduan avatar eeckstein avatar firehed avatar gmittert avatar jameshartt avatar krzyzanowskim avatar literalpie avatar mackoj avatar millenomi avatar rintaro avatar rockbruno avatar satishbabariya avatar shahmishal avatar trzyipolkostkicukru avatar xwu avatar yhkaplan avatar

Watchers

 avatar  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.