File tree 2 files changed +44
-1
lines changed
2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 1
1
# zed-kotlin
2
2
3
3
Kotlin language support for [ Zed] ( https://github.com/zed-industries/zed ) .
4
+
5
+ ## Configuration
6
+
7
+ Workspace configuration options can be passed to the language server via lsp
8
+ settings in ` settings.json ` .
9
+
10
+ The following example changes the JVM target from ` default ` (which is 1.8) to
11
+ ` 17 ` :
12
+
13
+ ``` json
14
+ {
15
+ "lsp" : {
16
+ "kotlin-language-server" : {
17
+ "settings" : {
18
+ "compiler" : {
19
+ "jvm" : {
20
+ "target" : " 17"
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ The full list of workspace configuration options can be found
30
+ [ here] ( https://github.com/fwcd/kotlin-language-server/blob/main/server/src/main/kotlin/org/javacs/kt/Configuration.kt ) .
Original file line number Diff line number Diff line change 1
1
use std:: fs;
2
+ use zed:: serde_json;
2
3
use zed:: LanguageServerId ;
3
- use zed_extension_api:: { self as zed, Result } ;
4
+ use zed_extension_api:: { self as zed, settings :: LspSettings , Result } ;
4
5
5
6
struct KotlinExtension {
6
7
cached_binary_path : Option < String > ,
@@ -83,6 +84,21 @@ impl zed::Extension for KotlinExtension {
83
84
env : Default :: default ( ) ,
84
85
} )
85
86
}
87
+
88
+ fn language_server_workspace_configuration (
89
+ & mut self ,
90
+ _language_server_id : & LanguageServerId ,
91
+ worktree : & zed_extension_api:: Worktree ,
92
+ ) -> Result < Option < serde_json:: Value > > {
93
+ let settings = LspSettings :: for_worktree ( "kotlin-language-server" , worktree)
94
+ . ok ( )
95
+ . and_then ( |lsp_settings| lsp_settings. settings . clone ( ) )
96
+ . unwrap_or_default ( ) ;
97
+
98
+ Ok ( Some ( serde_json:: json!( {
99
+ "kotlin" : settings
100
+ } ) ) )
101
+ }
86
102
}
87
103
88
104
zed:: register_extension!( KotlinExtension ) ;
You can’t perform that action at this time.
0 commit comments