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

Saving untitled notebooks #98992

Closed
DonJayamanne opened this issue Jun 1, 2020 · 3 comments · Fixed by #100256
Closed

Saving untitled notebooks #98992

DonJayamanne opened this issue Jun 1, 2020 · 3 comments · Fixed by #100256
Assignees
Labels
feature-request Request for new features or functionality notebook on-testplan
Milestone

Comments

@DonJayamanne
Copy link
Contributor

  • Version: 1.46.0-insider
  • Commit: 2c1871d
  • Date: 2020-06-01T10:32:27.369Z
  • Electron: 7.3.0
  • Chrome: 78.0.3904.130
  • Node.js: 12.8.1
  • V8: 7.8.279.23-electron.0
  • OS: Darwin x64 19.5.0

Steps to Reproduce:

1.Create a new untitled notebook (using VS Code Python extension)
2.When you add a cell or the like, then VSC will invoke the save method on the NotebookContentProvider

Problems

  • Adding cells should not invoke save (this happens when user has auto save turned on)
  • Errors thrown in the saveNotebook method are ignored. VSC will assume the notebook was saved and mark it as not dirty (the dirty indicator doesn't exist on the tab anymore)

I don't think VSCode should call the saveNotebook method for untitled notebooks.

FYI - We create untitled notebooks with a scehme untitled.
If this isn't the way to indicate an untitled file (scheme), we might need some API or the like in the notebooks implememtation.

@rebornix /cc

@DonJayamanne DonJayamanne changed the title Handling untitled notebooks Saving untitled notebooks Jun 1, 2020
@rebornix rebornix self-assigned this Jun 1, 2020
@rebornix rebornix added bug Issue identified by VS Code Team member as probable bug notebook labels Jun 1, 2020
@rebornix
Copy link
Member

rebornix commented Jun 1, 2020

Good catch, untitled file should not trigger save until users explicitly run Save, which will invoke SaveAs.

@rebornix rebornix added this to the May 2020 milestone Jun 1, 2020
@rebornix rebornix added the under-discussion Issue is under discussion for relevance, priority, approach label Jun 2, 2020
@rebornix
Copy link
Member

rebornix commented Jun 2, 2020

We should also improve the overall experience for creating untitled notebook documents, they can be created in two approaches:

  • Users press cmd/ctrl+n to create an untitled file, switch to another view type (tracked in Untitled Notebook #93669)
  • Users run a specific command to quickly create a notebook untitled file. workbench.action.files.newUntitledFile command should take view type as arguments.

cc @mjbvz we may also want to adopt this in Custom Editor world.

@rebornix
Copy link
Member

We now support opening a untitled file with specified editor view type through the existing new untitled file command (in master, and tomorrow's Insiders)

  {
    "key": "cmd+i",
    "command": "workbench.action.files.newUntitledFile",
    "args": { "viewType": "github-issues" }
  }

When the command is executed, NotebookContentProvider.openNotebook is invoked with an URI with untitled scheme. NotebookContentProvider.saveNotebook is invoked only when users save so no auto save for untitled files as usual.

@rebornix rebornix added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug under-discussion Issue is under discussion for relevance, priority, approach labels Jun 15, 2020
@rebornix rebornix modified the milestones: Backlog, June 2020 Jun 15, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality notebook on-testplan
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants