@@ -72,6 +72,31 @@ class LuaClient {
7272
7373 let config = Workspace . getConfiguration ( undefined , vscode . workspace . workspaceFolders ?. [ 0 ] ) ;
7474 let commandParam : string [ ] = config . get ( "Lua.misc.parameters" ) ;
75+ let command : string = await this . getCommand ( config ) ;
76+
77+ let serverOptions : ServerOptions = {
78+ command : command ,
79+ args : commandParam ,
80+ } ;
81+
82+ this . client = new LanguageClient (
83+ 'Lua' ,
84+ 'Lua' ,
85+ serverOptions ,
86+ clientOptions
87+ ) ;
88+
89+ //client.registerProposedFeatures();
90+ await this . client . start ( ) ;
91+ this . onCommand ( ) ;
92+ this . statusBar ( ) ;
93+ }
94+
95+ private async getCommand ( config : vscode . WorkspaceConfiguration ) {
96+ let executablePath : string = config . get ( "Lua.misc.executablePath" ) ;
97+ if ( executablePath && executablePath != "" ) {
98+ return executablePath ;
99+ }
75100 let command : string ;
76101 let platform : string = os . platform ( ) ;
77102 let binDir : string ;
@@ -96,7 +121,7 @@ class LuaClient {
96121 'lua-language-server'
97122 )
98123 ) ;
99- await fs . promises . chmod ( command , '777' )
124+ await fs . promises . chmod ( command , '777' ) ;
100125 break ;
101126 case "darwin" :
102127 command = this . context . asAbsolutePath (
@@ -106,28 +131,12 @@ class LuaClient {
106131 'lua-language-server'
107132 )
108133 ) ;
109- await fs . promises . chmod ( command , '777' )
134+ await fs . promises . chmod ( command , '777' ) ;
110135 break ;
111136 }
112-
113- let serverOptions : ServerOptions = {
114- command : command ,
115- args : commandParam ,
116- } ;
117-
118- this . client = new LanguageClient (
119- 'Lua' ,
120- 'Lua' ,
121- serverOptions ,
122- clientOptions
123- ) ;
124-
125- //client.registerProposedFeatures();
126- await this . client . start ( ) ;
127- this . onCommand ( ) ;
128- this . statusBar ( ) ;
137+ return command ;
129138 }
130-
139+
131140 async stop ( ) {
132141 this . client . stop ( ) ;
133142 for ( const disposable of this . disposables ) {
0 commit comments