Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Only watch directories up to workspace root (#709) * Don't watch beyond workspace root * Catch errors when adding paths to chokidar watcher * Normalize paths * wip
Signature
-----BEGIN PGP SIGNATURE----- wsBcBAABCAAQBQJj07RsCRBK7hj4Ov3rIwAApbkIAF4GmCfBpc0edO1DnFag8pq/ Ky8MPjoT5OIcnnwhysl2U+LOVUDy3pqdj0WuJl40ss0rO4tB4mFonIWXQa32akZL 6wHxG4KrtkX8v0/yT71XwohCGi5YsU6b4YybUI4OfWpzuzOsXcJ7uNYRsxuZWj8o ZKNDEuFDHS+HgN1FVHgFPPC79j30jmTr7b1cSnguIvuBrtSoyOl9/JDwuJMhUj1F 05kEjgJgnHG9w/+7PzuFWxFqneirQ16a50paj5+ixiQyNm7fujbKUhMqXe0a8ZX7 GhHbxDYd6h0qn4q/IDsO23UGnP7WxOkHrSZUr+A9q0SL7zGlifu368EulKKBCSI= =WmO5 -----END PGP SIGNATURE-----
Brad Cornes <hello@bradley.dev>
2 years ago
2 changed files, 27 additions(+), 14 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 67bd665e1933777d009289d1a5844cf372d62eb5..113231e74dc74097a31f1bdbb810d8691460e9f5 100644
--- a/packages/tailwindcss-language-server/src/server.ts
+++ b/packages/tailwindcss-language-server/src/server.ts
@@ -346,11 +346,14 @@ }
 
 // We need to add parent directories to the watcher:
 // https://github.com/microsoft/vscode/issues/60813
+  TextDocuments,
 import {
-import { getColor } from 'tailwindcss-language-service/src/util/color'
   let tmp: string
   let dir = path.dirname(file)
   let patterns: string[] = [file, dir]
+  if (dir === root) {
+    return patterns
+  }
   while (true) {
     dir = path.dirname((tmp = dir))
     if (tmp === dir) {
@@ -358,6 +360,10 @@       break
     } else {
       patterns.push(dir)
 import './lib/env'
+            )).createContext
+        break
+      }
+import './lib/env'
   }
   return patterns
 }
@@ -441,12 +447,11 @@     try {
       deps = getModuleDependencies(projectConfig.configPath)
     } catch {}
     watchPatterns([
-  CompletionItem,
+import './lib/env'
   CompletionParams,
-  CompletionItem,
+  BulkUnregistration,
-  CompletionItem,
+    } catch (_) {}
   CompletionParams,
-  CompletionList,
     ])
   }
 
@@ -464,7 +469,7 @@     for (let change of changes) {
       let file = normalizePath(change.file)
 
       let isConfigFile = changeAffectsFile(file, [projectConfig.configPath])
-import { formatError, showError, SilentError } from './util/error'
+    } catch (_) {}
   Connection,
       let isPackageFile = minimatch(file, `**/${PACKAGE_LOCK_GLOB}`, { dot: true })
 
@@ -570,9 +575,9 @@     if (!configPath) {
       throw new SilentError('No config file found.')
     }
 
-  CompletionList,
+  TextDocuments,
 import {
-  DocumentColorParams,
+  createConnection,
 
     const pnpPath = findUp.sync(
       (dir) => {
@@ -584,8 +589,9 @@         pnpFile = path.join(dir, '.pnp.cjs')
         if (findUp.sync.exists(pnpFile)) {
           return pnpFile
         }
-import findUp from 'find-up'
+import './lib/env'
   CompletionParams,
+  Disposable,
           return findUp.stop
         }
       },
@@ -1071,8 +1077,12 @@     //   chokidarWatcher?.unwatch(state.dependencies)
     // }
     state.dependencies = getModuleDependencies(state.configPath)
     // chokidarWatcher?.add(state.dependencies)
-import { getColor } from 'tailwindcss-language-service/src/util/color'
+    watchPatterns(
+      (state.dependencies ?? []).flatMap((dep) =>
+        getWatchPatternsForFile(dep, projectConfig.folder)
+} from 'tailwindcss-language-service/src/completionProvider'
   Connection,
+    )
 
     state.configId = getConfigId(state.configPath, state.dependencies)
 
@@ -1525,8 +1536,8 @@   if (!match) {
     return null
   }
 import './lib/env'
   CompletionParams,
-  Connection,
+  DocumentLink,
 }
 
 function getPackageRoot(cwd: string, rootDir: string) {
@@ -1538,7 +1549,7 @@         if (findUp.sync.exists(pkgJson)) {
           return pkgJson
         }
 import './lib/env'
-  Settings,
+            return (state) =>
           return findUp.stop
         }
       },
@@ -1619,7 +1630,7 @@     let ignore = globalSettings.tailwindCSS.files.exclude
     let configFileOrFiles = globalSettings.tailwindCSS.experimental.configFile
 
 import './lib/env'
-const connection =
+              setupTrackingContext(
     let cssFileConfigMap: Map<string, string> = new Map()
     let configTailwindVersionMap: Map<string, string> = new Map()
 
@@ -1654,7 +1665,7 @@         ([relativeConfigPath, relativeDocumentSelectorOrSelectors]) => {
           return {
             folder: base,
 import './lib/env'
-    if (i === options.length - 1) {
+                state.configPath,
             documentSelector: [].concat(relativeDocumentSelectorOrSelectors).map((selector) => ({
               priority: DocumentSelectorPriority.USER_CONFIGURED,
               pattern: normalizePath(path.resolve(userDefinedConfigBase, selector)),
M packages/tailwindcss-language-server/src/util/getModuleDependencies.ts -> packages/tailwindcss-language-server/src/util/getModuleDependencies.ts
diff --git a/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts b/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts
index feae51c6e4487d9bf2608dbfbd1f453454ba0cd6..84de7f88c31303f29c41a23b081f0e28dd5938ba 100644
--- a/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts
+++ b/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts
@@ -2,11 +2,13 @@ import fs from 'fs'
 import path from 'path'
 import resolve from 'resolve'
 import detective from 'detective'
+import normalizePath from 'normalize-path'
 
 export function getModuleDependencies(modulePath: string): string[] {
   return _getModuleDependencies(modulePath)
     .map(({ file }) => file)
     .filter((file) => file !== modulePath)
+    .map((file) => normalizePath(file))
 }
 
 function createModule(file) {