tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Prevent errors in not semicolon languages (#461)
* fix: prevent errors in not semicolon languages
* fix: extends fix for sugarss and stylus
* Formatting
* Fix document access
Co-authored-by: Brad Cornes <bradlc41@gmail.com>
Signature
-----BEGIN PGP SIGNATURE-----
wsBcBAABCAAQBQJiFhgeCRBK7hj4Ov3rIwAA6IEIAJyktc4X6bTMOEG9HTq7gfVB
eNMdOtdtaY26I0thlkvJrydDcij6QIFvfuvml+n0tvWCJuW4pWankc1D4qzONif4
mVGZgaRbPHScj5MFo3KgYNSSUwrzKeg9zsxpm2OijYzIQqKqZROo9wQgCwPqDEyH
hZmt24do26RhbDOZxak8nQvIhqOQEBlliPv9FcBPyieWCwatQp9tm7FLldeC4FAz
D96siCWVbHCcla8TxevKkK+5jXCnaJsWSZYLTuJPS2SsTzCJ5rwS2TQrM6BiE41c
v1f/a/EKYoak68rjqHh125UTRPLIWpON/smgUj2xxKcZpEB9az3TmTZy6sVPYoQ=
=c4vs
-----END PGP SIGNATURE-----
diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts
index 05526ff9d9ad246c8cec793c09dc8c6c991ad52e..e177db75385936554bb26eb62607555476fbc795 100644
--- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts
+++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts
@@ -27,11 +27,23 @@ if (!boundaries) return []
ranges.push(...boundaries.css)
}
+ let notSemicolonLanguages = ['sass', 'sugarss', 'stylus']
+ let regex: RegExp
+ if (
+ notSemicolonLanguages.includes(document.languageId) ||
+ (state.editor &&
+ notSemicolonLanguages.includes(state.editor.userLanguages[document.languageId]))
+ ) {
+ regex = /(?:\s|^)@tailwind\s+(?<value>[^\n]+)/g
+ } else {
+ regex = /(?:\s|^)@tailwind\s+(?<value>[^;]+)/g
+ }
+
let hasVariantsDirective = state.jit && semver.gte(state.version, '2.1.99')
ranges.forEach((range) => {
let text = document.getText(range)
- let matches = findAll(/(?:\s|^)@tailwind\s+(?<value>[^;]+)/g, text)
+ let matches = findAll(regex, text)
let valid = [
'utilities',