Store keys in key order in SST blocks that omit hashesRust · 530 + / 249 −
Introduces 51 new declarations in turbopack/crates/turbo-persistence/src/static_sorted_file.rs.
Adds new framework internals rather than adjusting what was there. Read the linked PR for the surrounding test context.
turbopack/crates/turbo-persistence/src/static_sorted_file.rs ↗ · 10 files
@@ -861,87 +947,77 @@ impl StaticSortedFileIter { ensure!(data.len() >= 4, "key block too short"); let block_type = data[0]; let entry_count = be::read_u24(&data[1..]);- match block_type {- BLOCK_TYPE_KEY_WITH_HASH | BLOCK_TYPE_KEY_NO_HASH => {- let hash_len = if block_type == BLOCK_TYPE_KEY_WITH_HASH {- 8- } else {- 0- };- let n = entry_count as usize;- let offsets_range = 4..4 + n * 4;- let entries_range = 4 + n * 4..block.len();- let offsets = block.clone().slice(offsets_range);- let entries = block.slice(entries_range);- Ok(CurrentKeyBlock {- kind: CurrentKeyBlockKind::Variable { offsets, hash_len },- entries,- entry_count,- index: 0,- })- }- BLOCK_TYPE_FIXED_KEY_WITH_HASH | BLOCK_TYPE_FIXED_KEY_NO_HASH => {- let hash_len = if block_type == BLOCK_TYPE_FIXED_KEY_WITH_HASH {- 8- } else {- 0- };- let key_size = data[4] as usize;- let FixedValueLayout {+ let block_len = block.len();+ let Some((layout, fixed)) = KeyBlockLayout::from_block_type(block_type) else {+ bail!("Invalid key block type: {block_type}");
sessions: Improve GitHub context attachmentsTypeScript · 63 + / 27 −
Introduces 1 new declaration in src/vs/sessions/contrib/chat/browser/newChatContextAttachments.ts.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
src/vs/sessions/contrib/chat/browser/newChatContextAttachments.ts ↗ · 7 files
@@ -132,26 +134,41 @@ export class NewChatContextAttachments extends Disposable implements INewChatAtt for (const entry of visibleAttachments) { const pill = dom.append(this._container, dom.$('.sessions-chat-attachment-pill')); const resource = URI.isUri(entry.value) ? entry.value : isLocation(entry.value) ? entry.value.uri : undefined;+ const githubContextResource = entry.id.startsWith(GITHUB_CONTEXT_ID_PREFIX)+ ? URI.parse(entry.id.slice(GITHUB_CONTEXT_ID_PREFIX.length))+ : undefined;+ const openResource = resource ?? githubContextResource;+ const imageData = entry.kind === 'image' ? coerceImageBuffer(entry.value) : undefined;+ const canOpen = Boolean(imageData || openResource || isPastedTextArtifact(entry));+ let content: HTMLElement;+ if (canOpen) {+ const openButton = dom.append(pill, dom.$<HTMLButtonElement>('button.sessions-chat-attachment-open'));+ openButton.type = 'button';+ openButton.setAttribute('aria-label', localize('openNamedAttachment', "Open {0}", entry.name));+ content = openButton;+ pill.classList.add('openable');+ } else {+ content = dom.append(pill, dom.$('span.sessions-chat-attachment-content'));+ } if (entry.kind === 'image') {- const icon = dom.append(pill, renderIcon(Codicon.fileMedia));- dom.append(pill, dom.$('span.sessions-chat-attachment-name', undefined, entry.name));- const buffer = coerceImageBuffer(entry.value);- if (buffer) {+ const icon = dom.append(content, renderIcon(Codicon.fileMedia));+ dom.append(content, dom.$('span.sessions-chat-attachment-name', undefined, entry.name));+ if (imageData) { // Swap the generic icon for a thumbnail once the shared helper // has decoded one, matching the workbench attachment pill.- const preview = createImageHoverContent(resource, entry.name, buffer, entry.id, undefined, undefined, (url, isThumbnail) => {+ const preview = createImageHoverContent(resource, entry.name, imageData, entry.id, undefined, undefined, (url, isThumbnail) => { if (isThumbnail) { icon.replaceWith(dom.$('img.sessions-chat-attachment-image', { src: url, alt: '' }));