Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
fix issue with nested vue <template>
Brad Cornes <bradlc41@gmail.com>
6 years ago
1 changed files, 11 additions(+), 9 deletions(-)
M src/extension.ts -> src/extension.ts
diff --git a/src/extension.ts b/src/extension.ts
index 0e7d70b9c319b92521ed2e4100c03d73653bde39..e79a732b0b2ff6c84357a2db93f90e85e4e3699b 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -499,15 +499,7 @@       createCompletionItemProvider({
         items: this._items,
         languages: ['vue'],
         regex: /\bclass=["']([^"']*)$/,
-        enable: text => {
-          if (
-            text.indexOf('<template') !== -1 &&
-            text.indexOf('</template>') === -1
-          ) {
-            return true
-          }
-          return false
-        },
+        enable: isWithinTemplate,
         triggerCharacters: ["'", '"', ' ', separator]
           .concat([
             Object.keys(
@@ -788,3 +780,13 @@     },
     ' '
   )
 }
+
+function isWithinTemplate(text: string) {
+  let regex = /(<\/?template\b)/g
+  let match
+  let d = 0
+  while ((match = regex.exec(text)) !== null) {
+    d += match[0] === '</template' ? -1 : 1
+  }
+  return d !== 0
+}