Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codelens to ipynb json file to open in notebook editor #143422

Merged
merged 3 commits into from Feb 22, 2022

Conversation

rebornix
Copy link
Member

When ipynb files are corrupted, users can open them in Text Editor (see #142875 (comment)) but once the file is fixed, there isn't a clear way to reopen it in Notebook Editor. This is an exploration of adding a codelens to the ipynb json file to make it easy and discoverable.

Recording 2022-02-18 at 14 46 09

@@ -55,6 +65,14 @@ export function activate(context: vscode.ExtensionContext) {
await vscode.window.showNotebookDocument(doc);
}));

context.subscriptions.push(vscode.commands.registerCommand('ipynb.openIpynbInNotebookEditor', async (uri: vscode.Uri) => {
if (vscode.window.activeTextEditor?.document.uri.toString() === uri.toString()) {
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought there would be a generic "reopen in editor" command, maybe not

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can extends workbench.action.reopenWithEditor to support taking arguments later.

@rebornix rebornix merged commit 67cca9b into main Feb 22, 2022
@rebornix rebornix deleted the rebornix/nb-json-codelens branch February 22, 2022 21:18
@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants