Skip to content

[Ignore] Update Notebook dts #2918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions vscode.notebooks.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
This file contains types introduced in a newer version of vscode than 1.45 that are used by the Notebook Mode feature.

We are locked on to 1.45 because that is what SAWs support.

Once SAWs support a newer version of vscode we can remove this. My hope is that this will be the only addition to this file.
*/

declare module 'vscode' {
/**
* Accessibility information which controls screen reader behavior.
*/
export interface AccessibilityInformation {
/**
* Label to be read out by a screen reader once the item has focus.
*/
label: string;

/**
* Role of the widget which defines how a screen reader interacts with it.
* The role should be set in special cases when for example a tree-like element behaves like a checkbox.
* If role is not specified VS Code will pick the appropriate role automatically.
* More about aria roles can be found here https://w3c.github.io/aria/#widget_roles
*/
role?: string;
}
}
52 changes: 49 additions & 3 deletions vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ declare module 'vscode' {

export interface NotebookCellMetadata {
/**
* Controls if the content of a cell is editable or not.
* Controls whether a cell's editor is editable/readonly.
*/
editable?: boolean;

Expand Down Expand Up @@ -245,10 +245,16 @@ declare module 'vscode' {
contains(uri: Uri): boolean
}

export interface WorkspaceEdit {
replaceCells(uri: Uri, start: number, end: number, cells: NotebookCellData[], metadata?: WorkspaceEditEntryMetadata): void;
replaceCellOutput(uri: Uri, index: number, outputs: CellOutput[], metadata?: WorkspaceEditEntryMetadata): void;
replaceCellMetadata(uri: Uri, index: number, cellMetadata: NotebookCellMetadata, metadata?: WorkspaceEditEntryMetadata): void;
}

export interface NotebookEditorCellEdit {

replaceCells(from: number, to: number, cells: NotebookCellData[]): void;
replaceOutputs(index: number, outputs: CellOutput[]): void;
replaceCells(start: number, end: number, cells: NotebookCellData[]): void;
replaceOutput(index: number, outputs: CellOutput[]): void;
replaceMetadata(index: number, metadata: NotebookCellMetadata): void;

/** @deprecated */
Expand Down Expand Up @@ -523,6 +529,35 @@ declare module 'vscode' {
resolveKernel?(kernel: T, document: NotebookDocument, webview: NotebookCommunication, token: CancellationToken): ProviderResult<void>;
}

/**
* Represents the alignment of status bar items.
*/
export enum NotebookCellStatusBarAlignment {

/**
* Aligned to the left side.
*/
Left = 1,

/**
* Aligned to the right side.
*/
Right = 2
}

export interface NotebookCellStatusBarItem {
readonly cell: NotebookCell;
readonly alignment: NotebookCellStatusBarAlignment;
readonly priority?: number;
text: string;
tooltip: string | undefined;
command: string | Command | undefined;
accessibilityInformation?: AccessibilityInformation;
show(): void;
hide(): void;
dispose(): void;
}

export namespace notebook {
export function registerNotebookContentProvider(
notebookType: string,
Expand Down Expand Up @@ -580,6 +615,17 @@ declare module 'vscode' {
export function createConcatTextDocument(notebook: NotebookDocument, selector?: DocumentSelector): NotebookConcatTextDocument;

export const onDidChangeActiveNotebookKernel: Event<{ document: NotebookDocument, kernel: NotebookKernel | undefined }>;

/**
* Creates a notebook cell status bar [item](#NotebookCellStatusBarItem).
* It will be disposed automatically when the notebook document is closed or the cell is deleted.
*
* @param cell The cell on which this item should be shown.
* @param alignment The alignment of the item.
* @param priority The priority of the item. Higher values mean the item should be shown more to the left.
* @return A new status bar item.
*/
export function createCellStatusBarItem(cell: NotebookCell, alignment?: NotebookCellStatusBarAlignment, priority?: number): NotebookCellStatusBarItem;
}

//#endregion
Expand Down