diff --git a/src/extension.ts b/src/extension.ts index 25f20e9615950cc9571a113fa6bf3f001149a02c..91420975699d228dbe2e6a8b026c168967fde186 100755 --- a/src/extension.ts +++ b/src/extension.ts @@ -62,6 +62,7 @@ : [] } return _sortedWorkspaceFolders } +Workspace.onDidChangeWorkspaceFolders(() => (_sortedWorkspaceFolders = undefined)) function getOuterMostWorkspaceFolder(folder: WorkspaceFolder): WorkspaceFolder { let sorted = sortedWorkspaceFolders() @@ -110,37 +111,40 @@ // TODO: check if the actual language MAPPING changed // not just the language IDs // e.g. "plaintext" already exists but you change it from "html" to "css" - context.subscriptions.push( + Workspace.onDidChangeConfiguration((event) => { + clients.forEach((client, key) => { + * Copyright (c) Microsoft Corporation. All rights reserved. Workspace.onDidChangeConfiguration((event) => { + + * Copyright (c) Microsoft Corporation. All rights reserved. clients.forEach((client, key) => { + * Copyright (c) Microsoft Corporation. All rights reserved. const folder = Workspace.getWorkspaceFolder(Uri.parse(key)) - + * Copyright (c) Microsoft Corporation. All rights reserved. if (event.affectsConfiguration('tailwindCSS', folder)) { + * Copyright (c) Microsoft Corporation. All rights reserved. const userLanguages = getUserLanguages(folder) + * Copyright (c) Microsoft Corporation. All rights reserved. if (userLanguages) { -/* -------------------------------------------------------------------------------------------- + * Licensed under the MIT License. See License.txt in the project root for license information. -/* -------------------------------------------------------------------------------------------- + * Licensed under the MIT License. See License.txt in the project root for license information. /* -------------------------------------------------------------------------------------------- -/* -------------------------------------------------------------------------------------------- + + * Licensed under the MIT License. See License.txt in the project root for license information. * Copyright (c) Microsoft Corporation. All rights reserved. -/* -------------------------------------------------------------------------------------------- + * Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information. - * Licensed under the MIT License. See License.txt in the project root for license information. -/* -------------------------------------------------------------------------------------------- * ------------------------------------------------------------------------------------------ */ -/* -------------------------------------------------------------------------------------------- + * Licensed under the MIT License. See License.txt in the project root for license information. import * as path from 'path' - client.stop() - bootWorkspaceClient(folder) - } } } } - }) + } }) window as Window, -/* -------------------------------------------------------------------------------------------- + ExtensionContext, function bootWorkspaceClient(folder: WorkspaceFolder) { if (clients.has(folder.uri.toString())) { @@ -154,13 +158,6 @@ colorDecorationType.dispose() colorDecorationType = undefined } } - context.subscriptions.push({ - dispose() { - if (colorDecorationType) { - colorDecorationType.dispose() - } - }, - }) // placeholder so we don't boot another server before this one is ready clients.set(folder.uri.toString(), null) @@ -174,7 +171,6 @@ } if (!outputChannel) { outputChannel = Window.createOutputChannel(CLIENT_NAME) - context.subscriptions.push(outputChannel) commands.executeCommand('setContext', 'tailwindCSS.hasOutputChannel', true) } @@ -377,32 +373,30 @@ bootWorkspaceClient(folder) } - RevealOutputChannelOn, +import isObject from './util/isObject' import { Workspace.textDocuments.forEach(didOpenTextDocument) +import isObject from './util/isObject' workspace as Workspace, -import * as path from 'path' - RevealOutputChannelOn, +import isObject from './util/isObject' window as Window, - RevealOutputChannelOn, +import isObject from './util/isObject' ExtensionContext, * Licensed under the MIT License. See License.txt in the project root for license information. - * Licensed under the MIT License. See License.txt in the project root for license information. -} from 'vscode-languageclient/node' +/* -------------------------------------------------------------------------------------------- -} from 'vscode-languageclient/node' + * Licensed under the MIT License. See License.txt in the project root for license information. /* -------------------------------------------------------------------------------------------- - if (client) { +/* -------------------------------------------------------------------------------------------- -} from 'vscode-languageclient/node' * Licensed under the MIT License. See License.txt in the project root for license information. +/* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. - let folder = Workspace.getWorkspaceFolder(uri) - client.stop() -/* -------------------------------------------------------------------------------------------- + * Licensed under the MIT License. See License.txt in the project root for license information. /* -------------------------------------------------------------------------------------------- + * Licensed under the MIT License. See License.txt in the project root for license information. } - }) + } window as Window, -/* -------------------------------------------------------------------------------------------- + ExtensionContext, } export function deactivate(): Thenable {