solorice/vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/vscode.proposed.notebookEditor.d.ts
2022-04-28 20:54:44 +03:00

175 lines
5.7 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode' {
// https://github.com/microsoft/vscode/issues/106744
/**
* Represents a notebook editor that is attached to a {@link NotebookDocument notebook}.
*/
export enum NotebookEditorRevealType {
/**
* The range will be revealed with as little scrolling as possible.
*/
Default = 0,
/**
* The range will always be revealed in the center of the viewport.
*/
InCenter = 1,
/**
* If the range is outside the viewport, it will be revealed in the center of the viewport.
* Otherwise, it will be revealed with as little scrolling as possible.
*/
InCenterIfOutsideViewport = 2,
/**
* The range will always be revealed at the top of the viewport.
*/
AtTop = 3
}
/**
* Represents a notebook editor that is attached to a {@link NotebookDocument notebook}.
*/
export interface NotebookEditor {
/**
* The document associated with this notebook editor.
*/
//todo@api rename to notebook?
readonly document: NotebookDocument;
/**
* The selections on this notebook editor.
*
* The primary selection (or focused range) is `selections[0]`. When the document has no cells, the primary selection is empty `{ start: 0, end: 0 }`;
*/
selections: NotebookRange[];
/**
* The current visible ranges in the editor (vertically).
*/
readonly visibleRanges: NotebookRange[];
/**
* Scroll as indicated by `revealType` in order to reveal the given range.
*
* @param range A range.
* @param revealType The scrolling strategy for revealing `range`.
*/
revealRange(range: NotebookRange, revealType?: NotebookEditorRevealType): void;
/**
* The column in which this editor shows.
*/
readonly viewColumn?: ViewColumn;
}
/** @deprecated */
export interface NotebookDocumentMetadataChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the document metadata have changed.
*/
//todo@API rename to notebook?
readonly document: NotebookDocument;
}
/** @deprecated */
export interface NotebookCellsChangeData {
readonly start: number;
// todo@API end? Use NotebookCellRange instead?
readonly deletedCount: number;
// todo@API removedCells, deletedCells?
readonly deletedItems: NotebookCell[];
// todo@API addedCells, insertedCells, newCells?
readonly items: NotebookCell[];
}
/** @deprecated */
export interface NotebookCellsChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the cells have changed.
*/
//todo@API rename to notebook?
readonly document: NotebookDocument;
readonly changes: ReadonlyArray<NotebookCellsChangeData>;
}
/** @deprecated */
export interface NotebookCellOutputsChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the cell outputs have changed.
*/
//todo@API remove? use cell.notebook instead?
readonly document: NotebookDocument;
// NotebookCellOutputsChangeEvent.cells vs NotebookCellMetadataChangeEvent.cell
readonly cells: NotebookCell[];
}
/** @deprecated */
export interface NotebookCellMetadataChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the cell metadata have changed.
*/
//todo@API remove? use cell.notebook instead?
readonly document: NotebookDocument;
// NotebookCellOutputsChangeEvent.cells vs NotebookCellMetadataChangeEvent.cell
readonly cell: NotebookCell;
}
export interface NotebookEditorSelectionChangeEvent {
/**
* The {@link NotebookEditor notebook editor} for which the selections have changed.
*/
readonly notebookEditor: NotebookEditor;
readonly selections: ReadonlyArray<NotebookRange>;
}
export interface NotebookEditorVisibleRangesChangeEvent {
/**
* The {@link NotebookEditor notebook editor} for which the visible ranges have changed.
*/
readonly notebookEditor: NotebookEditor;
readonly visibleRanges: ReadonlyArray<NotebookRange>;
}
export interface NotebookDocumentShowOptions {
viewColumn?: ViewColumn;
preserveFocus?: boolean;
preview?: boolean;
selections?: NotebookRange[];
}
export namespace notebooks {
/** @deprecated */
export const onDidSaveNotebookDocument: Event<NotebookDocument>;
/** @deprecated */
export const onDidChangeNotebookDocumentMetadata: Event<NotebookDocumentMetadataChangeEvent>;
/** @deprecated */
export const onDidChangeNotebookCells: Event<NotebookCellsChangeEvent>;
// todo@API add onDidChangeNotebookCellOutputs
/** @deprecated */
export const onDidChangeCellOutputs: Event<NotebookCellOutputsChangeEvent>;
// todo@API add onDidChangeNotebookCellMetadata
/** @deprecated */
export const onDidChangeCellMetadata: Event<NotebookCellMetadataChangeEvent>;
}
export namespace window {
export const visibleNotebookEditors: NotebookEditor[];
export const onDidChangeVisibleNotebookEditors: Event<NotebookEditor[]>;
export const activeNotebookEditor: NotebookEditor | undefined;
export const onDidChangeActiveNotebookEditor: Event<NotebookEditor | undefined>;
export const onDidChangeNotebookEditorSelection: Event<NotebookEditorSelectionChangeEvent>;
export const onDidChangeNotebookEditorVisibleRanges: Event<NotebookEditorVisibleRangesChangeEvent>;
export function showNotebookDocument(uri: Uri, options?: NotebookDocumentShowOptions): Thenable<NotebookEditor>;
export function showNotebookDocument(document: NotebookDocument, options?: NotebookDocumentShowOptions): Thenable<NotebookEditor>;
}
}