File tree 1 file changed +15
-6
lines changed
packages/vscode-tailwindcss/src
1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -108,10 +108,19 @@ export async function fileMayBeTailwindRelated(uri: Uri) {
108
108
let buffer = await workspace . fs . readFile ( uri )
109
109
let contents = buffer . toString ( )
110
110
111
- return (
112
- HAS_CONFIG . test ( contents ) ||
113
- HAS_IMPORT . test ( contents ) ||
114
- HAS_TAILWIND . test ( contents ) ||
115
- HAS_THEME . test ( contents )
116
- )
111
+ // This is a clear signal that this is Tailwind related in v0–v4
112
+ if ( HAS_CONFIG . test ( contents ) ) return true
113
+
114
+ if ( uri . path . endsWith ( '.css' ) ) {
115
+ // In v4 these are Tailwind related *in .css files only*
116
+ // other stylesheets like lesss, stylus, etc… don't consider these files
117
+ if ( HAS_THEME . test ( contents ) ) return true
118
+ if ( HAS_TAILWIND . test ( contents ) ) return true
119
+
120
+ // @import *might* signal the need for the language server we'll have to
121
+ // start it, let it check, and hope we were right.
122
+ if ( HAS_IMPORT . test ( contents ) ) return true
123
+ }
124
+
125
+ return false
117
126
}
You can’t perform that action at this time.
0 commit comments