From 16ee42ae085333791df52480d7dad582a87e3cdd Mon Sep 17 00:00:00 2001 From: pranaysashank Date: Tue, 31 Aug 2021 06:30:25 +0000 Subject: [PATCH] Create output channel only if there are no existing clients. --- src/extension.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 1a8dde1e..2472bbf8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -150,12 +150,12 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold const clientsKey = folder ? folder.uri.toString() : uri.toString(); // Set a unique name per workspace folder (useful for multi-root workspaces). const langName = 'Haskell' + (folder ? ` (${folder.name})` : ''); - const outputChannel: OutputChannel = window.createOutputChannel(langName); // If the client already has an LSP server for this uri/folder, then don't start a new one. if (clients.has(clientsKey)) { return; } + // Set the key to null to prevent multiple servers being launched at once clients.set(clientsKey, null); @@ -163,6 +163,8 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold const clientLogLevel = workspace.getConfiguration('haskell', uri).trace.client; const logFile = workspace.getConfiguration('haskell', uri).logFile; + const outputChannel: OutputChannel = window.createOutputChannel(langName); + const logger: Logger = new ExtensionLogger('client', clientLogLevel, outputChannel); let serverExecutable;