Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Lyu <penn.lv@gmail.com>2022-11-11 11:46:21 +0300
committerGitHub <noreply@github.com>2022-11-11 11:46:21 +0300
commite793722b9ee1ea369188bdac805dca0a0effcd51 (patch)
treee22d2eabf1c012034a750aedb523602c0b001cc1
parent59814267dd231103225c29cb98c1f3476825911a (diff)
Fix typings for nb outline test. Re #164297 (#166084)
-rw-r--r--src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts4
-rw-r--r--src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts11
-rw-r--r--src/vs/workbench/contrib/notebook/browser/notebookEditor.ts6
-rw-r--r--src/vs/workbench/contrib/notebook/test/browser/contrib/notebookOutline.test.ts9
4 files changed, 22 insertions, 8 deletions
diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts b/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts
index 350cd8885c4..6a2f2676764 100644
--- a/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts
+++ b/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts
@@ -8,7 +8,7 @@ import { Codicon } from 'vs/base/common/codicons';
import { Emitter, Event } from 'vs/base/common/event';
import { combinedDisposable, IDisposable, Disposable, DisposableStore, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
-import { CellRevealType, IActiveNotebookEditor, ICellViewModel, INotebookEditorOptions, INotebookViewCellsUpdateEvent } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
+import { CellRevealType, IActiveNotebookEditor, ICellViewModel, INotebookEditorOptions, INotebookEditorPane, INotebookViewCellsUpdateEvent } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { NotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookEditor';
import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
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> {
}
constructor(
- private readonly _editor: NotebookEditor,
+ private readonly _editor: INotebookEditorPane,
private readonly _target: OutlineTarget,
@IInstantiationService instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService,
diff --git a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
index 95df7696197..d0ef02c47e9 100644
--- a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
+++ b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
@@ -16,7 +16,7 @@ import { FindMatch, IModelDeltaDecoration, IReadonlyTextBuffer, ITextModel, Trac
import { MenuId } from 'vs/platform/actions/common/actions';
import { ITextEditorOptions, ITextResourceEditorInput } from 'vs/platform/editor/common/editor';
import { IConstructorSignature } from 'vs/platform/instantiation/common/instantiation';
-import { IEditorPane } from 'vs/workbench/common/editor';
+import { IEditorPane, IEditorPaneWithSelection } from 'vs/workbench/common/editor';
import { CellViewModelStateChangeEvent, NotebookCellStateChangedEvent, NotebookLayoutInfo } from 'vs/workbench/contrib/notebook/browser/notebookViewEvents';
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
@@ -445,6 +445,9 @@ export interface INotebookEditor {
getDomNode(): HTMLElement;
getInnerWebview(): IWebviewElement | undefined;
getSelectionViewModels(): ICellViewModel[];
+ getEditorViewState(): INotebookEditorViewState;
+ restoreListViewState(viewState: INotebookEditorViewState | undefined): void;
+
/**
* Focus the active cell in notebook cell list
@@ -652,6 +655,12 @@ export interface IActiveNotebookEditor extends INotebookEditor {
getNextVisibleCellIndex(index: number): number;
}
+export interface INotebookEditorPane extends IEditorPaneWithSelection {
+ getControl(): INotebookEditor | undefined;
+ readonly onDidChangeModel: Event<void>;
+ textModel: NotebookTextModel | undefined;
+}
+
export interface IBaseCellEditorOptions extends IDisposable {
readonly value: IEditorOptions;
readonly onDidChange: Event<void>;
diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
index 90ea4504d46..75680fbdebe 100644
--- a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+++ b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
@@ -23,10 +23,10 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
-import { DEFAULT_EDITOR_ASSOCIATION, EditorInputCapabilities, EditorPaneSelectionChangeReason, EditorPaneSelectionCompareResult, EditorResourceAccessor, IEditorMemento, IEditorOpenContext, IEditorPaneSelection, IEditorPaneSelectionChangeEvent, IEditorPaneWithSelection } from 'vs/workbench/common/editor';
+import { DEFAULT_EDITOR_ASSOCIATION, EditorInputCapabilities, EditorPaneSelectionChangeReason, EditorPaneSelectionCompareResult, EditorResourceAccessor, IEditorMemento, IEditorOpenContext, IEditorPaneSelection, IEditorPaneSelectionChangeEvent } from 'vs/workbench/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { SELECT_KERNEL_ID } from 'vs/workbench/contrib/notebook/browser/controller/coreActions';
-import { INotebookEditorOptions, INotebookEditorViewState } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
+import { INotebookEditorOptions, INotebookEditorPane, INotebookEditorViewState } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { IBorrowValue, INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/services/notebookEditorService';
import { NotebookEditorWidget } from 'vs/workbench/contrib/notebook/browser/notebookEditorWidget';
import { NotebooKernelActionViewItem } from 'vs/workbench/contrib/notebook/browser/viewParts/notebookKernelActionViewItem';
@@ -40,7 +40,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
const NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'NotebookEditorViewState';
-export class NotebookEditor extends EditorPane implements IEditorPaneWithSelection {
+export class NotebookEditor extends EditorPane implements INotebookEditorPane {
static readonly ID: string = NOTEBOOK_EDITOR_ID;
private readonly _editorMemento: IEditorMemento<INotebookEditorViewState>;
diff --git a/src/vs/workbench/contrib/notebook/test/browser/contrib/notebookOutline.test.ts b/src/vs/workbench/contrib/notebook/test/browser/contrib/notebookOutline.test.ts
index 0e898675d75..afdd543fde9 100644
--- a/src/vs/workbench/contrib/notebook/test/browser/contrib/notebookOutline.test.ts
+++ b/src/vs/workbench/contrib/notebook/test/browser/contrib/notebookOutline.test.ts
@@ -14,7 +14,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IMarkerService } from 'vs/platform/markers/common/markers';
import { MarkerService } from 'vs/platform/markers/common/markerService';
import { CellKind, IOutputDto, NotebookCellMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
-import { IActiveNotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
+import { IActiveNotebookEditor, INotebookEditorPane } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
@@ -44,7 +44,12 @@ suite('Notebook Outline', function () {
if (!editor.hasModel()) {
assert.ok(false, 'MUST have active text editor');
}
- const outline = instantiationService.createInstance(NotebookCellOutline, editor, OutlineTarget.OutlinePane);
+ const outline = instantiationService.createInstance(NotebookCellOutline, new class extends mock<INotebookEditorPane>() {
+ override getControl() {
+ return editor;
+ }
+ override onDidChangeModel: Event<void> = Event.None;
+ }, OutlineTarget.OutlinePane);
return callback(outline, editor);
});