Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement getProfileName for emmet #19109

Merged
merged 1 commit into from
Jan 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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