Fix error when a `files.excludes` pattern contains braces (#696)

master
Brad Cornes 2023-01-13 10:20:29 +00:00 committed by GitHub
parent fd9de48d27
commit 16b11482ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

12
package-lock.json generated
View File

@ -11,12 +11,14 @@
"@tailwindcss/forms": "0.5.3", "@tailwindcss/forms": "0.5.3",
"@tailwindcss/line-clamp": "0.4.2", "@tailwindcss/line-clamp": "0.4.2",
"@tailwindcss/typography": "0.5.7", "@tailwindcss/typography": "0.5.7",
"@types/braces": "3.0.1",
"@types/debounce": "1.2.0", "@types/debounce": "1.2.0",
"@types/moo": "0.5.3", "@types/moo": "0.5.3",
"@types/node": "14.14.34", "@types/node": "14.14.34",
"@types/semver": "7.3.10", "@types/semver": "7.3.10",
"@types/vscode": "1.65.0", "@types/vscode": "1.65.0",
"becke-ch--regex--s0-0-v1--base--pl--lib": "1.4.0", "becke-ch--regex--s0-0-v1--base--pl--lib": "1.4.0",
"braces": "3.0.2",
"builtin-modules": "3.2.0", "builtin-modules": "3.2.0",
"chokidar": "3.5.1", "chokidar": "3.5.1",
"color-name": "1.1.4", "color-name": "1.1.4",
@ -4666,6 +4668,11 @@
"@babel/types": "^7.3.0" "@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": { "node_modules/@types/debounce": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.0.tgz", "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.0.tgz",
@ -24822,6 +24829,11 @@
"@babel/types": "^7.3.0" "@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": { "@types/debounce": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.0.tgz", "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.0.tgz",

View File

@ -321,7 +321,9 @@
"check": "tsc --noEmit" "check": "tsc --noEmit"
}, },
"devDependencies": { "devDependencies": {
"@types/braces": "3.0.1",
"@types/vscode": "1.65.0", "@types/vscode": "1.65.0",
"braces": "3.0.2",
"color-name": "1.1.4", "color-name": "1.1.4",
"concurrently": "7.0.0", "concurrently": "7.0.0",
"rimraf": "3.0.2", "rimraf": "3.0.2",

View File

@ -43,6 +43,7 @@ import { dedupe, equal } from 'tailwindcss-language-service/src/util/array'
import namedColors from 'color-name' import namedColors from 'color-name'
import minimatch from 'minimatch' import minimatch from 'minimatch'
import { CONFIG_GLOB, CSS_GLOB } from 'tailwindcss-language-server/src/lib/constants' import { CONFIG_GLOB, CSS_GLOB } from 'tailwindcss-language-server/src/lib/constants'
import braces from 'braces'
const colorNames = Object.keys(namedColors) const colorNames = Object.keys(namedColors)
@ -644,7 +645,9 @@ export async function activate(context: ExtensionContext) {
let [configFile] = await Workspace.findFiles( let [configFile] = await Workspace.findFiles(
new RelativePattern(folder, `**/${CONFIG_GLOB}`), new RelativePattern(folder, `**/${CONFIG_GLOB}`),
`{${getExcludePatterns(folder).join(',')}}`, `{${getExcludePatterns(folder)
.flatMap((pattern) => braces.expand(pattern))
.join(',')}}`,
1 1
) )