Skip to content

Commit e793722

Browse files
authored
Fix typings for nb outline test. Re microsoft#164297 (microsoft#166084)
1 parent 5981426 commit e793722

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Codicon } from 'vs/base/common/codicons';
88
import { Emitter, Event } from 'vs/base/common/event';
99
import { combinedDisposable, IDisposable, Disposable, DisposableStore, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
1010
import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
11-
import { CellRevealType, IActiveNotebookEditor, ICellViewModel, INotebookEditorOptions, INotebookViewCellsUpdateEvent } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
11+
import { CellRevealType, IActiveNotebookEditor, ICellViewModel, INotebookEditorOptions, INotebookEditorPane, INotebookViewCellsUpdateEvent } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
1212
import { NotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookEditor';
1313
import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1414
import { IOutline, IOutlineComparator, IOutlineCreator, IOutlineListConfig, IOutlineService, IQuickPickDataSource, IQuickPickOutlineElement, OutlineChangeEvent, OutlineConfigCollapseItemsValues, OutlineConfigKeys, OutlineTarget } from 'vs/workbench/services/outline/browser/outline';
@@ -306,7 +306,7 @@ export class NotebookCellOutline implements IOutline<OutlineEntry> {
306306
}
307307

308308
constructor(
309-
private readonly _editor: NotebookEditor,
309+
private readonly _editor: INotebookEditorPane,
310310
private readonly _target: OutlineTarget,
311311
@IInstantiationService instantiationService: IInstantiationService,
312312
@IThemeService themeService: IThemeService,

src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { FindMatch, IModelDeltaDecoration, IReadonlyTextBuffer, ITextModel, Trac
1616
import { MenuId } from 'vs/platform/actions/common/actions';
1717
import { ITextEditorOptions, ITextResourceEditorInput } from 'vs/platform/editor/common/editor';
1818
import { IConstructorSignature } from 'vs/platform/instantiation/common/instantiation';
19-
import { IEditorPane } from 'vs/workbench/common/editor';
19+
import { IEditorPane, IEditorPaneWithSelection } from 'vs/workbench/common/editor';
2020
import { CellViewModelStateChangeEvent, NotebookCellStateChangedEvent, NotebookLayoutInfo } from 'vs/workbench/contrib/notebook/browser/notebookViewEvents';
2121
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
2222
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
@@ -445,6 +445,9 @@ export interface INotebookEditor {
445445
getDomNode(): HTMLElement;
446446
getInnerWebview(): IWebviewElement | undefined;
447447
getSelectionViewModels(): ICellViewModel[];
448+
getEditorViewState(): INotebookEditorViewState;
449+
restoreListViewState(viewState: INotebookEditorViewState | undefined): void;
450+
448451

449452
/**
450453
* Focus the active cell in notebook cell list
@@ -652,6 +655,12 @@ export interface IActiveNotebookEditor extends INotebookEditor {
652655
getNextVisibleCellIndex(index: number): number;
653656
}
654657

658+
export interface INotebookEditorPane extends IEditorPaneWithSelection {
659+
getControl(): INotebookEditor | undefined;
660+
readonly onDidChangeModel: Event<void>;
661+
textModel: NotebookTextModel | undefined;
662+
}
663+
655664
export interface IBaseCellEditorOptions extends IDisposable {
656665
readonly value: IEditorOptions;
657666
readonly onDidChange: Event<void>;

src/vs/workbench/contrib/notebook/browser/notebookEditor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
2323
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2424
import { IThemeService } from 'vs/platform/theme/common/themeService';
2525
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
26-
import { DEFAULT_EDITOR_ASSOCIATION, EditorInputCapabilities, EditorPaneSelectionChangeReason, EditorPaneSelectionCompareResult, EditorResourceAccessor, IEditorMemento, IEditorOpenContext, IEditorPaneSelection, IEditorPaneSelectionChangeEvent, IEditorPaneWithSelection } from 'vs/workbench/common/editor';
26+
import { DEFAULT_EDITOR_ASSOCIATION, EditorInputCapabilities, EditorPaneSelectionChangeReason, EditorPaneSelectionCompareResult, EditorResourceAccessor, IEditorMemento, IEditorOpenContext, IEditorPaneSelection, IEditorPaneSelectionChangeEvent } from 'vs/workbench/common/editor';
2727
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
2828
import { SELECT_KERNEL_ID } from 'vs/workbench/contrib/notebook/browser/controller/coreActions';
29-
import { INotebookEditorOptions, INotebookEditorViewState } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
29+
import { INotebookEditorOptions, INotebookEditorPane, INotebookEditorViewState } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
3030
import { IBorrowValue, INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/services/notebookEditorService';
3131
import { NotebookEditorWidget } from 'vs/workbench/contrib/notebook/browser/notebookEditorWidget';
3232
import { NotebooKernelActionViewItem } from 'vs/workbench/contrib/notebook/browser/viewParts/notebookKernelActionViewItem';
@@ -40,7 +40,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
4040

4141
const NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'NotebookEditorViewState';
4242

43-
export class NotebookEditor extends EditorPane implements IEditorPaneWithSelection {
43+
export class NotebookEditor extends EditorPane implements INotebookEditorPane {
4444
static readonly ID: string = NOTEBOOK_EDITOR_ID;
4545

4646
private readonly _editorMemento: IEditorMemento<INotebookEditorViewState>;

src/vs/workbench/contrib/notebook/test/browser/contrib/notebookOutline.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
1414
import { IMarkerService } from 'vs/platform/markers/common/markers';
1515
import { MarkerService } from 'vs/platform/markers/common/markerService';
1616
import { CellKind, IOutputDto, NotebookCellMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
17-
import { IActiveNotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
17+
import { IActiveNotebookEditor, INotebookEditorPane } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
1818
import { DisposableStore } from 'vs/base/common/lifecycle';
1919
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
2020

@@ -44,7 +44,12 @@ suite('Notebook Outline', function () {
4444
if (!editor.hasModel()) {
4545
assert.ok(false, 'MUST have active text editor');
4646
}
47-
const outline = instantiationService.createInstance(NotebookCellOutline, editor, OutlineTarget.OutlinePane);
47+
const outline = instantiationService.createInstance(NotebookCellOutline, new class extends mock<INotebookEditorPane>() {
48+
override getControl() {
49+
return editor;
50+
}
51+
override onDidChangeModel: Event<void> = Event.None;
52+
}, OutlineTarget.OutlinePane);
4853
return callback(outline, editor);
4954
});
5055

0 commit comments

Comments
 (0)