Skip to content

Commit 5731829

Browse files
committed
Compute correct document selectors when a project is initialized
1 parent b4cf6a7 commit 5731829

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

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

+12-22
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import {
8080
normalizeDriveLetter,
8181
} from './utils'
8282
import type { DocumentService } from './documents'
83-
import type { ProjectConfig } from './project-locator'
83+
import { calculateDocumentSelectors, type ProjectConfig } from './project-locator'
8484
import { supportedFeatures } from '@tailwindcss/language-service/src/features'
8585
import { loadDesignSystem } from './util/v4'
8686
import { readCssFile } from './util/css'
@@ -309,16 +309,11 @@ export async function createProjectService(
309309
projectConfig.configPath &&
310310
(isConfigFile || isDependency)
311311
) {
312-
documentSelector = [
313-
...documentSelector.filter(
314-
({ priority }) => priority !== DocumentSelectorPriority.CONTENT_FILE,
315-
),
316-
...getContentDocumentSelectorFromConfigFile(
317-
projectConfig.configPath,
318-
initialTailwindVersion,
319-
projectConfig.folder,
320-
),
321-
]
312+
documentSelector = await calculateDocumentSelectors(
313+
projectConfig.config,
314+
state.features,
315+
resolver,
316+
)
322317

323318
checkOpenDocuments()
324319
}
@@ -965,17 +960,12 @@ export async function createProjectService(
965960

966961
/////////////////////
967962
if (!projectConfig.isUserConfigured) {
968-
documentSelector = [
969-
...documentSelector.filter(
970-
({ priority }) => priority !== DocumentSelectorPriority.CONTENT_FILE,
971-
),
972-
...getContentDocumentSelectorFromConfigFile(
973-
state.configPath,
974-
tailwindcss.version,
975-
projectConfig.folder,
976-
originalConfig,
977-
),
978-
]
963+
documentSelector = await calculateDocumentSelectors(
964+
projectConfig.config,
965+
state.features,
966+
resolver,
967+
originalConfig,
968+
)
979969
}
980970
//////////////////////
981971

0 commit comments

Comments
 (0)