From 16b11482ba4cc4cbc427ae29b656a80de96af0f1 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 13 Jan 2023 10:20:29 +0000 Subject: [PATCH] Fix error when a `files.excludes` pattern contains braces (#696) --- package-lock.json | 12 ++++++++++++ packages/vscode-tailwindcss/package.json | 2 ++ packages/vscode-tailwindcss/src/extension.ts | 5 ++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 48cbd65..0de93f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,12 +11,14 @@ "@tailwindcss/forms": "0.5.3", "@tailwindcss/line-clamp": "0.4.2", "@tailwindcss/typography": "0.5.7", + "@types/braces": "3.0.1", "@types/debounce": "1.2.0", "@types/moo": "0.5.3", "@types/node": "14.14.34", "@types/semver": "7.3.10", "@types/vscode": "1.65.0", "becke-ch--regex--s0-0-v1--base--pl--lib": "1.4.0", + "braces": "3.0.2", "builtin-modules": "3.2.0", "chokidar": "3.5.1", "color-name": "1.1.4", @@ -4666,6 +4668,11 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/braces": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/braces/-/braces-3.0.1.tgz", + "integrity": "sha512-+euflG6ygo4bn0JHtn4pYqcXwRtLvElQ7/nnjDu7iYG56H0+OhCd7d6Ug0IE3WcFpZozBKW2+80FUbv5QGk5AQ==" + }, "node_modules/@types/debounce": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.0.tgz", @@ -24822,6 +24829,11 @@ "@babel/types": "^7.3.0" } }, + "@types/braces": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/braces/-/braces-3.0.1.tgz", + "integrity": "sha512-+euflG6ygo4bn0JHtn4pYqcXwRtLvElQ7/nnjDu7iYG56H0+OhCd7d6Ug0IE3WcFpZozBKW2+80FUbv5QGk5AQ==" + }, "@types/debounce": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.0.tgz", diff --git a/packages/vscode-tailwindcss/package.json b/packages/vscode-tailwindcss/package.json index 57e9963..40b6aab 100755 --- a/packages/vscode-tailwindcss/package.json +++ b/packages/vscode-tailwindcss/package.json @@ -321,7 +321,9 @@ "check": "tsc --noEmit" }, "devDependencies": { + "@types/braces": "3.0.1", "@types/vscode": "1.65.0", + "braces": "3.0.2", "color-name": "1.1.4", "concurrently": "7.0.0", "rimraf": "3.0.2", diff --git a/packages/vscode-tailwindcss/src/extension.ts b/packages/vscode-tailwindcss/src/extension.ts index 8455948..4ad6e2b 100755 --- a/packages/vscode-tailwindcss/src/extension.ts +++ b/packages/vscode-tailwindcss/src/extension.ts @@ -43,6 +43,7 @@ import { dedupe, equal } from 'tailwindcss-language-service/src/util/array' import namedColors from 'color-name' import minimatch from 'minimatch' import { CONFIG_GLOB, CSS_GLOB } from 'tailwindcss-language-server/src/lib/constants' +import braces from 'braces' const colorNames = Object.keys(namedColors) @@ -644,7 +645,9 @@ export async function activate(context: ExtensionContext) { let [configFile] = await Workspace.findFiles( new RelativePattern(folder, `**/${CONFIG_GLOB}`), - `{${getExcludePatterns(folder).join(',')}}`, + `{${getExcludePatterns(folder) + .flatMap((pattern) => braces.expand(pattern)) + .join(',')}}`, 1 )