add placeholder to clients map to prevent >1 instance per folder

master
Brad Cornes 2019-01-06 14:36:26 +00:00
parent 163c3fc633
commit 318debc41f
1 changed files with 6 additions and 1 deletions

View File

@ -97,6 +97,9 @@ export async function activate(context: ExtensionContext) {
folder = getOuterMostWorkspaceFolder(folder) folder = getOuterMostWorkspaceFolder(folder)
if (!clients.has(folder.uri.toString())) { if (!clients.has(folder.uri.toString())) {
// placeholder
clients.set(folder.uri.toString(), null)
let files = await Workspace.findFiles( let files = await Workspace.findFiles(
CONFIG_GLOB, CONFIG_GLOB,
'**/node_modules/**', '**/node_modules/**',
@ -182,7 +185,9 @@ export function deactivate(): Thenable<void> {
promises.push(defaultClient.stop()) promises.push(defaultClient.stop())
} }
for (let client of clients.values()) { for (let client of clients.values()) {
if (client) {
promises.push(client.stop()) promises.push(client.stop())
} }
}
return Promise.all(promises).then(() => undefined) return Promise.all(promises).then(() => undefined)
} }