-
Notifications
You must be signed in to change notification settings - Fork 28.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compress streams in notebook outputs #160946
Changes from all commits
1381b9e
47f133b
3ade74a
2d6ce1a
554fc2c
9ddbe3b
0a8e55d
3219f49
06f5422
42522fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,32 @@ export class ExtHostCell { | |
output.items.length = 0; | ||
} | ||
output.items.push(...newItems); | ||
|
||
if (output.items.length > 1 && output.items.every(item => notebookCommon.isTextStreamMime(item.mime))) { | ||
// Look for the mimes in the items, and keep track of their order. | ||
// Merge the streams into one output item, per mime type. | ||
const mimeOutputs = new Map<string, Uint8Array[]>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be useful to share code between here and notebookCellTextModel? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @roblourens where would i place such a common (shared) block of code.
I couldn't find a way to share a file that ends up importing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, you're already calling into notebookCommon and that makes sense as a place to keep it, but you would have to do it in a way that doesn't directly import 'vscode', eg work with a different interface. Whatever you wanna do though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, missed this, will work on that in debt. |
||
const mimeTypes: string[] = []; | ||
output.items.forEach(item => { | ||
let items: Uint8Array[]; | ||
if (mimeOutputs.has(item.mime)) { | ||
items = mimeOutputs.get(item.mime)!; | ||
} else { | ||
items = []; | ||
mimeOutputs.set(item.mime, items); | ||
mimeTypes.push(item.mime); | ||
} | ||
items.push(item.data); | ||
}); | ||
output.items.length = 0; | ||
mimeTypes.forEach(mime => { | ||
const compressed = notebookCommon.compressOutputItemStreams(mimeOutputs.get(mime)!); | ||
output.items.push({ | ||
mime, | ||
data: compressed.buffer | ||
}); | ||
}); | ||
} | ||
} | ||
} | ||
|
||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted code from previous PR