From 6313111fb949a4f50df5512eebbc43cfa92730d6 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Mon, 17 Jan 2022 15:34:06 +0100 Subject: [PATCH] VSC: Attempt to prevent rare "TextEditor has been disposed" error (#100) Note also - https://github.com/microsoft/vscode/issues/83258 - https://github.com/microsoft/vscode/issues/38239 --- vscode/src/Common.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vscode/src/Common.ts b/vscode/src/Common.ts index 40e74cf..5349f3a 100644 --- a/vscode/src/Common.ts +++ b/vscode/src/Common.ts @@ -39,6 +39,8 @@ export function applyEdit (editor, edit) { }) .then(didEdit => { if(!didEdit) return + // Try to prevent rare "TextEditor has been disposed" error + if(editor !== window.activeTextEditor) return if(wholeDocSelected) { const wholeRange = getDocRange() editor.selection = new Selection(wholeRange.start, wholeRange.end)