diff --git a/src/extension.ts b/src/extension.ts index 0e7d70b..e79a732 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -499,15 +499,7 @@ class TailwindIntellisense { items: this._items, languages: ['vue'], regex: /\bclass=["']([^"']*)$/, - enable: text => { - if ( - text.indexOf('') === -1 - ) { - return true - } - return false - }, + enable: isWithinTemplate, triggerCharacters: ["'", '"', ' ', separator] .concat([ Object.keys( @@ -788,3 +780,13 @@ function createScreenCompletionItemProvider({ ' ' ) } + +function isWithinTemplate(text: string) { + let regex = /(<\/?template\b)/g + let match + let d = 0 + while ((match = regex.exec(text)) !== null) { + d += match[0] === '