@@ -131,19 +131,27 @@ async function doStartServer() {
131131 return Promise . resolve ( result ) ;
132132 } ;
133133 } else {
134- let platform = os . platform ( ) ;
135- let executableName = platform === 'win32' ? 'emmylua_ls.exe' : 'emmylua_ls' ;
136- const exe = path . join ( context . extensionPath , 'server' , executableName ) ;
137-
138- if ( platform !== 'win32' ) {
139- fs . chmodSync ( exe , '777' ) ;
134+ const config = vscode . workspace . getConfiguration (
135+ undefined ,
136+ vscode . workspace . workspaceFolders ?. [ 0 ]
137+ ) ;
138+ let configExecutablePath = config . get < string > ( "emmylua.misc.executablePath" ) ?. trim ( ) ;
139+ if ( ! configExecutablePath || configExecutablePath . length == 0 ) {
140+ let platform = os . platform ( ) ;
141+ let executableName = platform === 'win32' ? 'emmylua_ls.exe' : 'emmylua_ls' ;
142+ configExecutablePath = path . join ( context . extensionPath , 'server' , executableName ) ;
143+
144+ if ( platform !== 'win32' ) {
145+ fs . chmodSync ( configExecutablePath , '777' ) ;
146+ }
140147 }
148+
141149 serverOptions = {
142- command : exe ,
150+ command : configExecutablePath ,
143151 args : [ ]
144152 } ;
145153
146- let parameters = vscode . workspace . getConfiguration ( "emmylua" ) . get < string [ ] > ( "ls.start_parameters " ) ;
154+ let parameters = config . get < string [ ] > ( "emmylua. ls.startParameters " ) ;
147155 if ( parameters && parameters . length > 0 ) {
148156 serverOptions . args = parameters ;
149157 }
0 commit comments