From 663290f6f18f61ccd9f3d901e1c4898126cdb05c Mon Sep 17 00:00:00 2001 From: Denis Malinochkin Date: Wed, 29 Jun 2016 16:49:31 +0300 Subject: [PATCH] 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 --- src/vs/workbench/parts/emmet/node/actions/updateTag.ts | 2 +- .../parts/emmet/node/actions/wrapWithAbbreviation.ts | 2 +- src/vs/workbench/parts/emmet/node/editorAccessor.ts | 8 +++++--- src/vs/workbench/parts/emmet/node/emmetActions.ts | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/parts/emmet/node/actions/updateTag.ts b/src/vs/workbench/parts/emmet/node/actions/updateTag.ts index 2bd39a4753f..a5cb171dae5 100644 --- a/src/vs/workbench/parts/emmet/node/actions/updateTag.ts +++ b/src/vs/workbench/parts/emmet/node/actions/updateTag.ts @@ -34,7 +34,7 @@ class UpdateTagAction extends EmmetEditorAction { } 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(); } } diff --git a/src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts b/src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts index aec7c8d5d97..5477bda658c 100644 --- a/src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts +++ b/src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts @@ -34,7 +34,7 @@ class WrapWithAbbreviationAction extends EmmetEditorAction { } 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(); } } diff --git a/src/vs/workbench/parts/emmet/node/editorAccessor.ts b/src/vs/workbench/parts/emmet/node/editorAccessor.ts index ad77d9d543e..271418bfce3 100644 --- a/src/vs/workbench/parts/emmet/node/editorAccessor.ts +++ b/src/vs/workbench/parts/emmet/node/editorAccessor.ts @@ -23,9 +23,11 @@ export class EditorAccessor implements emmet.Editor { this.editor = editor; } - public noExpansionOccurred(): void { - // return the tab key handling back to the editor - this.editor.trigger('emmet', Handler.Tab, {}); + public noExpansionOccurred(actionId?: string): void { + // return the tab key handling back to the editor only for Expand Abbreviation command + if (actionId === 'editor.emmet.action.expandAbbreviation') { + this.editor.trigger('emmet', Handler.Tab, {}); + } } public isEmmetEnabledMode(): boolean { diff --git a/src/vs/workbench/parts/emmet/node/emmetActions.ts b/src/vs/workbench/parts/emmet/node/emmetActions.ts index 469b89771dd..e4383c62dff 100644 --- a/src/vs/workbench/parts/emmet/node/emmetActions.ts +++ b/src/vs/workbench/parts/emmet/node/emmetActions.ts @@ -68,7 +68,7 @@ export abstract class EmmetEditorAction extends EditorAction { try { if (!this.editorAccessor.isEmmetEnabledMode()) { - this.editorAccessor.noExpansionOccurred(); + this.editorAccessor.noExpansionOccurred(this.id); return; } this.updateEmmetPreferences(_emmet); -- GitLab