custom metadata for notebook document.

This commit is contained in:
rebornix
2020-05-13 15:00:59 -07:00
parent 44c89d78e7
commit 1669bde634
4 changed files with 7 additions and 3 deletions
@@ -328,7 +328,7 @@ suite('metadata', () => {
await waitFor(500);
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first');
assert.equal(vscode.notebook.activeNotebookEditor!.document.metadata.custom['testMetadata'] as boolean, false);
assert.equal(vscode.notebook.activeNotebookEditor!.document.metadata.custom!['testMetadata'] as boolean, false);
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.metadata.custom!['testCellMetadata'] as number, 123);
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
});
+4 -2
View File
@@ -1642,9 +1642,9 @@ declare module 'vscode' {
displayOrder?: GlobPattern[];
/**
* Additional attributes of a cell metadata.
* Additional attributes of the document metadata.
*/
[key: string]: any;
custom?: { [key: string]: any };
}
export interface NotebookDocument {
@@ -1685,7 +1685,9 @@ declare module 'vscode' {
* The primary selected cell on this notebook editor.
*/
readonly selection?: NotebookCell;
viewColumn?: ViewColumn;
/**
* Fired when the output hosting webview posts a message.
*/
@@ -124,6 +124,7 @@ export class NotebookEditor extends BaseEditor {
}
clearInput(): void {
// de-ref widget
super.clearInput();
}
@@ -119,6 +119,7 @@ export class NotebookEditorInput extends EditorInput {
return this._move(group, target)?.editor;
}
// called when users rename a notebook document
move(group: GroupIdentifier, target: URI): IMoveResult | undefined {
if (this.textModel) {
const contributedNotebookProviders = this.notebookService.getContributedNotebookProviders(target);