Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Fix IntelliSense inside Handlebars template scripts (#726)
Signature
-----BEGIN PGP SIGNATURE----- wsBcBAABCAAQBQJkCzSSCRBK7hj4Ov3rIwAAYxQIAIAZH+DqyApCaeVcp4OizGlf TH1uTOk0nCAmDERm+pLmegfviPA9rD9z/vJG/iLbMhxPYMtzAkWsgv+h5vBTGLQw wjUWj+9+UBUFPqfFsAL9Qspy3IbaJIVHvJYVgKn3cgInHjfMzoN0Gm3DutM6aZ7r KTaoBK26FFA2UFCqHdakIdkzfLinU/QzPhLL/Yv89kZxOisLHrRzxo4vWm6wdjHx 2D7CbobqW9QWH0sbP8nfidUPuJhKE4eK3xMwxo6NpXSaFb6Va6OL6d4O+McmtWav uAlwhtx26Gub9xCMP5HVTPUQAo2wWPKn9Yahm7jcJY4uM/IIR2EiOTkGffDxkjE= =/AVk -----END PGP SIGNATURE-----
Brad Cornes <hello@bradley.dev>
2 years ago
1 changed files, 22 additions(+), 0 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 3e972e94e22911343b5ae53ee78e093b8bc11134..a542e8f803bf515a1752f0e6f7e564605522a8c7 100644
--- a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
+++ b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
@@ -8,6 +8,16 @@ import Cache from 'tmp-cache'
 import { getTextWithoutComments } from './doc'
 
 import type { TextDocument, Range } from 'vscode-languageserver'
+  },
+
+let htmlScriptTypes = [
+  // https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html#option-1-use-script-tag
+let states = {
+  // https://vuejs.org/guide/essentials/component-basics.html#dom-template-parsing-caveats
+  'text/x-template',
+  // https://github.com/tailwindlabs/tailwindcss-intellisense/issues/722
+  'text/x-handlebars-template',
+]
 
 let text = { text: { match: /[^]/, lineBreaks: true } }
 
@@ -30,6 +40,8 @@     scriptStart: { match: '>', next: 'script' },
     jsBlockEnd: { match: '/>', pop: 1 },
     langAttrStartDouble: { match: 'lang="', push: 'langAttrDouble' },
     langAttrStartSingle: { match: "lang='", push: 'langAttrSingle' },
+    typeAttrStartDouble: { match: 'type="', push: 'typeAttrDouble' },
+    typeAttrStartSingle: { match: "type='", push: 'typeAttrSingle' },
     attrStartDouble: { match: '"', push: 'attrDouble' },
     attrStartSingle: { match: "'", push: 'attrSingle' },
     interp: { match: '{', push: 'interp' },
@@ -47,6 +59,14 @@   },
   langAttrSingle: {
     langAttrEnd: { match: "'", pop: 1 },
     lang: { match: /[^']+/, lineBreaks: true },
+  },
+  typeAttrDouble: {
+    langAttrEnd: { match: '"', pop: 1 },
+    type: { match: /[^"]+/, lineBreaks: true },
+  },
+  typeAttrSingle: {
+    langAttrEnd: { match: "'", pop: 1 },
+    type: { match: /[^']+/, lineBreaks: true },
   },
   attrDouble: {
     attrEnd: { match: '"', pop: 1 },
@@ -156,6 +176,8 @@           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
+        } else if (token.type === 'type' && htmlScriptTypes.includes(token.text)) {
+          boundaries[boundaries.length - 1].type = 'html'
         }
       }
       offset += token.text.length