{"id":50879644,"url":"https://github.com/hessesian/kmp-lsp","last_synced_at":"2026-06-15T13:00:28.518Z","repository":{"id":348731226,"uuid":"1199612034","full_name":"Hessesian/kmp-lsp","owner":"Hessesian","description":"Fast, low-memory LSP server for Kotlin and Java, written in Rust","archived":false,"fork":false,"pushed_at":"2026-06-09T12:56:24.000Z","size":130373,"stargazers_count":112,"open_issues_count":6,"forks_count":7,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T14:23:52.320Z","etag":null,"topics":["android","helix","java","kotlin","kotlin-multiplatform","language-server","lsp","neovim","rust","swift","tree-sitter"],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/Hessesian.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-02T14:22:43.000Z","updated_at":"2026-06-09T14:06:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Hessesian/kmp-lsp","commit_stats":null,"previous_names":["hessesian/kotlin-lsp","hessesian/kmp-lsp"],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/Hessesian/kmp-lsp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hessesian%2Fkmp-lsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hessesian%2Fkmp-lsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hessesian%2Fkmp-lsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hessesian%2Fkmp-lsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hessesian","download_url":"https://codeload.github.com/Hessesian/kmp-lsp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hessesian%2Fkmp-lsp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34363557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["android","helix","java","kotlin","kotlin-multiplatform","language-server","lsp","neovim","rust","swift","tree-sitter"],"created_at":"2026-06-15T13:00:17.171Z","updated_at":"2026-06-15T13:00:28.499Z","avatar_url":"https://github.com/Hessesian.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kmp-lsp\n# Kotlin Multiplatform Language Server Provider (Kotlin, Java, Swift)\n\n[![crates.io](https://img.shields.io/crates/v/kmp-lsp)](https://crates.io/crates/kmp-lsp)\n[![release](https://img.shields.io/github/v/release/Hessesian/kmp-lsp)](https://github.com/Hessesian/kmp-lsp/releases/latest)\n[![build](https://img.shields.io/github/actions/workflow/status/Hessesian/kmp-lsp/ci.yml)](https://github.com/Hessesian/kmp-lsp/actions/workflows/ci.yml)\n[![license](https://img.shields.io/crates/l/kmp-lsp)](LICENSE)\n\nA fast, low-memory LSP server for **Kotlin**, **Java**, and **Swift**, written in Rust.  \nBuilt with [tree-sitter](https://tree-sitter.github.io/) — instant startup, no JVM.\n\n![kmp-lsp demo](demo/demo.gif)\n\n## Install\n\n```bash\ncargo install kmp-lsp\n```\n\n\u003e No Cargo? Get it at [rustup.rs](https://rustup.rs). After install, `kmp-lsp` is at `~/.cargo/bin/` — make sure it's on your `PATH`.\n\n**Optional:** Install `fd` and `rg` (ripgrep) for faster file discovery and cross-file search.\n\n### Other install methods\n\n**One-liner (Linux / macOS)** — installs both `kmp-lsp` and the native JAR indexer:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/Hessesian/kmp-lsp/main/install.sh | bash\n```\n\n**One-liner (Windows, PowerShell)** — installs both `kmp-lsp.exe` and `kmp-jar-indexer.exe`:\n\n```powershell\niwr -useb https://raw.githubusercontent.com/Hessesian/kmp-lsp/main/install.ps1 | iex\n```\n\n**cargo-binstall** — downloads the pre-built binary (no compilation):\n\n```bash\ncargo binstall kmp-lsp\n```\n\n**mise** — via the aqua backend:\n\n```bash\nmise use -g aqua:Hessesian/kmp-lsp\n```\n\n**mason.nvim** (Neovim) — once listed in the registry:\n\n```lua\nrequire(\"mason\").setup()\nrequire(\"mason-lspconfig\").setup({ ensure_installed = { \"kotlin_ls\" } })\n```\n\n### JAR indexer sidecar\n\nFor full JAR/library type information (Compose, AndroidX, Kotlin stdlib docs), the native sidecar is needed. The `install.sh` and mise/aqua channels install both binaries automatically. cargo-binstall and mason.nvim install only `kmp-lsp` — in those cases, download the matching tarball manually to get the sidecar too:\n\n```bash\n# Linux x86_64 example — both binaries extracted from one tarball\ntar -xzf kmp-lsp-linux-x86_64.tar.gz\nmv kmp-lsp ~/.cargo/bin/\nmv kmp-jar-indexer ~/.cargo/bin/\n```\n\nThe sidecar is a self-contained native binary — **no JVM required**. Starts in ~4 ms.\n\n\u003e **Fallback**: if the native sidecar is absent but `java` is on your PATH, `kmp-lsp` automatically falls back to the JAR version.\n\n## AI agent integration\n\nkmp-lsp ships a ready-made skill file that teaches agents (GitHub Copilot CLI, Serena, Claude Code, etc.) how to use it for code navigation.\n\n**Download the skill for your agent:**\n\n```bash\n# Copilot CLI — drop into your skills directory\ncurl -fsSL https://raw.githubusercontent.com/Hessesian/kmp-lsp/main/contrib/copilot-skill/SKILL.md \\\n  -o ~/.copilot/skills/kmp-lsp.md\n\n# Or copy from the repo if you have it cloned\ncp contrib/copilot-skill/SKILL.md ~/.copilot/skills/kmp-lsp.md\n```\n\nThe skill covers: LSP navigation workflow, `kmp-lsp check` for post-edit syntax verification, `kmp-lsp refs --exclude-imports` for clean reference lists, when to use Serena MCP vs the `lsp` tool, and workspace switching.\n\n[Full agent setup (Copilot CLI + Serena MCP) →](docs/copilot.md)\n\n---\n\n## Quick start\n\n**VS Code** — download and install the `.vsix` from the [latest release](https://github.com/Hessesian/kmp-lsp/releases/latest):\n\n```bash\ncode --install-extension kmp-lsp-linux-x64-vX.Y.Z.vsix   # Linux\ncode --install-extension kmp-lsp-darwin-arm64-vX.Y.Z.vsix # macOS Apple Silicon\n```\n\nThe extension bundles syntax highlighting and launches `kmp-lsp` automatically.\n\n**Zed** — install the bundled extension (registers `kmp-lsp` from `$PATH`, no manual wiring):\n\n```bash\nzed --install-dev-extension contrib/zed-extension\n```\n\nThen add to `~/.config/zed/settings.json`:\n\n```json\n{\n  \"languages\": {\n    \"Kotlin\": {\n      \"language_servers\": [\"kmp-lsp\", \"!kotlin-language-server\"],\n      \"format_on_save\": \"off\",\n      \"show_completions_on_input\": true\n    },\n    \"Java\":  { \"language_servers\": [\"kmp-lsp\"], \"format_on_save\": \"off\" },\n    \"Swift\": { \"language_servers\": [\"kmp-lsp\"], \"format_on_save\": \"off\" }\n  }\n}\n```\n\n[Full Zed setup + manual wiring option →](docs/editors.md#zed)\n\n**Helix** — add to `~/.config/helix/languages.toml`:\n\n```toml\n[[language]]\nname = \"kotlin\"\nlanguage-servers = [\"kmp-lsp\"]\n\n[[language]]\nname = \"java\"\nlanguage-servers = [\"kmp-lsp\"]\n\n[language-server.kmp-lsp]\ncommand = \"kmp-lsp\"\n```\n\n[Neovim, Zed setup →](docs/editors.md)\n\n**Once your editor is wired up:**\n\n1. Open a Kotlin/Java file — hover, go-to-definition, and completions work immediately via `rg` fallback while the index builds in the background.\n2. Library sources are discovered automatically — no configuration needed in most cases:\n   - **Android SDK** (`Activity`, `Context`, `View`, …) — detected from `local.properties` → `$ANDROID_HOME` → `$ANDROID_SDK_ROOT`\n   - **Gradle library sources** (Compose, coroutines, AndroidX, …) — `*-sources.jar` files are auto-mounted from `~/.gradle/caches` at startup. Hover docs and completions work immediately; go-to-definition into library code also works as long as a `*-sources.jar` is present in the Gradle cache (run a Gradle sync or `./gradlew dependencies` if it isn't). The manual `extract-sources` step is no longer needed.\n   - **IntelliJ/Android Studio projects** — `workspace.json` source roots are picked up automatically, including any `sourcePaths` you've configured there.\n\n---\n\n## Features\n\n| Capability | Notes |\n|---|---|\n| **Go-to-definition** | Index → superclass hierarchy → `rg` fallback. Multi-hop chains, lambda params, `this`/`super` |\n| **Hover** | Declaration signature, lambda param types, Kotlin stdlib docs |\n| **Completion** | Dot-completion with type resolution, auto-import, scored ranking, stdlib entries |\n| **References** | Project-wide `rg --word-regexp` + open buffers; scoped to declaring class for fields/properties |\n| **Document/workspace symbol** | Outline view, fuzzy search, dot-qualified extension function queries |\n| **Rename** | Project-wide via `WorkspaceEdit` |\n| **Inlay hints** | Lambda `it`, named params, `this`, untyped `val`/`var`; enriched async via background `rg` pass |\n| **Semantic tokens** | Full syntax highlighting via tree-sitter CST + cross-file resolution |\n| **Diagnostics** | Syntax errors (tree-sitter), missing `when` branches (sealed/enum), missing call arguments |\n| **Go-to-implementation** | Interface methods and abstract functions; transitive subtype BFS; scoped by declaring class |\n| **Signature help** | Active parameter highlighting |\n| **Code actions** | Fill missing `when` branches for sealed classes and enums |\n| **Folding** | Brace regions + consecutive comment blocks |\n| **CLI mode** | `find`, `refs`, `hover`, `index`, `complete`, `tokens`, `tree`, `sources`, `extract-sources` — scriptable, no daemon |\n\nAll features work immediately — `rg` fallback handles symbols before indexing finishes.\n\n### What gets indexed\n\n| Language | Symbols |\n|---|---|\n| **Kotlin** | `class`, `interface`, `object`, `fun`, `val`, `var`, `typealias`, constructor params, enum entries |\n| **Java** | `class`, `interface`, `enum`, `method`, `field`, `enum_constant` |\n| **Swift** | `class`, `struct`, `enum`, `protocol`, `func`, `let`, `var`, `typealias`, `extension`, `init`, enum cases |\n\n---\n\n## CLI\n\n`kmp-lsp` works standalone — no editor, no daemon.\n\n![kmp-lsp CLI demo](demo/cli.gif)\n\n```bash\nkmp-lsp find MyViewModel              # search declarations\nkmp-lsp refs MyViewModel              # find all references\nkmp-lsp hover src/Foo.kt 42 10        # hover info at line 42, col 10\nkmp-lsp complete src/Foo.kt 42 --dot  # completions after last '.' on line 42\nkmp-lsp index --root ./android        # pre-build cache\nkmp-lsp sources --root ./android      # list detected source roots\nkmp-lsp extract-sources               # unpack library sources from Gradle cache\n```\n\n| Flag | Behaviour |\n|---|---|\n| _(none)_ | Auto: use cached index if available, fall back to fast `rg`/`fd` |\n| `--fast` | Always use `rg`/`fd`; instant, no index needed |\n| `--smart` | Require index; build it if missing |\n| `--json` | Machine-readable output |\n| `--root \u003cdir\u003e` | Workspace root (default: nearest `.git` dir) |\n\n`complete` returns JSON `[{label, kind, detail?, import?}]`. Use `--dot` / `--eol` to auto-place the cursor; `--no-stdlib` skips `~/.kmp-lsp/sources` for ~5× faster project-only results.\n\n[Full CLI reference →](docs/features.md#cli-subcommands)\n\n---\n\n## Configuration\n\n### Workspace root\n\nResolved in order:\n\n1. `KMP_LSP_WORKSPACE_ROOT` env var\n2. LSP client `rootUri` / `workspaceFolders`\n3. `~/.config/kmp-lsp/workspace` file (for clients that send no root)\n\n### Ignore patterns\n\n```toml\n# ~/.config/helix/languages.toml\n[language-server.kmp-lsp.config.indexingOptions]\nignorePatterns = [\"bazel-*\", \"build/**\", \"third-party/**\"]\n```\n\nPatterns follow gitignore glob rules and apply to both `fd` and `walkdir` fallback.\n\n### Source paths\n\nLibrary sources are resolved automatically — no manual config needed in most cases:\n\n| Source | How it's discovered |\n|---|---|\n| Android SDK (`Activity`, `Context`, …) | `sdk.dir` in `local.properties` → `$ANDROID_HOME` → `$ANDROID_SDK_ROOT` |\n| Gradle library sources (Compose, coroutines, …) | `~/.kmp-lsp/sources` after running `kmp-lsp extract-sources` |\n| IntelliJ/Android Studio project roots | `workspace.json` at project root (exported by IDE) |\n| Standard Gradle/Maven layouts | `src/main/kotlin`, `src/test/kotlin`, per-module subprojects |\n\n**`workspace.json`** — JetBrains IDEs export this file to the project root. It describes every module's source roots and lets you override library source directories:\n\n```json\n{\n  \"sourcePaths\": [\n    \"\u003cWORKSPACE\u003e/custom-stubs\",\n    \"/absolute/path/to/generated-sources\"\n  ]\n}\n```\n\nWhen `sourcePaths` is present (even as `[]`), it overrides the `~/.kmp-lsp/sources` default. Use `[]` to disable all library sources for a specific project.\n\n**Manual override** via LSP config (for custom stubs or generated code):\n\n```toml\n# ~/.config/helix/languages.toml\n[language-server.kmp-lsp.config.indexingOptions]\nsourcePaths = [\"buildSrc/src\", \"/path/to/generated-stubs\"]\n```\n\nSource path files are indexed for hover and completions but excluded from `findReferences` and `rename`.\n\n[Full configuration reference →](docs/features.md)\n\n---\n\n## Limitations\n\n- **No type inference** for generic lambda parameters — use explicit annotations for unresolvable cases\n- **No type checking** — syntax errors only; use Gradle/Xcode/CI for semantic diagnostics\n- **Swift support is structural** — all symbols indexed; no module boundaries or closure type inference\n- **Java completion** is less refined than Kotlin\n- **`findReferences` on common names** returns noise — name-based search via `rg`, no import filtering yet\n- **Binary `.aar`/`.jar`** — hover and completions work from compiled symbol metadata; go-to-definition into library code requires a `*-sources.jar` in the Gradle cache (auto-mounted at startup). Direct class-file indexing is [planned](https://github.com/Hessesian/kmp-lsp/issues/79).\n\n---\n\n## vs. Official Kotlin LSP\n\n| | **kmp-lsp** | **[Kotlin/kotlin-language-server](https://github.com/Kotlin/kotlin-language-server)** (JetBrains) |\n|---|---|---|\n| **Runtime** | Native Rust, no JVM | JVM 17+, ~500 MB |\n| **Startup** | Instant | Gradle import (slow) |\n| **Memory** | \u003c 200 MB | 1+ GB |\n| **Accuracy** | Syntactic (tree-sitter) | Full IntelliJ Analysis API |\n| **Editor support** | Any LSP editor | VS Code (official) |\n| **Swift** | ✓ | ✗ |\n\nThey can coexist — use kmp-lsp for fast navigation, the official one for type-checked diagnostics.\n\n---\n\n## Learn more\n\n- [Feature details](docs/features.md) — resolution chain, completion, CLI reference\n- [Editor setup](docs/editors.md) — Helix, Neovim, VS Code, Zed\n- [GitHub Copilot CLI](docs/copilot.md) — agent integration, skill extension, Serena MCP setup\n- [Architecture \u0026 performance](docs/architecture.md) — source layout, memory model\n- [Performance \u0026 profiling](docs/performance.md) — benchmarks, flamegraph setup\n- [Changelog](CHANGELOG.md)\n\n---\n\n## Acknowledgements\n\nSuperclass hierarchy resolution, `this`/`super` qualifier handling, and lambda parameter recognition were inspired by [**code-compass.nvim**](https://github.com/emmanueltouzery/code-compass.nvim) by Emmanuel Touzery.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhessesian%2Fkmp-lsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhessesian%2Fkmp-lsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhessesian%2Fkmp-lsp/lists"}