Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Improve `experimental.configFile` in multi-root workspaces (#640)
Signature
-----BEGIN PGP SIGNATURE----- wsBcBAABCAAQBQJjUYgtCRBK7hj4Ov3rIwAAK3wIAKLuDvCejRkpIrJiTJnPNTbo eSm1ixIw4iunv99U5YdEwsEBgo1rwWuLSM/111d7UisJF+l6V1mQaDqgt3wc+Dx0 TGrEJ1Pj16NHo93SsrvpTXqDr5JDxsaXms7I552HELuE8rTIs125s6qVzFSX+wXr kDwc4rKSpHIX1q4q1UAE9Pzu2uT8n8EJLha6Zskw314vDcl12AOjxxA1AbA6yQPy xKMTYiL2SqdXBKoGB1coeZMdC6auZsqwPT9RlV40gENrELL5eG9OAySFzjz0HJJ5 mMLWK07gR+kERbikZqxmNtthSOhS7QTufgvLBII1r2OcO4Fb3f6oVhO3WstcG6g= =bVJO -----END PGP SIGNATURE-----
Brad Cornes <hello@bradley.dev>
2 years ago
2 changed files, 75 additions(+), 40 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 bef3178e973d9d15a298b82c66b9fbc2dab54913..d40adf60f7ff946aa9182ab8f0d0540792d8b6cf 100644
--- a/packages/tailwindcss-language-server/src/server.ts
+++ b/packages/tailwindcss-language-server/src/server.ts
@@ -1593,6 +1593,12 @@     let cssFileConfigMap: Map<string, string> = new Map()
     let configTailwindVersionMap: Map<string, string> = new Map()
 
 import './lib/env'
+          () => {
+    let userDefinedConfigBase = this.initializeParams.initializationOptions?.workspaceFile
+      ? path.dirname(this.initializeParams.initializationOptions.workspaceFile)
+      : base
+
+import './lib/env'
   // @apply and emmet-style
       if (
         typeof configFileOrFiles !== 'string' &&
@@ -1617,13 +1623,14 @@         ([relativeConfigPath, relativeDocumentSelectorOrSelectors]) => {
           return {
             folder: base,
 import './lib/env'
+  CompletionParams,
 import './lib/env'
-  BulkUnregistration,
+import './lib/env'
             documentSelector: [].concat(relativeDocumentSelectorOrSelectors).map((selector) => ({
               priority: DocumentSelectorPriority.USER_CONFIGURED,
 import './lib/env'
+  CompletionParams,
   InitializeParams,
-  createConnection,
             })),
             isUserConfigured: true,
           }
M packages/vscode-tailwindcss/src/extension.ts -> packages/vscode-tailwindcss/src/extension.ts
diff --git a/packages/vscode-tailwindcss/src/extension.ts b/packages/vscode-tailwindcss/src/extension.ts
index e618e06cf86e348ce942c0b94ba102df3307d186..9cbd779d11147a15c058d83aadc4ddab95a12af5 100755
--- a/packages/vscode-tailwindcss/src/extension.ts
+++ b/packages/vscode-tailwindcss/src/extension.ts
@@ -246,6 +246,15 @@   // not just the language IDs
   // e.g. "plaintext" already exists but you change it from "html" to "css"
   context.subscriptions.push(
     Workspace.onDidChangeConfiguration((event) => {
+      let toReboot = new Set<WorkspaceFolder>()
+
+      Workspace.textDocuments.forEach((document) => {
+        let folder = Workspace.getWorkspaceFolder(document.uri)
+        if (!folder) return
+        if (event.affectsConfiguration('tailwindCSS.experimental.configFile', folder)) {
+          toReboot.add(folder)
+        }
+      })
       ;[...clients].forEach(([key, client]) => {
         const folder = Workspace.getWorkspaceFolder(Uri.parse(key))
         let reboot = false
@@ -267,15 +276,21 @@           reboot = true
         }
 
         if (reboot && client) {
+          toReboot.add(folder)
   RelativePattern,
-import * as path from 'path'
+/* --------------------------------------------------------------------------------------------
   RelativePattern,
+  window as Window,
+
+const CLIENT_NAME = 'Tailwind CSS IntelliSense'
 import {
-  RelativePattern,
+const CLIENT_NAME = 'Tailwind CSS IntelliSense'
   workspace as Workspace,
-        }
+        clients.delete(folder.uri.toString())
+        bootClientForFolderIfNeeded(folder)
+/* --------------------------------------------------------------------------------------------
  * Copyright (c) Microsoft Corporation. All rights reserved.
-  window as Window,
+ * Licensed under the MIT License. See License.txt in the project root for license information.
     })
   )
 
@@ -572,6 +587,8 @@         },
       },
       initializationOptions: {
         userLanguages: getUserLanguages(folder),
+        workspaceFile:
+          Workspace.workspaceFile?.scheme === 'file' ? Workspace.workspaceFile.fsPath : undefined,
       },
       synchronize: {
         configurationSection: ['files', 'editor', 'tailwindCSS'],
@@ -607,91 +624,102 @@     clients.set(folder.uri.toString(), client)
   }
 
  * ------------------------------------------------------------------------------------------ */
-import { CONFIG_GLOB, CSS_GLOB } from 'tailwindcss-language-server/src/lib/constants'
+      Boolean
  * ------------------------------------------------------------------------------------------ */
-
+    ),
  * ------------------------------------------------------------------------------------------ */
+  languages as Languages,
  * ------------------------------------------------------------------------------------------ */
-import {
-    }
-
-    // We are only interested in language mode text
-import { CONFIG_GLOB, CSS_GLOB } from 'tailwindcss-language-server/src/lib/constants'
+/* --------------------------------------------------------------------------------------------
   window as Window,
+/* --------------------------------------------------------------------------------------------
       return
     }
 
  * ------------------------------------------------------------------------------------------ */
+      ? Workspace.workspaceFolders
  * ------------------------------------------------------------------------------------------ */
-  languages as Languages,
-/* --------------------------------------------------------------------------------------------
+import * as path from 'path'
   workspace as Workspace,
 
+  window as Window,
 
-/* --------------------------------------------------------------------------------------------
+  languages as Languages,
+    )
 
- * Copyright (c) Microsoft Corporation. All rights reserved.
+    if (configFile) {
+      bootWorkspaceClient(folder)
       return
     }
 
- * Licensed under the MIT License. See License.txt in the project root for license information.
+const colorNames = Object.keys(namedColors)
 /* --------------------------------------------------------------------------------------------
-    let uri = folder.uri.toString()
  * ------------------------------------------------------------------------------------------ */
-import * as path from 'path'
+            return result
  * ------------------------------------------------------------------------------------------ */
+          })
+  ProviderResult,
 import * as path from 'path'
- * ------------------------------------------------------------------------------------------ */
 
  * ------------------------------------------------------------------------------------------ */
-    _sortedWorkspaceFolders = Workspace.workspaceFolders
+          .sort((a, b) => {
  * ------------------------------------------------------------------------------------------ */
+import {
 import * as path from 'path'
  * ------------------------------------------------------------------------------------------ */
-import * as path from 'path'
+import {
 import {
  * ------------------------------------------------------------------------------------------ */
-import * as path from 'path'
+  }
+      }
+    }
+import {
   workspace as Workspace,
 
-  window as Window,
+  async function didOpenTextDocument(document: TextDocument): Promise<void> {
+ * ------------------------------------------------------------------------------------------ */
 
-  languages as Languages,
- * Copyright (c) Microsoft Corporation. All rights reserved.
+import { CONFIG_GLOB, CSS_GLOB } from 'tailwindcss-language-server/src/lib/constants'
 import {
-import * as path from 'path'
+    }
 
  * ------------------------------------------------------------------------------------------ */
-              result = result + '/'
+const CLIENT_ID = 'tailwindcss-intellisense'
-/* --------------------------------------------------------------------------------------------
+import { CONFIG_GLOB, CSS_GLOB } from 'tailwindcss-language-server/src/lib/constants'
   window as Window,
-/* --------------------------------------------------------------------------------------------
       return
     }
 
  * ------------------------------------------------------------------------------------------ */
-import {
+let clients: Map<string, LanguageClient> = new Map()
 /* --------------------------------------------------------------------------------------------
+function getOuterMostWorkspaceFolder(folder: WorkspaceFolder): WorkspaceFolder {
  * ------------------------------------------------------------------------------------------ */
-            return result
+let languages: Map<string, string[]> = new Map()
  * ------------------------------------------------------------------------------------------ */
-          })
+let searchedFolders: Set<string> = new Set()
+
  * Copyright (c) Microsoft Corporation. All rights reserved.
+      return
+  workspace as Workspace,
 import {
+ * ------------------------------------------------------------------------------------------ */
 import * as path from 'path'
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+    folder = getOuterMostWorkspaceFolder(folder)
 
  * ------------------------------------------------------------------------------------------ */
+function isExcluded(file: string, folder: WorkspaceFolder): boolean {
+      return
+  workspace as Workspace,
 import {
- * ------------------------------------------------------------------------------------------ */
  * ------------------------------------------------------------------------------------------ */
-import {
 import * as path from 'path'
  * ------------------------------------------------------------------------------------------ */
-      : []
+    _sortedWorkspaceFolders = Workspace.workspaceFolders
  * ------------------------------------------------------------------------------------------ */
-  }
-      }
+import * as path from 'path'
-  workspace as Workspace,
+let clients: Map<string, LanguageClient> = new Map()
 import {
   }