@@ -24,7 +24,7 @@ import { ITelemetryService } from '../../../../platform/telemetry/common/telemet
24
24
import { IThemeService } from '../../../../platform/theme/common/themeService.js' ;
25
25
import { Selection } from '../../../../editor/common/core/selection.js' ;
26
26
import { EditorPane } from '../../../browser/parts/editor/editorPane.js' ;
27
- import { DEFAULT_EDITOR_ASSOCIATION , EditorPaneSelectionChangeReason , EditorPaneSelectionCompareResult , EditorResourceAccessor , IEditorMemento , IEditorOpenContext , IEditorPaneScrollPosition , IEditorPaneSelection , IEditorPaneSelectionChangeEvent , IEditorPaneWithScrolling , createEditorOpenError , createTooLargeFileError , isEditorOpenError } from '../../../common/editor.js' ;
27
+ import { DEFAULT_EDITOR_ASSOCIATION , EditorPaneSelectionChangeReason , EditorPaneSelectionCompareResult , EditorResourceAccessor , IEditorMemento , IEditorOpenContext , IEditorPane , IEditorPaneScrollPosition , IEditorPaneSelection , IEditorPaneSelectionChangeEvent , IEditorPaneWithScrolling , createEditorOpenError , createTooLargeFileError , isEditorOpenError } from '../../../common/editor.js' ;
28
28
import { EditorInput } from '../../../common/editor/editorInput.js' ;
29
29
import { SELECT_KERNEL_ID } from './controller/coreActions.js' ;
30
30
import { INotebookEditorOptions , INotebookEditorPane , INotebookEditorViewState } from './notebookBrowser.js' ;
@@ -48,6 +48,7 @@ import { ILogService } from '../../../../platform/log/common/log.js';
48
48
import { IPreferencesService } from '../../../services/preferences/common/preferences.js' ;
49
49
import { IActionViewItemOptions } from '../../../../base/browser/ui/actionbar/actionViewItems.js' ;
50
50
import { StopWatch } from '../../../../base/common/stopwatch.js' ;
51
+ import { ICodeEditor } from '../../../../editor/browser/editorBrowser.js' ;
51
52
52
53
const NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'NotebookEditorViewState' ;
53
54
@@ -658,3 +659,17 @@ class NotebookEditorSelection implements IEditorPaneSelection {
658
659
return this . cellUri . fragment ;
659
660
}
660
661
}
662
+
663
+ export function isNotebookContainingCellEditor ( editor : IEditorPane | undefined , codeEditor : ICodeEditor ) : boolean {
664
+ if ( editor ?. getId ( ) === NotebookEditor . ID ) {
665
+ const notebookWidget = editor . getControl ( ) as NotebookEditorWidget ;
666
+ if ( notebookWidget ) {
667
+ for ( const [ _ , editor ] of notebookWidget . codeEditors ) {
668
+ if ( editor === codeEditor ) {
669
+ return true ;
670
+ }
671
+ }
672
+ }
673
+ }
674
+ return false ;
675
+ }
0 commit comments