Skip to content

Commit e96dcbb

Browse files
authored
Enable emmet.syntaxProfiles configuration item to support custom language Id
1 parent 035d510 commit e96dcbb

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/emmetHelper.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ import { parseSnippets, SnippetsMap, syntaxes } from './configCompat';
2323
export { FileService, FileType, FileStat };
2424

2525
let l10n: { t: (message: string) => string };
26+
let getProfileOfCurrentLanguageId = (profilesConfig: any) => null;
2627
try {
27-
l10n = require('vscode').l10n;
28+
var vscode = require('vscode');
29+
l10n = vscode.l10n;
30+
getProfileOfCurrentLanguageId = (profilesConfig: any) => profilesConfig[vscode.window.activeTextEditor.document.languageId];
2831
} catch {
2932
// Fallback to the identity function.
3033
l10n = {
@@ -851,7 +854,7 @@ function getProfile(syntax: string, profilesFromSettings: any): any {
851854
}
852855
const profilesConfig = Object.assign({}, profilesFromFile, profilesFromSettings);
853856

854-
const options = profilesConfig[syntax];
857+
const options = getProfileOfCurrentLanguageId(profilesConfig) || profilesConfig[syntax];
855858
if (!options || typeof options === 'string') {
856859
if (options === 'xhtml') {
857860
return {

0 commit comments

Comments
 (0)