{"id":21443631,"url":"https://github.com/codeface-io/lspservicekit","last_synced_at":"2025-07-14T18:30:56.140Z","repository":{"id":63907005,"uuid":"387231008","full_name":"codeface-io/LSPServiceKit","owner":"codeface-io","description":"Talk to LSPService in Swift","archived":false,"fork":false,"pushed_at":"2023-06-28T16:38:52.000Z","size":2965,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-17T17:36:58.412Z","etag":null,"topics":["language-server","language-server-protocol","lsp","lspservice","swift","websocket"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeface-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-18T17:21:15.000Z","updated_at":"2023-09-13T04:56:01.000Z","dependencies_parsed_at":"2023-02-14T07:45:25.322Z","dependency_job_id":null,"html_url":"https://github.com/codeface-io/LSPServiceKit","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeface-io%2FLSPServiceKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeface-io%2FLSPServiceKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeface-io%2FLSPServiceKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeface-io%2FLSPServiceKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeface-io","download_url":"https://codeload.github.com/codeface-io/LSPServiceKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225990436,"owners_count":17556154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["language-server","language-server-protocol","lsp","lspservice","swift","websocket"],"created_at":"2024-11-23T02:12:43.258Z","updated_at":"2024-11-23T02:12:43.889Z","avatar_url":"https://github.com/codeface-io.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LSPServiceKit\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fcodeface-io%2FLSPServiceKit%2Fbadge%3Ftype%3Dswift-versions\u0026style=flat-square)](https://swiftpackageindex.com/codeface-io/LSPServiceKit) \u0026nbsp;[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fcodeface-io%2FLSPServiceKit%2Fbadge%3Ftype%3Dplatforms\u0026style=flat-square)](https://swiftpackageindex.com/codeface-io/LSPServiceKit) \u0026nbsp;[![](https://img.shields.io/badge/Documentation-DocC-blue.svg?style=flat-square)](https://swiftpackageindex.com/codeface-io/LSPServiceKit/documentation) \u0026nbsp;[![](https://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat-square)](LICENSE)\n\n👩🏻‍🚀 *This project [is still a tad experimental](#development-status). Contributors and pioneers welcome!*\n\n## What?\n\nLSPServiceKit helps Swift apps use [LSPService](https://github.com/codeface-io/LSPService):\n\n![Context](Documentation/Context_Diagram_dark.png#gh-dark-mode-only)\n![Context](Documentation/Context_Diagram_light.png#gh-light-mode-only)\n\n## How?\n\n### Get an LSP Server\n\n`LSPService` precisely reflects the LSPService API, so the first call here translates to a websocket connection request on `http://127.0.0.1:8080/lspservice/api/language/Swift/websocket`:\n\n```swift\n// Connect to Swift LSP websocket\nlet webSocketConnection = try LSPService.api.language(\"Swift\").websocket.connectToLSPWebSocket()\n\n// Create \"server\" with websocket connection\nlet server = LSP.Server(connection: webSocketConnection, languageName: \"Swift\")\n```\n\nOr quicker:\n\n```swift\nlet server = try LSPService.connectToLSPServer(forLanguageNamed: \"Swift\")\n```\n\nNow, you'd probably wanna set the server's three handlers:\n\n```swift\nawait server.handleNotificationFromServer { notification in\n    // handle notification\n}\n            \nawait server.handleErrorOutputFromServer { errorOutput in\n    // handle errorOutput\n}\n\nawait server.handleConnectionShutdown { error in\n    // handle error\n}\n```\n\n### Initialize an LSP Server\n\n```swift\n// Initialize server with codebase folder\n_ = try await server.request(.initialize(folder: codebaseFolderURL))\n\n// Notify server that we are initialized\ntry await server.notify(.initialized)\n```\n\n### Use LSP.ServerManager\n\nAll the above can be achieved quicker:\n\n```swift\n// Locate the codebase\nlet codebase = LSP.CodebaseLocation(folder: codebaseFolderURL,\n                                    languageName: \"Swift\",\n                                    codeFileEndings: [\"swift\"])\n\n// Create and initialize the LSP server\nlet server = try await LSP.ServerManager.shared.initializeServer(for: codebase)\n```\n\n## Architecture\n\nHere is the internal architecture (composition and essential dependencies) of the code folder:\n\n![](Documentation/architecture.png)\n\nThe above image was generated with the [Codeface](https://codeface.io) app.\n\n## Development Status\n\nFrom version/tag 0.1.0 on, LSPServiceKit adheres to [semantic versioning](https://semver.org). So until it has reached 1.0.0, its API may still break frequently, but this will be expressed in version bumps.\n\nLSPServiceKit is already being used in production, but [Codeface](https://codeface.io) is still its primary client. LSPServiceKit will move to version 1.0.0 as soon as its basic practicality and conceptual soundness have been validated by serving multiple real-world clients.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeface-io%2Flspservicekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeface-io%2Flspservicekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeface-io%2Flspservicekit/lists"}