Skip to content

Commit 49e3bfb

Browse files
committed
Refactor
1 parent dd673ab commit 49e3bfb

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

packages/tailwindcss-language-server/src/project-locator.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,10 @@ export class ProjectLocator {
276276

277277
private async findConfigs(): Promise<ConfigEntry[]> {
278278
// Look for config files and CSS files
279-
let files = await glob([`**/${CONFIG_GLOB}`, `**/${CSS_GLOB}`], {
280-
cwd: this.base,
281-
ignore: this.settings.tailwindCSS.files.exclude,
282-
onlyFiles: true,
283-
absolute: true,
284-
suppressErrors: true,
285-
dot: true,
286-
concurrency: Math.max(os.cpus().length, 1),
279+
let files = await this.glob({
280+
base: this.base,
281+
include: [`**/${CONFIG_GLOB}`, `**/${CSS_GLOB}`],
282+
exclude: this.settings.tailwindCSS.files.exclude,
287283
})
288284

289285
let realpaths = await Promise.all(files.map((file) => fs.realpath(file)))
@@ -516,6 +512,24 @@ export class ProjectLocator {
516512
isDefaultVersion: true,
517513
}
518514
}
515+
516+
private async glob(options: {
517+
base: string
518+
include: string[]
519+
exclude: string[]
520+
}): Promise<string[]> {
521+
let files = await glob(options.include, {
522+
cwd: options.base,
523+
ignore: options.exclude,
524+
onlyFiles: true,
525+
absolute: true,
526+
suppressErrors: true,
527+
dot: true,
528+
concurrency: Math.max(os.cpus().length, 1),
529+
})
530+
531+
return files
532+
}
519533
}
520534

521535
function contentSelectorsFromConfig(

0 commit comments

Comments
 (0)