提交 663290f6 编写于 作者: D Denis Malinochkin 提交者: Erich Gamma

Emmet: canceling wrap shouldn't add tab to the active editor (#8489)

* fix #8450

* Fix this problem for Update Tag command

* Return the tab key only for Expand Abbreviation command
上级 4af1965f
...@@ -34,7 +34,7 @@ class UpdateTagAction extends EmmetEditorAction { ...@@ -34,7 +34,7 @@ class UpdateTagAction extends EmmetEditorAction {
} }
private wrapAbbreviation(_emmet: any, tag) { private wrapAbbreviation(_emmet: any, tag) {
if (!_emmet.run('update_tag', this.editorAccessor, tag)) { if (tag && !_emmet.run('update_tag', this.editorAccessor, tag)) {
this.editorAccessor.noExpansionOccurred(); this.editorAccessor.noExpansionOccurred();
} }
} }
......
...@@ -34,7 +34,7 @@ class WrapWithAbbreviationAction extends EmmetEditorAction { ...@@ -34,7 +34,7 @@ class WrapWithAbbreviationAction extends EmmetEditorAction {
} }
private wrapAbbreviation(_emmet: any, abbreviation) { private wrapAbbreviation(_emmet: any, abbreviation) {
if (!_emmet.run('wrap_with_abbreviation', this.editorAccessor, abbreviation)) { if (abbreviation && !_emmet.run('wrap_with_abbreviation', this.editorAccessor, abbreviation)) {
this.editorAccessor.noExpansionOccurred(); this.editorAccessor.noExpansionOccurred();
} }
} }
......
...@@ -23,9 +23,11 @@ export class EditorAccessor implements emmet.Editor { ...@@ -23,9 +23,11 @@ export class EditorAccessor implements emmet.Editor {
this.editor = editor; this.editor = editor;
} }
public noExpansionOccurred(): void { public noExpansionOccurred(actionId?: string): void {
// return the tab key handling back to the editor // return the tab key handling back to the editor only for Expand Abbreviation command
this.editor.trigger('emmet', Handler.Tab, {}); if (actionId === 'editor.emmet.action.expandAbbreviation') {
this.editor.trigger('emmet', Handler.Tab, {});
}
} }
public isEmmetEnabledMode(): boolean { public isEmmetEnabledMode(): boolean {
......
...@@ -68,7 +68,7 @@ export abstract class EmmetEditorAction extends EditorAction { ...@@ -68,7 +68,7 @@ export abstract class EmmetEditorAction extends EditorAction {
try { try {
if (!this.editorAccessor.isEmmetEnabledMode()) { if (!this.editorAccessor.isEmmetEnabledMode()) {
this.editorAccessor.noExpansionOccurred(); this.editorAccessor.noExpansionOccurred(this.id);
return; return;
} }
this.updateEmmetPreferences(_emmet); this.updateEmmetPreferences(_emmet);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册