File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/plugin-ext/src/main/browser Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,16 @@ export class TextEditorMain implements Disposable {
9595 this . toDisposeOnEditor . push ( this . editor . onSelectionChanged ( _ => {
9696 this . updateProperties ( ) ;
9797 } ) ) ;
98- this . toDisposeOnEditor . push ( monacoEditor . onDidChangeModel ( ( ) => {
99- this . setEditor ( undefined ) ;
98+ this . toDisposeOnEditor . push ( monacoEditor . onDidChangeModel ( e => {
99+ // Ignore visibility-related model changes (null ↔ model) triggered by
100+ // the setModel(null) workaround in MonacoEditor.handleVisibilityChanged().
101+ // cf. https://github.com/eclipse-theia/theia/issues/14880
102+ // Only react to genuine model swaps where both old and new models exist.
103+ // In practice, this condition is never met because MonacoEditor instances
104+ // are created with a fixed document and never swap to a different model.
105+ if ( e . oldModelUrl && e . newModelUrl ) {
106+ this . setEditor ( undefined ) ;
107+ }
100108 } ) ) ;
101109 this . toDisposeOnEditor . push ( monacoEditor . onDidChangeCursorSelection ( e => {
102110 this . updateProperties ( e . source ) ;
You can’t perform that action at this time.
0 commit comments