提交 e81c07d7 编写于 作者: J Johannes Rieken

snippets - fix leaking listeners that break subsequent snippet insertion

上级 b2b81e4f
......@@ -62,12 +62,16 @@ export class SnippetController2 {
if (!this._snippet) {
// create a new session
this._snippet = new SnippetSession(this._editor);
this._snippet.insert(template, overwriteBefore, overwriteAfter);
this._snippetListener = [
this._editor.onDidChangeModel(() => this.cancel()),
this._editor.onDidChangeCursorSelection(() => this._updateState())
];
} else {
// only insert the snippet when a session
// is already active
this._snippet.insert(template, overwriteBefore, overwriteAfter);
}
this._snippet.insert(template, overwriteBefore, overwriteAfter);
this._snippetListener = [
this._editor.onDidChangeModel(() => this.cancel()),
this._editor.onDidChangeCursorSelection(() => this._updateState())
];
if (undoStopAfter) {
this._editor.getModel().pushStackElement();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册