11import plugin from "../plugin.json" ;
2+ let AppSettings = acode . require ( "settings" ) ;
3+
24class AcodePlugin {
35 async init ( ) {
46 let acodeLanguageClient = acode . require ( "acode-language-client" ) ;
@@ -26,11 +28,31 @@ class AcodePlugin {
2628 acodeLanguageClient . format ( ) ,
2729 ) ;
2830 }
31+ get settingsMenuLayout ( ) {
32+ // let settings = this.settings;
33+ return {
34+ list : [
35+ {
36+ index : 0 ,
37+ key : "serverPath" ,
38+ promptType : "text" ,
39+ prompt :"Change the serverPath before running." ,
40+ text : "Kotlin Executable File Path" ,
41+ value : this . settings . serverPath ,
42+ } ,
43+ ] ,
44+
45+ cb : ( key , value ) => {
46+ AppSettings . value [ plugin . id ] [ key ] = value ;
47+ AppSettings . update ( ) ;
48+ } ,
49+ } ;
50+ }
51+
2952 get settings ( ) {
3053 if ( ! window . acode ) {
3154 return this . defaultSettings ;
3255 }
33- const AppSettings = acode . require ( "settings" ) ;
3456 let value = AppSettings . value [ plugin . id ] ;
3557 if ( ! value ) {
3658 value = AppSettings . value [ plugin . id ] = this . defaultSettings ;
@@ -44,7 +66,7 @@ class AcodePlugin {
4466 "/data/data/com.termux/files/home/.local/share/nvim/mason/bin/kotlin-language-server" ,
4567 } ;
4668 }
47- async destroy ( ) { }
69+ async destroy ( ) { }
4870}
4971
5072if ( window . acode ) {
@@ -58,7 +80,9 @@ if (window.acode) {
5880 acodePlugin . baseUrl = baseUrl ;
5981 await acodePlugin . init ( $page , cacheFile , cacheFileUrl ) ;
6082 } ,
83+ acodePlugin . settingsMenuLayout ,
6184 ) ;
85+
6286 acode . setPluginUnmount ( plugin . id , ( ) => {
6387 acodePlugin . destroy ( ) ;
6488 } ) ;
0 commit comments