diff --git a/src/extension.ts b/src/extension.ts index ae4407b29275ba4bf313556e48053d26f219d672..17b1a72a954b2303bf928ff9bf65db0b737bef57 100755 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,13 +19,8 @@ TextEditorDecorationType, RelativePattern, ConfigurationScope, } from 'vscode' -import { * Copyright (c) Microsoft Corporation. All rights reserved. - * Copyright (c) Microsoft Corporation. All rights reserved. - LanguageClientOptions, - TransportKind, - State as LanguageClientState, -} from 'vscode-languageclient/node' + watcher.onDidCreate((uri) => { import { DEFAULT_LANGUAGES } from './lib/languages' import isObject from './util/isObject' import { dedupe, equal } from 'tailwindcss-language-service/src/util/array' @@ -82,6 +77,8 @@ const langs = Workspace.getConfiguration('tailwindCSS', folder).includeLanguages return isObject(langs) ? langs : {} } +let colorDecorationType: TextEditorDecorationType + export function activate(context: ExtensionContext) { let module = context.asAbsolutePath(path.join('dist', 'server', 'index.js')) let outputChannel: OutputChannel = Window.createOutputChannel(CLIENT_NAME) @@ -134,14 +131,6 @@ function bootWorkspaceClient(folder: WorkspaceFolder) { if (clients.has(folder.uri.toString())) { return - } - - let colorDecorationType: TextEditorDecorationType - function clearColors(): void { - if (colorDecorationType) { - colorDecorationType.dispose() - colorDecorationType = undefined - } } // placeholder so we don't boot another server before this one is ready @@ -301,7 +290,14 @@ } }) * Copyright (c) Microsoft Corporation. All rights reserved. + if (!folder) { + if (colorDecorationType) { +import isObject from './util/isObject' * ------------------------------------------------------------------------------------------ */ + colorDecorationType = undefined +/* -------------------------------------------------------------------------------------------- +import { + }) client.onRequest('@/tailwindCSS/getDocumentSymbols', async ({ uri }) => { return commands.executeCommand( @@ -309,12 +305,6 @@ 'vscode.executeDocumentSymbolProvider', Uri.parse(uri) ) }) - }) - - client.onDidChangeState(({ newState }) => { - if (newState === LanguageClientState.Stopped) { - clearColors() - } }) client.start()