mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 17:48:56 +01:00
move/copy onDidSaveNotebookDocument-event into workspace, add onDidChangeNotebookDocument-event which fires for any notebook change: metadata, structure, cell output, cell metadata
This commit is contained in:
@@ -4,10 +4,12 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { deepFreeze } from 'vs/base/common/objects';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import * as extHostProtocol from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
|
||||
import { NotebookDocumentMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { SerializableObjectWithBuffers } from 'vs/workbench/services/extensions/common/proxyIdentifier';
|
||||
import type * as vscode from 'vscode';
|
||||
|
||||
@@ -16,17 +18,21 @@ export class ExtHostNotebookDocuments implements extHostProtocol.ExtHostNotebook
|
||||
private readonly _onDidChangeNotebookDocumentMetadata = new Emitter<vscode.NotebookDocumentMetadataChangeEvent>();
|
||||
readonly onDidChangeNotebookDocumentMetadata = this._onDidChangeNotebookDocumentMetadata.event;
|
||||
|
||||
private _onDidSaveNotebookDocument = new Emitter<vscode.NotebookDocument>();
|
||||
private readonly _onDidSaveNotebookDocument = new Emitter<vscode.NotebookDocument>();
|
||||
readonly onDidSaveNotebookDocument = this._onDidSaveNotebookDocument.event;
|
||||
|
||||
private readonly _onDidChangeNotebookDocument = new Emitter<vscode.NotebookDocumentChangeEvent>();
|
||||
readonly onDidChangeNotebookDocument = this._onDidChangeNotebookDocument.event;
|
||||
|
||||
constructor(
|
||||
@ILogService private readonly _logService: ILogService,
|
||||
private readonly _notebooksAndEditors: ExtHostNotebookController,
|
||||
) { }
|
||||
|
||||
$acceptModelChanged(uri: UriComponents, event: SerializableObjectWithBuffers<extHostProtocol.NotebookCellsChangedEventDto>, isDirty: boolean): void {
|
||||
$acceptModelChanged(uri: UriComponents, event: SerializableObjectWithBuffers<extHostProtocol.NotebookCellsChangedEventDto>, isDirty: boolean, newMetadata?: NotebookDocumentMetadata): void {
|
||||
const document = this._notebooksAndEditors.getNotebookDocument(URI.revive(uri));
|
||||
document.acceptModelChanged(event.value, isDirty);
|
||||
const e = document.acceptModelChanged(event.value, isDirty, newMetadata);
|
||||
this._onDidChangeNotebookDocument.fire(deepFreeze(e));
|
||||
}
|
||||
|
||||
$acceptDirtyStateChanged(uri: UriComponents, isDirty: boolean): void {
|
||||
|
||||
Reference in New Issue
Block a user