@@ -58,6 +58,10 @@ import { AccessibilitySignal, IAccessibilitySignalService } from 'vs/platform/ac
58
58
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility' ;
59
59
import { IQuickDiffService , QuickDiff } from 'vs/workbench/contrib/scm/common/quickDiff' ;
60
60
import { IQuickDiffSelectItem , SwitchQuickDiffBaseAction , SwitchQuickDiffViewItem } from 'vs/workbench/contrib/scm/browser/dirtyDiffSwitcher' ;
61
+ import { TextDiffEditor } from 'vs/workbench/browser/parts/editor/textDiffEditor' ;
62
+ import { IEditorControl } from 'vs/workbench/common/editor' ;
63
+ import { TextFileEditor } from 'vs/workbench/contrib/files/browser/editors/textFileEditor' ;
64
+ import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEditor' ;
61
65
62
66
class DiffActionRunner extends ActionRunner {
63
67
@@ -1649,8 +1653,28 @@ export class DirtyDiffWorkbenchController extends Disposable implements ext.IWor
1649
1653
this . enabled = false ;
1650
1654
}
1651
1655
1656
+ private getVisibleEditorControls ( ) : IEditorControl [ ] {
1657
+ const controls : IEditorControl [ ] = [ ] ;
1658
+ const addControl = ( control : IEditorControl | undefined ) => {
1659
+ if ( control ) {
1660
+ controls . push ( control ) ;
1661
+ }
1662
+ } ;
1663
+
1664
+ for ( const editorPane of this . editorService . visibleEditorPanes ) {
1665
+ if ( editorPane instanceof TextDiffEditor || editorPane instanceof TextFileEditor ) {
1666
+ addControl ( editorPane . getControl ( ) ) ;
1667
+ } else if ( editorPane instanceof SideBySideEditor ) {
1668
+ addControl ( editorPane . getPrimaryEditorPane ( ) ?. getControl ( ) ) ;
1669
+ addControl ( editorPane . getSecondaryEditorPane ( ) ?. getControl ( ) ) ;
1670
+ }
1671
+ }
1672
+ return controls ;
1673
+ }
1674
+
1652
1675
private onEditorsChanged ( ) : void {
1653
- for ( const editor of this . editorService . visibleTextEditorControls ) {
1676
+ const visibleControls = this . getVisibleEditorControls ( ) ;
1677
+ for ( const editor of visibleControls ) {
1654
1678
if ( isCodeEditor ( editor ) ) {
1655
1679
const textModel = editor . getModel ( ) ;
1656
1680
const controller = DirtyDiffController . get ( editor ) ;
@@ -1676,7 +1700,7 @@ export class DirtyDiffWorkbenchController extends Disposable implements ext.IWor
1676
1700
1677
1701
for ( const [ uri , item ] of this . items ) {
1678
1702
for ( const editorId of item . keys ( ) ) {
1679
- if ( ! this . editorService . visibleTextEditorControls . find ( editor => isCodeEditor ( editor ) && editor . getModel ( ) ?. uri . toString ( ) === uri . toString ( ) && editor . getId ( ) === editorId ) ) {
1703
+ if ( ! this . getVisibleEditorControls ( ) . find ( editor => isCodeEditor ( editor ) && editor . getModel ( ) ?. uri . toString ( ) === uri . toString ( ) && editor . getId ( ) === editorId ) ) {
1680
1704
if ( item . has ( editorId ) ) {
1681
1705
const dirtyDiffItem = item . get ( editorId ) ;
1682
1706
dirtyDiffItem ?. dispose ( ) ;
0 commit comments