mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
finalize notebookDocumentEvents
-API, https://github.com/microsoft/vscode/issues/144662
This commit is contained in:
parent
36d7dd2a57
commit
9530dca29d
|
@ -10,8 +10,7 @@
|
|||
},
|
||||
"enabledApiProposals": [
|
||||
"notebookEditor",
|
||||
"notebookEditorEdit",
|
||||
"notebookDocumentEvents"
|
||||
"notebookEditorEdit"
|
||||
],
|
||||
"activationEvents": [
|
||||
"*"
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
"notebookControllerKind",
|
||||
"notebookDebugOptions",
|
||||
"notebookDeprecated",
|
||||
"notebookDocumentEvents",
|
||||
"notebookEditor",
|
||||
"notebookEditorDecorationType",
|
||||
"notebookEditorEdit",
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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',
|
||||
|
|
164
src/vscode-dts/vscode.d.ts
vendored
164
src/vscode-dts/vscode.d.ts
vendored
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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>;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue