Latest 0.6.4
Homepage https://github.com/ChimeHQ/SwiftLSPClient
License BSD-3-Clause
Platforms osx 10.10
Dependencies Result
Authors

Build Status
Carthage compatible
CocoaPods

This is a Swift library for interacting with Language Server Protocol implementations.

An LSP server provides rich information about source code. An LSP client consumes this information. This library is all about the client side.

Example

import SwiftLSPClient

let executablePath = "path/to/your/executable-lsp-server"
let host = LanguageServerProcessHost(path: executablePath, arguments: [])

host.start { (server) in
    guard let server = server else {
        Swift.print("unable to launch server")
        return
    }

    let processId = Int(ProcessInfo.processInfo.processIdentifier)
    let capabilities = ClientCapabilities(workspace: nil, textDocument: nil, experimental: nil)

    let params = InitializeParams(processId: processId,
                                  rootPath: nil,
                                  rootURI: nil,
                                  initializationOptions: nil,
                                  capabilities: capabilities,
                                  trace: Tracing.off,
                                  workspaceFolders: nil)

    server.initialize(params: params, block: { (result) in
        switch result {
        case .failure(let error):
            Swift.print("unable to initialize (error)")
        case .success(let value):
            Swift.print("initialized (value)")
        }
    })
}

Supported Features

The LSP specification is large, and this library currently does not implement it all. The intention is to support the 3.x specification, but be as backwards-compatible as possible with pre-3.0 servers.

Feature Supported
window/showMessage
window/showMessageRequest
window/logMessage
telemetry/event
client/registerCapability
client/unregisterCapability
workspace/workspaceFolders
workspace/didChangeWorkspaceFolders
workspace/didChangeConfiguration
workspace/configuration
workspace/didChangeWatchedFiles
workspace/symbol
workspace/executeCommand
workspace/applyEdit
textDocument/didOpen
textDocument/didChange
textDocument/willSave
textDocument/willSaveWaitUntil
textDocument/didSave
textDocument/didClose
textDocument/publishDiagnostics
textDocument/completion
completionItem/resolve
textDocument/hover
textDocument/signatureHelp
textDocument/declaration
textDocument/typeDefinition
textDocument/implementation
textDocument/references
textDocument/documentHighlight
textDocument/documentSymbol
textDocument/codeAction
textDocument/codeLens
codeLens/resolve
textDocument/documentLink
documentLink/resolve
textDocument/documentColor
textDocument/colorPresentation
textDocument/formatting
textDocument/rangeFormatting
textDocument/onTypeFormatting
textDocument/rename
textDocument/prepareRename
textDocument/foldingRange

Integration

Carthage

github "ChimeHQ/SwiftLSPClient"

CocoaPods

pod 'SwiftLSPClient'

Building

The project is being developed with Xcode 10.1 running on macOS 10.14 Mojave. After a checkout, you can install the dependencies with Carthage.

carthage update --platform macOS

Suggestions or Feedback

We’d love to hear from you! Get in touch via twitter, an issue, or a pull request.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Latest podspec

{
    "name": "SwiftLSPClient",
    "version": "0.6.4",
    "summary": "Swift client library for interacting with Language Server Protocol-compatible servers",
    "homepage": "https://github.com/ChimeHQ/SwiftLSPClient",
    "license": {
        "type": "BSD-3-Clause",
        "file": "LICENSE"
    },
    "authors": {
        "Matt Massicotte": "[email protected]"
    },
    "social_media_url": "https://twitter.com/chimehq",
    "source": {
        "git": "https://github.com/ChimeHQ/SwiftLSPClient.git",
        "tag": "0.6.4"
    },
    "source_files": "SwiftLSPClient/**/*.swift",
    "dependencies": {
        "Result": [
            "~> 4.0"
        ]
    },
    "platforms": {
        "osx": "10.10"
    },
    "cocoapods_version": ">= 1.4.0",
    "swift_version": "4.2",
    "testspecs": [
        {
            "name": "Tests",
            "test_type": "unit",
            "source_files": "SwiftLSPClientTests/**/*.swift"
        }
    ]
}

Pin It on Pinterest

Share This