提交 d0dc1bdd 编写于 作者: E Erich Gamma

fix for #7882

上级 eaa522cc
...@@ -15,13 +15,11 @@ import nls = require('vs/nls'); ...@@ -15,13 +15,11 @@ import nls = require('vs/nls');
export abstract class EmmetEditorAction extends EditorAction { export abstract class EmmetEditorAction extends EditorAction {
protected static editorAccessor: EditorAccessor; protected editorAccessor: EditorAccessor;
constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor) { constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor) {
super(descriptor, editor, Behaviour.TextFocus); super(descriptor, editor, Behaviour.TextFocus);
if (!EmmetEditorAction.editorAccessor) { this.editorAccessor = new EditorAccessor(editor);
EmmetEditorAction.editorAccessor = new EditorAccessor(editor);
}
} }
abstract runEmmetAction(_module: any); abstract runEmmetAction(_module: any);
...@@ -30,15 +28,15 @@ export abstract class EmmetEditorAction extends EditorAction { ...@@ -30,15 +28,15 @@ export abstract class EmmetEditorAction extends EditorAction {
return new TPromise((c, e) => { return new TPromise((c, e) => {
require(['emmet'], (_module) => { require(['emmet'], (_module) => {
try { try {
if (!EmmetEditorAction.editorAccessor.isEmmetEnabledMode()) { if (!this.editorAccessor.isEmmetEnabledMode()) {
EmmetEditorAction.editorAccessor.noExpansionOccurred(); this.editorAccessor.noExpansionOccurred();
return; return;
} }
this.runEmmetAction(_module); this.runEmmetAction(_module);
} catch (err) { } catch (err) {
// //
} finally { } finally {
EmmetEditorAction.editorAccessor.flushCache(); this.editorAccessor.flushCache();
} }
}, e); }, e);
}); });
...@@ -53,8 +51,8 @@ export class ExpandAbbreviationAction extends EmmetEditorAction { ...@@ -53,8 +51,8 @@ export class ExpandAbbreviationAction extends EmmetEditorAction {
} }
public runEmmetAction(_module) { public runEmmetAction(_module) {
if (!_module.run('expand_abbreviation', EmmetEditorAction.editorAccessor)) { if (!_module.run('expand_abbreviation', this.editorAccessor)) {
EmmetEditorAction.editorAccessor.noExpansionOccurred(); this.editorAccessor.noExpansionOccurred();
} }
} }
} }
...@@ -67,8 +65,8 @@ export class RemoveTagAction extends EmmetEditorAction { ...@@ -67,8 +65,8 @@ export class RemoveTagAction extends EmmetEditorAction {
} }
public runEmmetAction(_module) { public runEmmetAction(_module) {
if (!_module.run('remove_tag', EmmetEditorAction.editorAccessor)) { if (!_module.run('remove_tag', this.editorAccessor)) {
EmmetEditorAction.editorAccessor.noExpansionOccurred(); this.editorAccessor.noExpansionOccurred();
} }
} }
} }
...@@ -91,8 +89,8 @@ export class UpdateTagAction extends EmmetEditorAction { ...@@ -91,8 +89,8 @@ export class UpdateTagAction extends EmmetEditorAction {
} }
private wrapAbbreviation(_module: any, tag) { private wrapAbbreviation(_module: any, tag) {
if (!_module.run('update_tag', EmmetEditorAction.editorAccessor, tag)) { if (!_module.run('update_tag', this.editorAccessor, tag)) {
EmmetEditorAction.editorAccessor.noExpansionOccurred(); this.editorAccessor.noExpansionOccurred();
} }
} }
} }
...@@ -115,8 +113,8 @@ export class WrapWithAbbreviationAction extends EmmetEditorAction { ...@@ -115,8 +113,8 @@ export class WrapWithAbbreviationAction extends EmmetEditorAction {
} }
private wrapAbbreviation(_module: any, abbreviation) { private wrapAbbreviation(_module: any, abbreviation) {
if (!_module.run('wrap_with_abbreviation', EmmetEditorAction.editorAccessor, abbreviation)) { if (!_module.run('wrap_with_abbreviation', this.editorAccessor, abbreviation)) {
EmmetEditorAction.editorAccessor.noExpansionOccurred(); this.editorAccessor.noExpansionOccurred();
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册