tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Add workspace root document selector when there's exactly one active project (#711)
Signature
-----BEGIN PGP SIGNATURE-----
wsBcBAABCAAQBQJj09Q9CRBK7hj4Ov3rIwAAmv0IAGUbKrFGImq2gXTXirAUB0Lj
+gZyFd8yfpVYr4WEeNKLQv6aS+A5VUWFCCf/rd4QsuOdwgsfe7EqvVnluads9Cbe
Q3pzcaSWg2wzZBeZXE99K2c2gz+G08JetTdj0b8IjOaEpaYhOKC3gx8cxZwystP9
W7aSjCRZCwnHU4+IVSu3Ypdy6aoHlc+5ws9HTfR9WcF+YcFko5sjDaqoxIgkpUz9
w0127WrUjJ/cD3lJy3rYHBQ9uHzkICD8h7wzPgMWo1Fsrk53Pe9ExyB/Ii0b9E2C
JnKwUTRNrQpVW1LFT7B2z0j8LbpD1Mm+oVYP0I9R+9fsrpjZ0lsoM3uRgUzZCr4=
=8opT
-----END PGP SIGNATURE-----
diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts
index 113231e74dc74097a31f1bdbb810d8691460e9f5..c355374a8e1d779fa420369973e7cc06bec33e9b 100644
--- a/packages/tailwindcss-language-server/src/server.ts
+++ b/packages/tailwindcss-language-server/src/server.ts
@@ -211,7 +211,8 @@ CSS_FILE = 0,
CONTENT_FILE = 1,
CSS_DIRECTORY = 2,
CONFIG_DIRECTORY = 3,
- ROOT_DIRECTORY = 4,
+ PACKAGE_DIRECTORY = 4,
+ ROOT_DIRECTORY = 5,
}
type DocumentSelector = { pattern: string; priority: DocumentSelectorPriority }
@@ -1733,7 +1734,7 @@ ]
: []),
{
pattern: normalizePath(path.join(getPackageRoot(path.dirname(configPath), base), '**')),
- priority: DocumentSelectorPriority.ROOT_DIRECTORY,
+ priority: DocumentSelectorPriority.PACKAGE_DIRECTORY,
},
]
@@ -1744,7 +1745,16 @@ cssFileConfigMap.set(normalizedFilename, configPath)
}
}
- if (Object.keys(projects).length > 0) {
+ let projectKeys = Object.keys(projects)
+ let projectCount = projectKeys.length
+
+ if (projectCount > 0) {
+ if (projectCount === 1) {
+ projects[projectKeys[0]].push({
+ pattern: normalizePath(path.join(base, '**')),
+ priority: DocumentSelectorPriority.ROOT_DIRECTORY,
+ })
+ }
workspaceFolders = Object.entries(projects).map(([configPath, documentSelector]) => {
return {
folder: base,