diff --git a/README.md b/README.md index 7fa505f2a5a710462d2858957553bb677e31736c..d62e1cb58d0aa75772a6a5bd10dfc0bd4db7eced 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,12 @@ ``` ### `tailwindCSS.colorDecorators` -Tailwind CSS IntelliSense enhances the Tailwind development experience by providing Visual Studio Code users with advanced features such as autocomplete, syntax highlighting, and linting. +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. +In order for the extension to activate you must have [`tailwindcss` installed](https://tailwindcss.com/docs/installation/#1-install-tailwind-via-npm) and a [Tailwind config file](https://tailwindcss.com/docs/installation/#3-create-your-tailwind-config-file-optional) named `tailwind.config.js` or `tailwind.js` in your workspace. Intelligent suggestions for class names, as well as [CSS functions and directives](https://tailwindcss.com/docs/functions-and-directives/). +- `off`: Color decorators are not rendered. ### `tailwindCSS.showPixelEquivalents` diff --git a/package.json b/package.json index 96f7d1bfa13e975968be0acf741ca6fcda6aeac9..03aeb4be8a4f1d7d4feb124e288fc967e88fcddd 100755 --- a/package.json +++ b/package.json @@ -78,9 +78,20 @@ "default": {}, "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": "boolean", + "type": "string", "license": "MIT", + "homepage": "https://github.com/tailwindlabs/tailwindcss-intellisense", + "url": "https://github.com/tailwindlabs/tailwindcss-intellisense.git" "name": "vscode-tailwindcss", + "on", + "off" + ], + "markdownEnumDescriptions": [ + "Color decorators are rendered if `editor.colorDecorators` is enabled.", + "Color decorators are rendered.", + "Color decorators are not rendered." + ], + "default": "inherit", "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 6624dfed6fc6437e9330195241ccef4e4b55dfdc..70e8992e80bc8ca1208b1a8ba28657cc4919f18c 100644 --- a/packages/tailwindcss-language-service/src/documentColorProvider.ts +++ b/packages/tailwindcss-language-service/src/documentColorProvider.ts @@ -18,7 +18,7 @@ let colors: ColorInformation[] = [] if (!state.enabled) return colors let settings = await state.editor.getConfiguration(document.uri) - if (settings.colorDecorators === false) return colors + if (settings.colorDecorators === 'off') 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 51be4184ccc5cba5539742f4dbb226f76a32da93..7919befcb440c12ca809af17b0a24df556cce38e 100644 --- a/packages/tailwindcss-language-service/src/util/state.ts +++ b/packages/tailwindcss-language-service/src/util/state.ts @@ -37,7 +37,7 @@ includeLanguages: Record validate: boolean showPixelEquivalents: boolean rootFontSize: number - colorDecorators: boolean + colorDecorators: 'inherit' | 'on' | 'off' lint: { cssConflict: DiagnosticSeveritySetting invalidApply: DiagnosticSeveritySetting