Merge branch 'master' of github.com:bradlc/vscode-tailwindcss

master
Brad Cornes 2018-10-23 12:54:12 +01:00
commit c058f1d39b
1 changed files with 11 additions and 9 deletions

View File

@ -499,15 +499,7 @@ class TailwindIntellisense {
items: this._items, items: this._items,
languages: ['vue'], languages: ['vue'],
regex: /\bclass=["']([^"']*)$/, regex: /\bclass=["']([^"']*)$/,
enable: text => { enable: isWithinTemplate,
if (
text.indexOf('<template') !== -1 &&
text.indexOf('</template>') === -1
) {
return true
}
return false
},
triggerCharacters: ["'", '"', ' ', separator] triggerCharacters: ["'", '"', ' ', separator]
.concat([ .concat([
Object.keys( 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] === '</template' ? -1 : 1
}
return d !== 0
}