Skip to content

Commit 210abca

Browse files
When notebooks are saved to disk, create unique filenames for cell code
1 parent 146aa64 commit 210abca

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

libs/vscode/notebooks/src/lib/controller/idl-notebook-controller.class.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
IDL_LANGUAGE_NAME,
1818
IDL_NOTEBOOK_CONTROLLER_NAME,
1919
IDL_NOTEBOOK_LANGUAGE_NAME,
20+
IDLFileHelper,
2021
Sleep,
2122
} from '@idl/shared';
2223
import { IDL_TRANSLATION } from '@idl/translation';
@@ -730,16 +731,19 @@ export class IDLNotebookController {
730731
// reset cell output
731732
execution.clearOutput();
732733

733-
/** Folder where we write notebook cell */
734+
/** Folder where we write notebook cell, check if NB is saved to disk */
734735
const nbDir =
735736
cell.notebook.uri.scheme === 'file'
736737
? dirname(CleanPath(cell.notebook.uri.fsPath))
737738
: NOTEBOOK_FOLDER;
738739

739740
/**
740-
* temp folder for notebook cell
741+
* PRO file for where we write the NB cell to disk
741742
*/
742-
const fsPath = join(nbDir, 'notebook_cell.pro');
743+
const fsPath =
744+
cell.notebook.uri.scheme === 'file'
745+
? IDLFileHelper.notebookCellUriToFSPath(cell.document.uri)
746+
: join(nbDir, 'notebook_cell.pro');
743747

744748
// make our folder if it doesnt exist
745749
if (!existsSync(nbDir)) {

0 commit comments

Comments
 (0)