Skip to content

Commit 1669129

Browse files
[Ignore] Update Proposed dts and include Notebook dts (#2918)
* [Ignore] Update Notebook dts * try creating another dts Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
1 parent f0b8a9a commit 1669129

File tree

2 files changed

+76
-3
lines changed

2 files changed

+76
-3
lines changed

vscode.notebooks.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
This file contains types introduced in a newer version of vscode than 1.45 that are used by the Notebook Mode feature.
3+
4+
We are locked on to 1.45 because that is what SAWs support.
5+
6+
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.
7+
*/
8+
9+
declare module 'vscode' {
10+
/**
11+
* Accessibility information which controls screen reader behavior.
12+
*/
13+
export interface AccessibilityInformation {
14+
/**
15+
* Label to be read out by a screen reader once the item has focus.
16+
*/
17+
label: string;
18+
19+
/**
20+
* Role of the widget which defines how a screen reader interacts with it.
21+
* The role should be set in special cases when for example a tree-like element behaves like a checkbox.
22+
* If role is not specified VS Code will pick the appropriate role automatically.
23+
* More about aria roles can be found here https://w3c.github.io/aria/#widget_roles
24+
*/
25+
role?: string;
26+
}
27+
}

vscode.proposed.d.ts

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ declare module 'vscode' {
9696

9797
export interface NotebookCellMetadata {
9898
/**
99-
* Controls if the content of a cell is editable or not.
99+
* Controls whether a cell's editor is editable/readonly.
100100
*/
101101
editable?: boolean;
102102

@@ -245,10 +245,16 @@ declare module 'vscode' {
245245
contains(uri: Uri): boolean
246246
}
247247

248+
export interface WorkspaceEdit {
249+
replaceCells(uri: Uri, start: number, end: number, cells: NotebookCellData[], metadata?: WorkspaceEditEntryMetadata): void;
250+
replaceCellOutput(uri: Uri, index: number, outputs: CellOutput[], metadata?: WorkspaceEditEntryMetadata): void;
251+
replaceCellMetadata(uri: Uri, index: number, cellMetadata: NotebookCellMetadata, metadata?: WorkspaceEditEntryMetadata): void;
252+
}
253+
248254
export interface NotebookEditorCellEdit {
249255

250-
replaceCells(from: number, to: number, cells: NotebookCellData[]): void;
251-
replaceOutputs(index: number, outputs: CellOutput[]): void;
256+
replaceCells(start: number, end: number, cells: NotebookCellData[]): void;
257+
replaceOutput(index: number, outputs: CellOutput[]): void;
252258
replaceMetadata(index: number, metadata: NotebookCellMetadata): void;
253259

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

532+
/**
533+
* Represents the alignment of status bar items.
534+
*/
535+
export enum NotebookCellStatusBarAlignment {
536+
537+
/**
538+
* Aligned to the left side.
539+
*/
540+
Left = 1,
541+
542+
/**
543+
* Aligned to the right side.
544+
*/
545+
Right = 2
546+
}
547+
548+
export interface NotebookCellStatusBarItem {
549+
readonly cell: NotebookCell;
550+
readonly alignment: NotebookCellStatusBarAlignment;
551+
readonly priority?: number;
552+
text: string;
553+
tooltip: string | undefined;
554+
command: string | Command | undefined;
555+
accessibilityInformation?: AccessibilityInformation;
556+
show(): void;
557+
hide(): void;
558+
dispose(): void;
559+
}
560+
526561
export namespace notebook {
527562
export function registerNotebookContentProvider(
528563
notebookType: string,
@@ -580,6 +615,17 @@ declare module 'vscode' {
580615
export function createConcatTextDocument(notebook: NotebookDocument, selector?: DocumentSelector): NotebookConcatTextDocument;
581616

582617
export const onDidChangeActiveNotebookKernel: Event<{ document: NotebookDocument, kernel: NotebookKernel | undefined }>;
618+
619+
/**
620+
* Creates a notebook cell status bar [item](#NotebookCellStatusBarItem).
621+
* It will be disposed automatically when the notebook document is closed or the cell is deleted.
622+
*
623+
* @param cell The cell on which this item should be shown.
624+
* @param alignment The alignment of the item.
625+
* @param priority The priority of the item. Higher values mean the item should be shown more to the left.
626+
* @return A new status bar item.
627+
*/
628+
export function createCellStatusBarItem(cell: NotebookCell, alignment?: NotebookCellStatusBarAlignment, priority?: number): NotebookCellStatusBarItem;
583629
}
584630

585631
//#endregion

0 commit comments

Comments
 (0)