Allow emmet in script tag if mimetype is html, plain or x-template #34921

This commit is contained in:
Ramya Achutha Rao
2017-09-26 11:40:47 -07:00
parent 4dd1244c0a
commit a0139b47f4

View File

@@ -9,6 +9,8 @@ import { doComplete, isStyleSheet, getEmmetMode, extractAbbreviation } from 'vsc
import { isValidLocationForEmmetAbbreviation } from './abbreviationActions';
import { getNode, getInnerRange, getMappingForIncludedLanguages, parseDocument, getEmmetConfiguration } from './util';
const allowedMimeTypesInScriptTag = ['text/html', 'text/plain', 'text/x-template'];
export class DefaultCompletionItemProvider implements vscode.CompletionItemProvider {
public provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Thenable<vscode.CompletionList> {
@@ -107,7 +109,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
}
if (currentHtmlNode.name === 'script') {
if (currentHtmlNode.attributes
&& currentHtmlNode.attributes.some(x => x.name.toString() === 'type' && x.value.toString() === 'text/html')) {
&& currentHtmlNode.attributes.some(x => x.name.toString() === 'type' && allowedMimeTypesInScriptTag.indexOf(x.value.toString()) > -1)) {
return syntax;
}
return;