25
return undefined;
26
}
28
>
const idx = cell.fragment.indexOf('s');
29
>
if (idx < 0) {
30
return undefined;
31
}
33
>
const handle = parseInt(cell.fragment.substring(0, idx).replace(_padRegexp, ''), _radix);
34
>
const _scheme = decodeBase64(cell.fragment.substring(idx + 1)).toString();
35
>
36
>
if (isNaN(handle)) {
37
return undefined;
38
}
40
>
handle,
41
>
notebook: cell.with({ scheme: _scheme, fragment: null })
42
>
};
43
>
}
44
45
export function generate(notebook: URI, handle: number): URI {
47
>
const s = handle.toString(_radix);
48
>
const p = s.length < _lengths.length ? _lengths[s.length - 1] : 'z';
49
>
50
>
const fragment = `${p}${s}s${encodeBase64(VSBuffer.fromString(notebook.scheme), true, true)}`;
51
>
return notebook.with({ scheme: Schemas.vscodeNotebookCell, fragment });
52
>
}
53
54
export function parseMetadataUri(metadata: URI): URI | undefined {