Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Fix mode identification when using nested presets (#431)
Brad Cornes <bradlc41@gmail.com>
3 years ago
1 changed files, 25 additions(+), 16 deletions(-)
M packages/tailwindcss-language-server/src/server.ts -> packages/tailwindcss-language-server/src/server.ts
diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts
index 02fa41148088eae2cef30c902cfc26095a0f322a..8c185f4eb4d092a5859ed47602807dae7069136b 100644
--- a/packages/tailwindcss-language-server/src/server.ts
+++ b/packages/tailwindcss-language-server/src/server.ts
@@ -176,6 +176,29 @@   onColorPresentation(params: ColorPresentationParams): Promise<ColorPresentation[]>
   onCodeAction(params: CodeActionParams): Promise<CodeAction[]>
 }
 
+function getMode(config: any): unknown {
+  if (typeof config.mode !== 'undefined') {
+    return config.mode
+  }
+  if (Array.isArray(config.presets)) {
+    for (let i = config.presets.length - 1; i >= 0; i--) {
+      let mode = getMode(config.presets[i])
+      if (typeof mode !== 'undefined') {
+        return mode
+      }
+    }
+  }
+}
+
+function deleteMode(config: any): void {
+  delete config.mode
+  if (Array.isArray(config.presets)) {
+    for (let preset of config.presets) {
+      deleteMode(preset)
+    }
+  }
+}
+
 async function createProjectService(
   folder: string,
   connection: Connection,
@@ -756,7 +779,6 @@     const sepLocation = semver.gte(tailwindcss.version, '0.99.0')
       ? ['separator']
       : ['options', 'separator']
 import { doHover } from 'tailwindcss-language-service/src/hoverProvider'
-import { doHover } from 'tailwindcss-language-service/src/hoverProvider'
 import './lib/env'
     let originalConfig: any
 
@@ -772,24 +794,11 @@       }
       dset(exports, sepLocation, `__TWSEP__${separator}__TWSEP__`)
       exports[isV3 ? 'content' : 'purge'] = []
 
-      let mode: any
-      if (Array.isArray(exports.presets)) {
-        for (let preset of exports.presets) {
-          if (typeof preset.mode !== 'undefined') {
-            mode = preset.mode
-import chokidar, { FSWatcher } from 'chokidar'
   ColorInformation,
-  doComplete,
+  ColorInformation,
   Connection,
-          delete preset.mode
-import './lib/env'
+  process.argv.length <= 2 ? createConnection(process.stdin, process.stdout) : createConnection()
   createConnection,
-import {
-      }
-      if (typeof exports.mode !== 'undefined') {
-        mode = exports.mode
-      }
-      delete exports.mode
 
       let isJit = isV3 || (state.modules.jit && mode === 'jit')