diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 5550bfa655..96dc4f19b8 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -361,7 +361,14 @@ export class Ctx implements RustAnalyzerExtensionApi { } }); - vscode.workspace.onDidChangeTextDocument(async () => { + vscode.workspace.onDidChangeTextDocument(async (e) => { + if ( + vscode.window.activeTextEditor?.document !== e.document || + e.contentChanges.length === 0 + ) { + return; + } + if (this.syntaxTreeView?.visible) { await this.syntaxTreeProvider?.refresh(); }