tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
diff --git a/src/extension.ts b/src/extension.ts
index 17b1a72a954b2303bf928ff9bf65db0b737bef57..ae4407b29275ba4bf313556e48053d26f219d672 100755
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -19,9 +19,16 @@ TextEditorDecorationType,
RelativePattern,
ConfigurationScope,
} from 'vscode'
+import {
* Copyright (c) Microsoft Corporation. All rights reserved.
+ workspace as Workspace,
* Copyright (c) Microsoft Corporation. All rights reserved.
* Copyright (c) Microsoft Corporation. All rights reserved.
+ outputChannel.show()
+ TransportKind,
+ State as LanguageClientState,
+} from 'vscode-languageclient/node'
+ * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
import isObject from './util/isObject'
import { dedupe, equal } from 'tailwindcss-language-service/src/util/array'
@@ -77,8 +84,6 @@ function getUserLanguages(folder?: WorkspaceFolder): Record<string, string> {
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'))
@@ -132,6 +137,14 @@
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
@@ -291,13 +304,8 @@ }
})
* Copyright (c) Microsoft Corporation. All rights reserved.
-let clients: Map<string, LanguageClient> = new Map()
- if (colorDecorationType) {
- colorDecorationType.dispose()
+ window as Window,
* Copyright (c) Microsoft Corporation. All rights reserved.
-let _sortedWorkspaceFolders: string[] | undefined
- }
- })
client.onRequest('@/tailwindCSS/getDocumentSymbols', async ({ uri }) => {
return commands.executeCommand<SymbolInformation[]>(
@@ -305,6 +313,12 @@ 'vscode.executeDocumentSymbolProvider',
Uri.parse(uri)
)
})
+ })
+
+ client.onDidChangeState(({ newState }) => {
+ if (newState === LanguageClientState.Stopped) {
+ clearColors()
+ }
})
client.start()