mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
Explicit mapping for langs whose parent are emmet supported #28545
This commit is contained in:
@@ -13,6 +13,27 @@ import * as fs from 'fs';
|
||||
let variablesFromFile = {};
|
||||
let profilesFromFile = {};
|
||||
let emmetExtensionsPath = '';
|
||||
|
||||
export const LANGUAGE_MODES: Object = {
|
||||
'html': ['!', '.', '}'],
|
||||
'jade': ['!', '.', '}'],
|
||||
'slim': ['!', '.', '}'],
|
||||
'haml': ['!', '.', '}'],
|
||||
'xml': ['.', '}'],
|
||||
'xsl': ['.', '}'],
|
||||
'javascriptreact': ['.'],
|
||||
'typescriptreact': ['.'],
|
||||
'css': [':'],
|
||||
'scss': [':'],
|
||||
'sass': [':'],
|
||||
'less': [':'],
|
||||
'stylus': [':']
|
||||
};
|
||||
|
||||
// Explicitly map languages to their parent language to get emmet support
|
||||
export const MAPPED_MODES: Object = {
|
||||
'handlebars': 'html'
|
||||
};
|
||||
export function validate(allowStylesheet: boolean = true): boolean {
|
||||
let editor = vscode.window.activeTextEditor;
|
||||
if (!editor) {
|
||||
@@ -96,6 +117,18 @@ export function getVariables(): any {
|
||||
return Object.assign({}, variablesFromFile, variablesFromSettings);
|
||||
}
|
||||
|
||||
export function getMappedModes(): any {
|
||||
let finalMappedModes = {};
|
||||
let syntaxProfileConfig = vscode.workspace.getConfiguration('emmet')['syntaxProfiles'];
|
||||
let syntaxProfiles = Object.assign({}, MAPPED_MODES, syntaxProfileConfig ? syntaxProfileConfig : {});
|
||||
Object.keys(syntaxProfiles).forEach(syntax => {
|
||||
if (typeof syntaxProfiles[syntax] === 'string' && LANGUAGE_MODES[syntaxProfiles[syntax]]) {
|
||||
finalMappedModes[syntax] = syntaxProfiles[syntax];
|
||||
}
|
||||
});
|
||||
return finalMappedModes;
|
||||
}
|
||||
|
||||
export function updateExtensionsPath() {
|
||||
let currentEmmetExtensionsPath = vscode.workspace.getConfiguration('emmet')['extensionsPath'];
|
||||
if (emmetExtensionsPath !== currentEmmetExtensionsPath) {
|
||||
|
||||
Reference in New Issue
Block a user