diff --git a/src/vs/workbench/parts/emmet/node/editorAccessor.ts b/src/vs/workbench/parts/emmet/node/editorAccessor.ts index cb2455e2827eb..5a553ea337afa 100644 --- a/src/vs/workbench/parts/emmet/node/editorAccessor.ts +++ b/src/vs/workbench/parts/emmet/node/editorAccessor.ts @@ -143,6 +143,10 @@ export class EditorAccessor implements emmet.Editor { } public getSyntax(): string { + return this.getSyntaxInternal(true); + } + + public getSyntaxInternal(overrideUsingProfiles: boolean): string { let position = this._editor.getSelection().getStartPosition(); let languageId = this._editor.getModel().getLanguageIdAtPosition(position.lineNumber, position.column); let language = this._languageIdentifierResolver.getLanguageIdentifier(languageId).language; @@ -154,7 +158,7 @@ export class EditorAccessor implements emmet.Editor { // user can overwrite the syntax using the emmet syntaxProfiles setting let profile = this.getSyntaxProfile(syntax); - if (profile && this.emmetSupportedModes.indexOf(profile) !== -1) { + if (overrideUsingProfiles && profile && this.emmetSupportedModes.indexOf(profile) !== -1) { return profile; } @@ -198,7 +202,16 @@ export class EditorAccessor implements emmet.Editor { return syntax; } + // If users have created their own output profile for current syntax as described + // http://docs.emmet.io/customization/syntax-profiles/#create-your-own-profile + // then we return the name of this profile. Else, we send null and + // emmet is smart enough to guess the right output profile public getProfileName(): string { + let syntax = this.getSyntaxInternal(false); + const profile = this._syntaxProfiles[syntax]; + if (profile && typeof profile !== 'string') { + return syntax; + } return null; }