-
Notifications
You must be signed in to change notification settings - Fork 34.9k
Closed
Labels
apinotebookunder-discussionIssue is under discussion for relevance, priority, approachIssue is under discussion for relevance, priority, approach
Milestone
Description
The following changes to the current output API proposals are on the table. The focus is on simplifying and streamlining things (while still being equally powerful)
- Instead of three types for output, have a single type
- The effective output of a cell (
NotebookCell#output
) is many of these types (e.g NotebookCellOutput[]) - Each instance of
NotebookCellOutput
has a mime type, a value, and its metadata (iff applicable) - Use a
plain/text
mime type forCellStreamOutput
, respectively use an error mime type forCellErrorOutput
export class NotebookCellOutputItem {
readonly mime: string;
readonly value: unknown;
readonly metadata?: Record<string, string | number | boolean>;
constructor(mime: string, value: unknown, metadata?: Record<string, string | number | boolean>);
}
export class NotebookCellOutput {
readonly outputs: NotebookCellOutputItem[];
readonly metadata?: Record<string, string | number | boolean>;
constructor(outputs: NotebookCellOutputItem[], metadata?: Record<string, string | number | boolean>);
}
Usage sample
// CURRENT proposed API
let output = [{
outputKind: vscode.CellOutputKind.Rich,
data: {
'text/html': 'Hell<b>o</b>',
'application/json': ['hello', 'json'],
'image/png': '<base64>',
},
metadata: {
custom: {
'image/png': {
'width': 640,
'height': 480,
}
}
}
}, {
outputKind: vscode.CellOutputKind.Text,
text: 'REPL text'
}]
// NEW proposal
let output = [
new NotebookCellOutput([
new vscode.NotebookCellOutputItem('text/html', 'Hell<b>o</b>'),
new vscode.NotebookCellOutputItem('application/json', ['hello', 'json']),
new vscode.NotebookCellOutputItem('image/png', '<base64>', { width: 640, height: 480 }),
], { display_id: 'xyz'} ),
new NotebookCellOutput([
new vscode.NotebookCellOutputItem('text/plain', 'REPL text'),
])
]
Metadata
Metadata
Assignees
Labels
apinotebookunder-discussionIssue is under discussion for relevance, priority, approachIssue is under discussion for relevance, priority, approach