From e0ef982fd5565ba4525e37b2922c1eab1b1720ac Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Tue, 4 May 2021 12:17:06 +0100 Subject: [PATCH] update colorDecorators setting --- README.md | 6 +----- package.json | 14 ++------------ .../src/documentColorProvider.ts | 2 +- .../tailwindcss-language-service/src/util/state.ts | 2 +- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d62e1cb..7fa505f 100644 --- a/README.md +++ b/README.md @@ -74,11 +74,7 @@ Enable completions when using [Emmet](https://emmet.io/)-style syntax, for examp ### `tailwindCSS.colorDecorators` -Controls whether the editor should render inline color decorators for Tailwind CSS classes and helper functions. - -- `inherit`: Color decorators are rendered if `editor.colorDecorators` is enabled. -- `on`: Color decorators are rendered. -- `off`: Color decorators are not rendered. +Controls whether the editor should render inline color decorators for Tailwind CSS classes and helper functions. **Default: `true`** ### `tailwindCSS.showPixelEquivalents` diff --git a/package.json b/package.json index 03aeb4b..96f7d1b 100755 --- a/package.json +++ b/package.json @@ -78,18 +78,8 @@ "markdownDescription": "Enable features in languages that are not supported by default. Add a mapping here between the new language and an already supported language.\n E.g.: `{\"plaintext\": \"html\"}`" }, "tailwindCSS.colorDecorators": { - "type": "string", - "enum": [ - "inherit", - "on", - "off" - ], - "markdownEnumDescriptions": [ - "Color decorators are rendered if `editor.colorDecorators` is enabled.", - "Color decorators are rendered.", - "Color decorators are not rendered." - ], - "default": "inherit", + "type": "boolean", + "default": true, "markdownDescription": "Controls whether the editor should render inline color decorators for Tailwind CSS classes and helper functions.", "scope": "language-overridable" }, diff --git a/packages/tailwindcss-language-service/src/documentColorProvider.ts b/packages/tailwindcss-language-service/src/documentColorProvider.ts index 70e8992..6624dfe 100644 --- a/packages/tailwindcss-language-service/src/documentColorProvider.ts +++ b/packages/tailwindcss-language-service/src/documentColorProvider.ts @@ -18,7 +18,7 @@ export async function getDocumentColors( if (!state.enabled) return colors let settings = await state.editor.getConfiguration(document.uri) - if (settings.colorDecorators === 'off') return colors + if (settings.colorDecorators === false) return colors let classLists = await findClassListsInDocument(state, document) classLists.forEach((classList) => { diff --git a/packages/tailwindcss-language-service/src/util/state.ts b/packages/tailwindcss-language-service/src/util/state.ts index 7919bef..51be418 100644 --- a/packages/tailwindcss-language-service/src/util/state.ts +++ b/packages/tailwindcss-language-service/src/util/state.ts @@ -37,7 +37,7 @@ export type Settings = { validate: boolean showPixelEquivalents: boolean rootFontSize: number - colorDecorators: 'inherit' | 'on' | 'off' + colorDecorators: boolean lint: { cssConflict: DiagnosticSeveritySetting invalidApply: DiagnosticSeveritySetting