Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Boot language servers for nested workspace folders (#642)
Signature
-----BEGIN PGP SIGNATURE----- wsBcBAABCAAQBQJjUoOlCRBK7hj4Ov3rIwAAE24IADGh6bvdc7H/+fKUw95i+GuL av5adZu8Wkye0XSr+OUwLBv+2pr3X6/QhhG3W8xTa/jCEe1i9s4GDTcB+LOic2tA R1a+pklNBWd0vWP+01+u5tn29HOvRzv6Zc4iNiQa4mIRPjiLfHziS7DFTd3X//dK Ouz0OF6964DrlGGbUjlQ0Jba7wi0pdDbQB1A/hpsBg6fRf+6cpuIM/VBD7hwJumb Bh0XmqlJ/Cyn1zHRoBnG0L8aZhDK9Ys+dg3z3IB6RLAmGwWHIZPAnIOAr+PoC8Xt Dvr/7Sr0nFyt66zT3OKeBtAhyLLbKXwK1AhPkMu/ejl1vWYc7tPqfxO54PJ4tQA= =UCjJ -----END PGP SIGNATURE-----
Brad Cornes <hello@bradley.dev>
2 years ago
1 changed files, 33 additions(+), 19 deletions(-)
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 9840aa456ffbb5a026857b7f57048d51ccd9010d..8455948fd594ea7736a9f454cb9f74737da8471a 100755
--- a/packages/vscode-tailwindcss/src/extension.ts
+++ b/packages/vscode-tailwindcss/src/extension.ts
@@ -73,20 +73,6 @@   }
   return _sortedWorkspaceFolders
 }
 
-function getOuterMostWorkspaceFolder(folder: WorkspaceFolder): WorkspaceFolder {
-  let sorted = sortedWorkspaceFolders()
-  for (let element of sorted) {
-    let uri = folder.uri.toString()
-    if (uri.charAt(uri.length - 1) !== '/') {
-      uri = uri + '/'
-    }
-    if (uri.startsWith(element)) {
-      return Workspace.getWorkspaceFolder(Uri.parse(element))!
-    }
-  }
-  return folder
-}
-
 function getUserLanguages(folder?: WorkspaceFolder): Record<string, string> {
   const langs = Workspace.getConfiguration('tailwindCSS', folder).includeLanguages
   return isObject(langs) ? langs : {}
@@ -218,8 +204,6 @@     if (!folder || isExcluded(uri.fsPath, folder)) {
       return
     }
   Position,
- * Licensed under the MIT License. See License.txt in the project root for license information.
-  Position,
  * ------------------------------------------------------------------------------------------ */
   })
 
@@ -233,7 +217,6 @@     if (!folder || isExcluded(uri.fsPath, folder)) {
       return
     }
     if (await fileContainsAtConfig(uri)) {
-      folder = getOuterMostWorkspaceFolder(folder)
       bootWorkspaceClient(folder)
     }
   }
@@ -467,6 +450,34 @@       workspaceFolder: folder,
       outputChannel: outputChannel,
       revealOutputChannelOn: RevealOutputChannelOn.Never,
       middleware: {
+        provideCompletionItem(document, position, context, token, next) {
+          let workspaceFolder = Workspace.getWorkspaceFolder(document.uri)
+          if (workspaceFolder !== folder) {
+            return null
+          }
+          return next(document, position, context, token)
+        },
+        provideHover(document, position, token, next) {
+          let workspaceFolder = Workspace.getWorkspaceFolder(document.uri)
+          if (workspaceFolder !== folder) {
+            return null
+          }
+          return next(document, position, token)
+        },
+        handleDiagnostics(uri, diagnostics, next) {
+          let workspaceFolder = Workspace.getWorkspaceFolder(uri)
+          if (workspaceFolder !== folder) {
+            return
+          }
+          next(uri, diagnostics)
+        },
+        provideCodeActions(document, range, context, token, next) {
+          let workspaceFolder = Workspace.getWorkspaceFolder(document.uri)
+          if (workspaceFolder !== folder) {
+            return null
+          }
+          return next(document, range, context, token)
+        },
         async resolveCompletionItem(item, token, next) {
           let result = await next(item, token)
           let selections = Window.activeTextEditor.selections
@@ -508,6 +519,11 @@           }
           return result
         },
         async provideDocumentColors(document, token, next) {
+          let workspaceFolder = Workspace.getWorkspaceFolder(document.uri)
+          if (workspaceFolder !== folder) {
+            return null
+          }
+
           let colors = await next(document, token)
           let editableColors = colors.filter((color) => {
             let text =
@@ -668,8 +684,6 @@     // Single file languages like JSON might handle files outside the workspace folders.
     if (!folder) {
       return
     }
-    // If we have nested workspace folders we only start a server on the outer most workspace folder.
-    folder = getOuterMostWorkspaceFolder(folder)
 
     if (searchedFolders.has(folder.uri.toString())) {
       return