@@ -108,7 +108,7 @@ function findManualExecutable(logger: Logger, uri: Uri, folder?: WorkspaceFolder
108
108
}
109
109
logger . info ( `Trying to find the server executable in: ${ exePath } ` ) ;
110
110
exePath = resolvePathPlaceHolders ( exePath , folder ) ;
111
- logger . info ( `Location after path variables substitution: ${ exePath } ` ) ;
111
+ logger . log ( `Location after path variables substitution: ${ exePath } ` ) ;
112
112
113
113
if ( ! executableExists ( exePath ) ) {
114
114
let msg = `serverExecutablePath is set to ${ exePath } ` ;
@@ -164,6 +164,8 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
164
164
return ;
165
165
}
166
166
167
+ const currentWorkingDir = folder ? folder . uri . fsPath : path . dirname ( uri . fsPath ) ;
168
+
167
169
// Set the key to null to prevent multiple servers being launched at once
168
170
clients . set ( clientsKey , null ) ;
169
171
@@ -173,11 +175,14 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
173
175
174
176
const outputChannel : OutputChannel = window . createOutputChannel ( langName ) ;
175
177
176
- const logger : Logger = new ExtensionLogger ( 'client' , clientLogLevel , outputChannel ) ;
177
-
178
- logger . info ( 'Environment variables:' ) ;
178
+ const logFilePath = logFile ? path . resolve ( currentWorkingDir , logFile ) : undefined ;
179
+ const logger : Logger = new ExtensionLogger ( 'client' , clientLogLevel , outputChannel , logFilePath ) ;
180
+ if ( logFilePath ) {
181
+ logger . info ( `Writing client log to file ${ logFilePath } ` ) ;
182
+ }
183
+ logger . log ( 'Environment variables:' ) ;
179
184
Object . entries ( process . env ) . forEach ( ( [ key , value ] : [ string , string | undefined ] ) => {
180
- logger . info ( ` ${ key } : ${ value } ` ) ;
185
+ logger . log ( ` ${ key } : ${ value } ` ) ;
181
186
} ) ;
182
187
183
188
let serverExecutable ;
@@ -217,11 +222,13 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
217
222
// If we're operating on a standalone file (i.e. not in a folder) then we need
218
223
// to launch the server in a reasonable current directory. Otherwise the cradle
219
224
// guessing logic in hie-bios will be wrong!
225
+ let cwdMsg = `Activating the language server in working dir: ${ currentWorkingDir } ` ;
220
226
if ( folder ) {
221
- logger . info ( `Activating the language server in the workspace folder: ${ folder ?. uri . fsPath } ` ) ;
227
+ cwdMsg += ' ( the workspace folder)' ;
222
228
} else {
223
- logger . info ( `Activating the language server in the parent dir of the file: ${ uri . fsPath } ` ) ;
229
+ cwdMsg += ` ( parent dir of loaded file ${ uri . fsPath } )` ;
224
230
}
231
+ logger . info ( cwdMsg ) ;
225
232
226
233
const serverEnvironment : IEnvVars = workspace . getConfiguration ( 'haskell' , uri ) . serverEnvironment ;
227
234
const exeOptions : ExecutableOptions = {
@@ -252,7 +259,7 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
252
259
}
253
260
254
261
const pat = folder ? `${ folder . uri . fsPath } /**/*` : '**/*' ;
255
- logger . info ( `document selector patten: ${ pat } ` ) ;
262
+ logger . log ( `document selector patten: ${ pat } ` ) ;
256
263
const clientOptions : LanguageClientOptions = {
257
264
// Use the document selector to only notify the LSP on files inside the folder
258
265
// path for the specific workspace.
0 commit comments