kotlin.md

 1# Kotlin
 2
 3Kotlin language support in Zed is provided by the community-maintained [Kotlin extension](https://github.com/zed-extensions/kotlin).
 4Report issues to: [https://github.com/zed-extensions/kotlin/issues](https://github.com/zed-extensions/kotlin/issues)
 5
 6- Tree-sitter: [fwcd/tree-sitter-kotlin](https://github.com/fwcd/tree-sitter-kotlin)
 7- Language Server: [fwcd/kotlin-language-server](https://github.com/fwcd/kotlin-language-server)
 8- Alternate Language Server: [kotlin/kotlin-lsp](https://github.com/kotlin/kotlin-lsp)
 9
10## Configuration
11
12Workspace configuration options can be passed to the language server via lsp
13settings in `settings.json`.
14
15The full list of lsp `settings` can be found
16[here](https://github.com/fwcd/kotlin-language-server/blob/main/server/src/main/kotlin/org/javacs/kt/Configuration.kt)
17under `class Configuration` and initialization_options under `class InitializationOptions`.
18
19### JVM Target
20
21The following example changes the JVM target from `default` (which is 1.8) to
22`17`:
23
24```json [settings]
25{
26  "lsp": {
27    "kotlin-language-server": {
28      "settings": {
29        "compiler": {
30          "jvm": {
31            "target": "17"
32          }
33        }
34      }
35    }
36  }
37}
38```
39
40### JAVA_HOME
41
42To use a specific java installation, just specify the `JAVA_HOME` environment variable with:
43
44```json [settings]
45{
46  "lsp": {
47    "kotlin-language-server": {
48      "binary": {
49        "env": {
50          "JAVA_HOME": "/Users/whatever/Applications/Work/Android Studio.app/Contents/jbr/Contents/Home"
51        }
52      }
53    }
54  }
55}
56```