mirror of
https://github.com/Microsoft/vscode
synced 2024-10-14 07:19:07 +00:00
Implement getProfileName for emmet (#19109)
This commit is contained in:
parent
63414263ac
commit
eec1b5b107
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue