Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/polyglot-notebooks-vscode-common/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ export function registerFileCommands(context: vscode.ExtensionContext, parserSer
const eol = getEol();

const notebookFileFilters = {
'Polyglot Notebooks': ['dib'],
'Jupyter Notebooks': ['ipynb'],
'Polyglot Notebook Script': ['dib'],
'Jupyter Notebook': ['ipynb'],
};

async function newNotebookCommandHandler(preferDefaults: boolean): Promise<void> {
Expand Down
14 changes: 14 additions & 0 deletions src/polyglot-notebooks-vscode-common/src/notebookControllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,27 @@ const openedNotebooks = new Set<string>();
function markNotebookAsOpened(notebook: vscode.NotebookDocument) {
openedNotebooks.add(notebook.uri.fsPath);
}

function isNotebookOpenComplete(notebook: vscode.NotebookDocument) {
return openedNotebooks.has(notebook.uri.fsPath);
}

function stopTrackingNotebook(notebook: vscode.NotebookDocument) {
openedNotebooks.delete(notebook.uri.fsPath);
}

async function ensureCellKernelMetadata(cell: vscode.NotebookCell, options: { preferPreviousCellMetadata: boolean }): Promise<void> {
if (cell.document.languageId === 'markdown') {
const existingCellMetadata = cell.metadata?.custom?.metadata;
if (existingCellMetadata?.polyglot_notebook || existingCellMetadata?.dotnet_interactive) {
const updatedCellMetadata = { ...cell.metadata };
delete updatedCellMetadata.custom.metadata.dotnet_interactive;
delete updatedCellMetadata.custom.metadata.polyglot_notebook;
await vscodeNotebookManagement.replaceNotebookCellMetadata(cell.notebook.uri, cell.index, updatedCellMetadata);
}
return;
}

// if we found the cell ensure it has kernel metadata
const cellMetadata = metadataUtilities.getNotebookCellMetadataFromNotebookCellElement(cell);
if (!cellMetadata.kernelName) {
Expand Down