Skip to content

Commit

Permalink
Implement getProfileName for emmet
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jan 24, 2017
1 parent 288254a commit 61f9ff8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/vs/workbench/parts/emmet/node/editorAccessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 61f9ff8

Please sign in to comment.