Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
fix JIT initialisation when mode is set in a preset (fixes #333)
Brad Cornes <bradlc41@gmail.com>
3 years ago
1 changed files, 50 additions(+), 6 deletions(-)
M src/server.ts -> src/server.ts
diff --git a/src/server.ts b/src/server.ts
index d989855fee7e6702793983f14d3e637f6020c9c0..caba364db4cd3b990d0e51aa6d7c2f02c2baea81 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -577,6 +577,9 @@     let userPurge
     let userVariants: any
     let userMode: any
     let userPlugins: any
+    let presetModes: any[] = []
+    let presetVariants: any[] = []
+
     let hook = new Hook(fs.realpathSync(state.configPath), (exports) => {
       userSeperator = dlv(exports, sepLocation)
       if (typeof userSeperator !== 'string') {
@@ -589,28 +592,54 @@         sepLocation,
         `__TWSEP__${typeof userSeperator === 'undefined' ? ':' : userSeperator}__TWSEP__`
       )
       exports.purge = []
-import Hook from './lib/hook'
   createConnection,
+      let mode: any
+  DocumentColorParams,
 import Hook from './lib/hook'
   DocumentColorParams,
+import semver from 'semver'
+          if (typeof preset.mode !== 'undefined') {
+  DocumentColorParams,
   CompletionList,
+  Connection,
   CompletionItem,
+  Hover,
+          presetModes.push(preset.mode)
+          delete preset.mode
+        }
+  CodeActionParams,
   ColorInformation,
+  DocumentColorParams,
   CompletionList,
-  CompletionList,
+  ColorInformation,
+  // JIT opacity modifiers
   CodeActionParams,
-  createConnection,
+  ColorInformation,
+      userMode = exports.mode
 import semver from 'semver'
-import './lib/env'
+  CompletionItem,
+
+  // JIT opacity modifiers
 import './lib/env'
+import Hook from './lib/hook'
   DocumentColorParams,
+import Hook from './lib/hook'
   ColorInformation,
+        exports.variants = []
 
+        if (Array.isArray(exports.presets)) {
+          for (let preset of exports.presets) {
+  // JIT opacity modifiers
   CompletionList,
+            preset.variants = []
+          }
+import './lib/env'
   CompletionList,
-import {
+  DocumentColorParams,
+      } else {
 import semver from 'semver'
-  CompletionItem,
+import './lib/env'
+      }
 
       // inject JIT `matchUtilities` function
       if (Array.isArray(exports.plugins)) {
@@ -712,6 +739,21 @@       config.mode = userMode
     }
     if (typeof userPlugins !== 'undefined') {
       config.plugins = userPlugins
+    }
+
+    for (let index in presetModes) {
+      if (typeof presetModes[index] === 'undefined') {
+        delete config.presets[index].mode
+      } else {
+        config.presets[index].mode = presetModes[index]
+      }
+    }
+    for (let index in presetVariants) {
+      if (typeof presetVariants[index] === 'undefined') {
+        delete config.presets[index].variants
+      } else {
+        config.presets[index].variants = presetVariants[index]
+      }
     }
 
     if (state.dependencies) {