mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 22:41:31 +01:00
Allow emmet in script tag if mimetype is html, plain or x-template #34921
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user