Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 1x 4x 1x 1x 3x 3x 3x 1x 1x 1x 1x 1x 2x 1x 1x | import * as vscode from 'vscode';
export const openDocument = {
id: 'mentor.command.openDocument',
handler: async (documentIri: string) => {
if (!documentIri) {
vscode.window.showErrorMessage('No document IRI provided.');
return;
}
try {
const uri = vscode.Uri.parse(documentIri);
if (uri.scheme === 'vscode-notebook-cell') {
// Get the notebook URI (remove the cell fragment)
const notebookUri = uri.with({ scheme: 'file', fragment: '' });
const notebook = await vscode.workspace.openNotebookDocument(notebookUri);
const notebookEditor = await vscode.window.showNotebookDocument(notebook);
const cell = notebookEditor.notebook.getCells().find(c => c.document.uri.toString() === uri.toString());
Iif (cell) {
const range = new vscode.NotebookRange(cell.index, cell.index + 1);
notebookEditor.revealRange(range, vscode.NotebookEditorRevealType.Default);
}
} else {
const document = await vscode.workspace.openTextDocument(uri);
await vscode.window.showTextDocument(document);
}
} catch (error: any) {
vscode.window.showErrorMessage(`Failed to open document: ${error.message}`);
}
}
}; |