提交 97734e3a 编写于 作者: M Matt Bierner

Reduce nested statements

上级 2e8e41c0
......@@ -67,6 +67,8 @@ class TagClosing {
const rangeStart = lastChange.range.start;
const version = document.version;
this._timeout = setTimeout(async () => {
this._timeout = undefined;
if (this._disposed) {
return;
}
......@@ -85,23 +87,25 @@ class TagClosing {
return;
}
if (!this._disposed) {
const activeEditor = vscode.window.activeTextEditor;
if (activeEditor) {
const activeDocument = activeEditor.document;
if (document === activeDocument && activeDocument.version === version) {
const selections = activeEditor.selections;
const snippet = this.getTagSnippet(body);
if (selections.length && selections.some(s => s.active.isEqual(position))) {
activeEditor.insertSnippet(snippet, selections.map(s => s.active));
} else {
activeEditor.insertSnippet(snippet, position);
}
}
}
if (this._disposed) {
return;
}
this._timeout = void 0;
const activeEditor = vscode.window.activeTextEditor;
if (!activeEditor) {
return;
}
const activeDocument = activeEditor.document;
if (document === activeDocument && activeDocument.version === version) {
const selections = activeEditor.selections;
const snippet = this.getTagSnippet(body);
if (selections.length && selections.some(s => s.active.isEqual(position))) {
activeEditor.insertSnippet(snippet, selections.map(s => s.active));
} else {
activeEditor.insertSnippet(snippet, position);
}
}
}, 100);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册