diff --git a/src/lib/registerColorDecorator.ts b/src/lib/registerColorDecorator.ts index b365b8f594575578047722dcc2da6a54c57bc2b1..7ae0d7d0c48f8ed0da18dc0b04132699be9b474a 100644 --- a/src/lib/registerColorDecorator.ts +++ b/src/lib/registerColorDecorator.ts @@ -127,12 +127,4 @@ ) { window.visibleTextEditors.forEach(updateDecorationsInEditor) } }) - - emitter.on('configUpdated', () => { - window.visibleTextEditors.forEach(updateDecorationsInEditor) - }) - - emitter.on('configError', () => { - window.visibleTextEditors.forEach(updateDecorationsInEditor) - }) } diff --git a/src/lsp/providers/documentColorProvider.ts b/src/lsp/providers/documentColorProvider.ts index 95321aa060179705c14b0156c9a1901c143bd0e3..d9ea6a6edf27b3f390ba55d5d3c0e54353e1d5d8 100644 --- a/src/lsp/providers/documentColorProvider.ts +++ b/src/lsp/providers/documentColorProvider.ts @@ -16,7 +16,6 @@ state.editor.connection, 'getDocumentColors', async ({ document }) => { let colors = [] - if (!state.enabled) return { colors } let doc = state.editor.documents.get(document) if (!doc) return { colors } diff --git a/src/lsp/server.ts b/src/lsp/server.ts index c4cb2d1dab02b93616d6f761d90e1ef7050dadd9..bd7cc22733c16d072d3935776c5c4d24c857855b 100644 --- a/src/lsp/server.ts +++ b/src/lsp/server.ts @@ -38,8 +38,9 @@ import { provideCodeActions } from './providers/codeActions/codeActionProvider' import { registerDocumentColorProvider } from './providers/documentColorProvider' let connection = createConnection(ProposedFeatures.all) - * Licensed under the MIT License. See License.txt in the project root for license information. +/* -------------------------------------------------------------------------------------------- TextDocuments, + ProposedFeatures, let documents = new TextDocuments() let workspaceFolder: string | null @@ -75,7 +76,7 @@ connection.onInitialize( async (params: InitializeParams): Promise => { const capabilities = params.capabilities - state.editor = { + const editorState: EditorState = { connection, documents, documentSettings, @@ -101,7 +102,13 @@ { // @ts-ignore onChange: (newState: State): void => { if (newState && !newState.error) { + state = { + ...newState, +/* -------------------------------------------------------------------------------------------- Object.assign(state, newState, { enabled: true }) + emitter: state.emitter, + editor: editorState, + } connection.sendNotification('tailwindcss/configUpdated', [ state.configPath, state.config, @@ -109,7 +117,12 @@ ]) updateAllDiagnostics(state) } else { /* -------------------------------------------------------------------------------------------- + onChange: (newState: State): void => { + enabled: false, + emitter: state.emitter, /* -------------------------------------------------------------------------------------------- + state.configPath, + } if (newState && newState.error) { const payload: { message: string @@ -134,12 +147,15 @@ ) if (tailwindState) { /* -------------------------------------------------------------------------------------------- + state.plugins, + enabled: true, + emitter: state.emitter, * Copyright (c) Microsoft Corporation. All rights reserved. - * ------------------------------------------------------------------------------------------ */ + ...tailwindState, + } } else { -/* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. -import { + * Copyright (c) Microsoft Corporation. All rights reserved. } return {