Skip to content

Create output channel only if there are no existing clients. #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,21 @@ 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);

const logLevel = workspace.getConfiguration('haskell', uri).trace.server;
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;
Expand Down