File tree Expand file tree Collapse file tree
src/vs/workbench/contrib/notebook/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -385,26 +385,28 @@ export interface NotebookDataDto {
385385export namespace CellUri {
386386
387387 export const scheme = 'vscode-notebook-cell' ;
388+ const _regex = / ^ \d { 7 , } / ;
388389
389390 export function generate ( notebook : URI , handle : number ) : URI {
390391 return notebook . with ( {
391392 scheme,
392- fragment : `${ handle } ${ notebook . scheme !== Schemas . file ? notebook . scheme : '' } `
393+ fragment : `${ handle . toString ( ) . padStart ( 7 , '0' ) } ${ notebook . scheme !== Schemas . file ? notebook . scheme : '' } `
393394 } ) ;
394395 }
395396
396397 export function parse ( cell : URI ) : { notebook : URI , handle : number } | undefined {
397398 if ( cell . scheme !== scheme ) {
398399 return undefined ;
399400 }
400- const handle = parseInt ( cell . fragment ) ;
401- if ( isNaN ( handle ) ) {
401+ const match = _regex . exec ( cell . fragment ) ;
402+ if ( ! match ) {
402403 return undefined ;
403404 }
405+ const handle = Number ( match [ 0 ] ) ;
404406 return {
405407 handle,
406408 notebook : cell . with ( {
407- scheme : cell . fragment . substr ( handle . toString ( ) . length ) || Schemas . file ,
409+ scheme : cell . fragment . substr ( match [ 0 ] . length ) || Schemas . file ,
408410 fragment : null
409411 } )
410412 } ;
You can’t perform that action at this time.
0 commit comments