Skip to content

Commit

Permalink
re #102503. onDidSaveNotebookDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Aug 3, 2020
1 parent 0009a0b commit ccb2e96
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,7 @@ declare module 'vscode' {

export const onDidOpenNotebookDocument: Event<NotebookDocument>;
export const onDidCloseNotebookDocument: Event<NotebookDocument>;
export const onDidSaveNotebookDocument: Event<NotebookDocument>;

/**
* All currently known notebook documents.
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
checkProposedApiEnabled(extension);
return extHostNotebook.onDidCloseNotebookDocument;
},
get onDidSaveNotebookDocument(): Event<vscode.NotebookDocument> {
checkProposedApiEnabled(extension);
return extHostNotebook.onDidSaveNotebookDocument;
},
get notebookDocuments(): vscode.NotebookDocument[] {
checkProposedApiEnabled(extension);
return extHostNotebook.notebookDocuments;
Expand Down
10 changes: 10 additions & 0 deletions src/vs/workbench/api/common/extHostNotebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,8 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
onDidOpenNotebookDocument: Event<vscode.NotebookDocument> = this._onDidOpenNotebookDocument.event;
private _onDidCloseNotebookDocument = new Emitter<vscode.NotebookDocument>();
onDidCloseNotebookDocument: Event<vscode.NotebookDocument> = this._onDidCloseNotebookDocument.event;
private _onDidSaveNotebookDocument = new Emitter<vscode.NotebookDocument>();
onDidSaveNotebookDocument: Event<vscode.NotebookDocument> = this._onDidCloseNotebookDocument.event;
visibleNotebookEditors: ExtHostNotebookEditor[] = [];
private _onDidChangeActiveNotebookKernel = new Emitter<{ document: ExtHostNotebookDocument, kernel: vscode.NotebookKernel | undefined }>();
onDidChangeActiveNotebookKernel = this._onDidChangeActiveNotebookKernel.event;
Expand Down Expand Up @@ -1450,6 +1452,14 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
}
}

public $acceptModelSaved(uriComponents: UriComponents): void {
const document = this._documents.get(URI.revive(uriComponents).toString());
if (document) {
// this.$acceptDirtyStateChanged(uriComponents, false);
this._onDidSaveNotebookDocument.fire(document);
}
}

$acceptEditorPropertiesChanged(uriComponents: UriComponents, data: INotebookEditorPropertiesChangeData): void {
const editor = this._getEditorFromURI(uriComponents);

Expand Down

0 comments on commit ccb2e96

Please sign in to comment.