提交 bd3beec0 编写于 作者: M Matt Bierner

Extract getInsertionPositions

上级 6c995780
......@@ -114,13 +114,9 @@ class TagClosing {
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);
}
activeEditor.insertSnippet(
this.getTagSnippet(body),
this.getInsertionPositions(activeEditor, position));
}
}, 100);
}
......@@ -131,6 +127,13 @@ class TagClosing {
snippet.appendText(closingTag.newText);
return snippet;
}
private getInsertionPositions(editor: vscode.TextEditor, position: vscode.Position) {
const activeSelectionPositions = editor.selections.map(s => s.active);
return activeSelectionPositions.some(p => p.isEqual(position))
? activeSelectionPositions
: position;
}
}
export class ActiveDocumentDependentRegistration {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册