This commit is contained in:
Johannes 2022-04-20 13:54:05 +02:00
parent 36d7dd2a57
commit 9530dca29d
No known key found for this signature in database
GPG key ID: 6DEF802A22264FCA
7 changed files with 133 additions and 151 deletions

View file

@ -10,8 +10,7 @@
},
"enabledApiProposals": [
"notebookEditor",
"notebookEditorEdit",
"notebookDocumentEvents"
"notebookEditorEdit"
],
"activationEvents": [
"*"

View file

@ -10,7 +10,6 @@
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.notebookEditor.d.ts",
"../../src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts",
"../../src/vscode-dts/vscode.proposed.notebookDocumentEvents.d.ts",
"../../src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts"
]
}

View file

@ -23,7 +23,6 @@
"notebookControllerKind",
"notebookDebugOptions",
"notebookDeprecated",
"notebookDocumentEvents",
"notebookEditor",
"notebookEditorDecorationType",
"notebookEditorEdit",

View file

@ -892,11 +892,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostNotebook.getNotebookDocument(uri).apiNotebook;
},
onDidSaveNotebookDocument(listener, thisArg, disposables) {
checkProposedApiEnabled(extension, 'notebookDocumentEvents');
return extHostNotebookDocuments.onDidSaveNotebookDocument(listener, thisArg, disposables);
},
onDidChangeNotebookDocument(listener, thisArg, disposables) {
checkProposedApiEnabled(extension, 'notebookDocumentEvents');
return extHostNotebookDocuments.onDidChangeNotebookDocument(listener, thisArg, disposables);
},
get onDidOpenNotebookDocument(): Event<vscode.NotebookDocument> {

View file

@ -34,7 +34,6 @@ export const allApiProposals = Object.freeze({
notebookControllerKind: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookControllerKind.d.ts',
notebookDebugOptions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts',
notebookDeprecated: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDeprecated.d.ts',
notebookDocumentEvents: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDocumentEvents.d.ts',
notebookEditor: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditor.d.ts',
notebookEditorDecorationType: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditorDecorationType.d.ts',
notebookEditorEdit: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts',

View file

@ -11721,6 +11721,16 @@ declare module 'vscode' {
*/
export function openNotebookDocument(notebookType: string, content?: NotebookData): Thenable<NotebookDocument>;
/**
* An event that is emitted when a {@link NotebookDocument notebook} has changed.
*/
export const onDidChangeNotebookDocument: Event<NotebookDocumentChangeEvent>;
/**
* An event that is emitted when a {@link NotebookDocument notebook} is saved.
*/
export const onDidSaveNotebookDocument: Event<NotebookDocument>;
/**
* Register a {@link NotebookSerializer notebook serializer}.
*
@ -12440,6 +12450,39 @@ declare module 'vscode' {
}
/**
* Represents a notebook editor that is attached to a {@link NotebookDocument notebook}.
* Additional properties of the NotebookEditor are available in the proposed
* API, which will be finalized later.
*/
export interface NotebookEditor {
}
/**
* Renderer messaging is used to communicate with a single renderer. It's returned from {@link notebooks.createRendererMessaging}.
*/
export interface NotebookRendererMessaging {
/**
* An event that fires when a message is received from a renderer.
*/
readonly onDidReceiveMessage: Event<{
readonly editor: NotebookEditor;
readonly message: any;
}>;
/**
* Send a message to one or all renderer.
*
* @param message Message to send
* @param editor Editor to target with the message. If not provided, the
* message is sent to all renderers.
* @returns a boolean indicating whether the message was successfully
* delivered to any renderer.
*/
postMessage(message: any, editor?: NotebookEditor): Thenable<boolean>;
}
/**
* A notebook cell kind.
*/
@ -12503,39 +12546,6 @@ declare module 'vscode' {
readonly executionSummary: NotebookCellExecutionSummary | undefined;
}
/**
* Represents a notebook editor that is attached to a {@link NotebookDocument notebook}.
* Additional properties of the NotebookEditor are available in the proposed
* API, which will be finalized later.
*/
export interface NotebookEditor {
}
/**
* Renderer messaging is used to communicate with a single renderer. It's returned from {@link notebooks.createRendererMessaging}.
*/
export interface NotebookRendererMessaging {
/**
* An event that fires when a message is received from a renderer.
*/
readonly onDidReceiveMessage: Event<{
readonly editor: NotebookEditor;
readonly message: any;
}>;
/**
* Send a message to one or all renderer.
*
* @param message Message to send
* @param editor Editor to target with the message. If not provided, the
* message is sent to all renderers.
* @returns a boolean indicating whether the message was successfully
* delivered to any renderer.
*/
postMessage(message: any, editor?: NotebookEditor): Thenable<boolean>;
}
/**
* Represents a notebook which itself is a sequence of {@link NotebookCell code or markup cells}. Notebook documents are
* created from {@link NotebookData notebook data}.
@ -12615,6 +12625,94 @@ declare module 'vscode' {
save(): Thenable<boolean>;
}
/**
* Describes a change to a notebook cell.
*
* @see {@link NotebookDocumentChangeEvent}
*/
export interface NotebookDocumentCellChange {
/**
* The affected notebook.
*/
readonly cell: NotebookCell;
/**
* The document of the cell or `undefined` when it did not change.
*
* *Note* that you should use the {@link workspace.onDidChangeTextDocument onDidChangeTextDocument}-event
* for detailed change information, like what edits have been performed.
*/
readonly document: TextDocument | undefined;
/**
* The new metadata of the cell or `undefined` when it did not change.
*/
readonly metadata: { [key: string]: any } | undefined;
/**
* The new outputs of the cell or `undefined` when they did not change.
*/
readonly outputs: readonly NotebookCellOutput[] | undefined;
/**
* The new execution summary of the cell or `undefined` when it did not change.
*/
readonly executionSummary: NotebookCellExecutionSummary | undefined;
}
/**
* Describes a structural change to a notebook document, e.g newly added and removed cells.
*
* @see {@link NotebookDocumentChangeEvent}
*/
export interface NotebookDocumentContentChange {
/**
* The range at which cells have been either added or removed.
*
* Note that no cells have been {@link NotebookDocumentContentChange.removedCells removed}
* when this range is {@link NotebookRange.isEmpty empty}.
*/
readonly range: NotebookRange;
/**
* Cells that have been added to the document.
*/
readonly addedCells: readonly NotebookCell[];
/**
* Cells that have been removed from the document.
*/
readonly removedCells: readonly NotebookCell[];
}
/**
* An event describing a transactional {@link NotebookDocument notebook} change.
*/
export interface NotebookDocumentChangeEvent {
/**
* The affected notebook.
*/
readonly notebook: NotebookDocument;
/**
* The new metadata of the notebook or `undefined` when it did not change.
*/
readonly metadata: { [key: string]: any } | undefined;
/**
* An array of content changes describing added or removed {@link NotebookCell cells}.
*/
readonly contentChanges: readonly NotebookDocumentContentChange[];
/**
* An array of {@link NotebookDocumentCellChange cell changes}.
*/
readonly cellChanges: readonly NotebookDocumentCellChange[];
}
/**
* The summary of a notebook cell execution.
*/

View file

@ -1,110 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// https://github.com/microsoft/vscode/issues/144662
declare module 'vscode' {
/**
* Describes a change to a notebook cell.
*
* @see {@link NotebookDocumentChangeEvent}
*/
export interface NotebookDocumentCellChange {
/**
* The affected notebook.
*/
readonly cell: NotebookCell;
/**
* The document of the cell or `undefined` when it did not change.
*
* *Note* that you should use the {@link workspace.onDidChangeTextDocument onDidChangeTextDocument}-event
* for detailed change information, like what edits have been performed.
*/
readonly document: TextDocument | undefined;
/**
* The new metadata of the cell or `undefined` when it did not change.
*/
readonly metadata: { [key: string]: any } | undefined;
/**
* The new outputs of the cell or `undefined` when they did not change.
*/
readonly outputs: readonly NotebookCellOutput[] | undefined;
/**
* The new execution summary of the cell or `undefined` when it did not change.
*/
readonly executionSummary: NotebookCellExecutionSummary | undefined;
}
/**
* Describes a structural change to a notebook document, e.g newly added and removed cells.
*
* @see {@link NotebookDocumentChangeEvent}
*/
export interface NotebookDocumentContentChange {
/**
* The range at which cells have been either added or removed.
*
* Note that no cells have been {@link NotebookDocumentContentChange.removedCells removed}
* when this range is {@link NotebookRange.isEmpty empty}.
*/
readonly range: NotebookRange;
/**
* Cells that have been added to the document.
*/
readonly addedCells: readonly NotebookCell[];
/**
* Cells that have been removed from the document.
*/
readonly removedCells: readonly NotebookCell[];
}
/**
* An event describing a transactional {@link NotebookDocument notebook} change.
*/
export interface NotebookDocumentChangeEvent {
/**
* The affected notebook.
*/
readonly notebook: NotebookDocument;
/**
* The new metadata of the notebook or `undefined` when it did not change.
*/
readonly metadata: { [key: string]: any } | undefined;
/**
* An array of content changes describing added or removed {@link NotebookCell cells}.
*/
readonly contentChanges: readonly NotebookDocumentContentChange[];
/**
* An array of {@link NotebookDocumentCellChange cell changes}.
*/
readonly cellChanges: readonly NotebookDocumentCellChange[];
}
export namespace workspace {
/**
* An event that is emitted when a {@link NotebookDocument notebook} is saved.
*/
export const onDidSaveNotebookDocument: Event<NotebookDocument>;
/**
* An event that is emitted when a {@link NotebookDocument notebook} has changed.
*/
export const onDidChangeNotebookDocument: Event<NotebookDocumentChangeEvent>;
}
}