Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Fix language features when using nested Vue `<template>` (#532)
Signature
-----BEGIN PGP SIGNATURE----- wsBcBAABCAAQBQJiXsDzCRBK7hj4Ov3rIwAAAUoIAD/R+E0zzi/pXoGyARJlxt/R h2imH2WHfSfsjLzdeesc1v9SxnAXes4U6ZhOglieaY7+MYsY1kt/FpX9+m5EREN5 enwP36lTNymZZnLTmU0sFvImKYYKMJ0soMY2pD+pURvP42sYUZoUD4WhYen5i1PH dAy52Bi1vGDpDt0fVBhGzr6ERx2TCbga2RG6SKls2oTU7wZ4iyUywjwn/MsremL8 pYgT7Al/MDMRQz2QfutxVG6QLYbzzz8g1N3SYtzDrDBlgKnNi5hKAZ5ZMpHRqpRI Wgt5GVp9H/T5XrZK57pWF9kQo1nlZ3rrFL6at7ikQrDaqswmv+liwSYAa/z+gd0= =rGxi -----END PGP SIGNATURE-----
Brad Cornes <hello@bradley.dev>
2 years ago
1 changed files, 24 additions(+), 11 deletions(-)
M packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts -> packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
diff --git a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
index bbe36ba68d407ebe4460cbf9095b9d689d148d17..a01a34ed97ac29898eaa1f687f07093ceca24f26 100644
--- a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
+++ b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
@@ -81,6 +81,17 @@     ...text,
   },
   html: {
     htmlBlockEnd: { match: '</template>', pop: 1 },
+    nestedBlockStart: { match: '<template', push: 'nestedBlock' },
+    ...text,
+  },
+  nestedBlock: {
+    nestedStart: { match: '>', next: 'nested' },
+    nestedBlockEnd: { match: '/>', pop: 1 },
+    ...text,
+  },
+  nested: {
+    nestedBlockEnd: { match: '</template>', pop: 1 },
+    nestedBlockStart: { match: '<template', push: 'nestedBlock' },
     ...text,
   },
 }
@@ -124,19 +135,21 @@   let offset = 0
 
   try {
     for (let token of lexer) {
-      if (token.type.endsWith('BlockStart')) {
-        let position = indexToPosition(text, offset)
-        if (!boundaries[boundaries.length - 1].range.end) {
+      if (!token.type.startsWith('nested')) {
+        if (token.type.endsWith('BlockStart')) {
+          let position = indexToPosition(text, offset)
+          if (!boundaries[boundaries.length - 1].range.end) {
+            boundaries[boundaries.length - 1].range.end = position
+          }
+          type = token.type.replace(/BlockStart$/, '')
+          boundaries.push({ type, range: { start: position, end: undefined } })
+        } else if (token.type.endsWith('BlockEnd')) {
+          let position = indexToPosition(text, offset)
           boundaries[boundaries.length - 1].range.end = position
+          boundaries.push({ type: defaultType, range: { start: position, end: undefined } })
+        } else if (token.type === 'lang') {
+          boundaries[boundaries.length - 1].type = token.text
         }
-        type = token.type.replace(/BlockStart$/, '')
-        boundaries.push({ type, range: { start: position, end: undefined } })
-      } else if (token.type.endsWith('BlockEnd')) {
-        let position = indexToPosition(text, offset)
-        boundaries[boundaries.length - 1].range.end = position
-        boundaries.push({ type: defaultType, range: { start: position, end: undefined } })
-      } else if (token.type === 'lang') {
-        boundaries[boundaries.length - 1].type = token.text
       }
       offset += token.text.length
     }