Skip to content

Commit 9bba301

Browse files
committed
Don’t initalize workspace folders with an empty object for the configFile setting
1 parent f911919 commit 9bba301

File tree

1 file changed

+11
-0
lines changed
  • packages/tailwindcss-language-server/src

1 file changed

+11
-0
lines changed

packages/tailwindcss-language-server/src/tw.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ export class TW {
202202
type ExplicitConfigs =
203203
// Any valid tailwindCSS.experimental.configFile value
204204
| { kind: 'valid'; entries: [string, string[]][] }
205+
// A special value used to ignore tailwindCSS in this workspace
206+
// This is set by using "tailwindCSS.experimental.configFile": {},
207+
| { kind: 'ignore' }
205208
// Any otherwise invalid value
206209
| null
207210

@@ -211,6 +214,7 @@ export class TW {
211214
}
212215

213216
let configFileOrFiles = settings.experimental.configFile
217+
214218
let configs: Record<string, string[]> = {}
215219

216220
if (typeof configFileOrFiles === 'string') {
@@ -220,6 +224,10 @@ export class TW {
220224
configs[configFile] = docSelectors
221225
} else if (isObject(configFileOrFiles)) {
222226
let entries = Object.entries(configFileOrFiles)
227+
if (entries.length === 0) {
228+
return { kind: 'ignore' }
229+
}
230+
223231
for (let [configFile, selectors] of entries) {
224232
if (typeof configFile !== 'string') return null
225233
configFile = resolvePathForConfig(configFile)
@@ -251,6 +259,9 @@ export class TW {
251259
if (configs === null) {
252260
console.error('Invalid `experimental.configFile` configuration, not initializing.')
253261
return
262+
} else if (configs.kind === 'ignore') {
263+
console.log('Ignoring Tailwind CSS in this workspace.')
264+
return
254265
}
255266

256267
let resolver = await createResolver({

0 commit comments

Comments
 (0)