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

Create default notebook asks for default extension and kernel every time #3752

Closed
2 of 17 tasks
marckruzik opened this issue Nov 9, 2024 · 6 comments
Closed
2 of 17 tasks

Comments

@marckruzik
Copy link
Contributor

Describe the bug

When I am using the F1 function "Polyglot Notebook: Create default notebook", it does not save my choices as a preference.
So it asks me everytime about my default extension and default kernel.
I can still edit the settings to set the default extension and default kernel. And then it stops asking for them.

I'm opening this issue, because I remember that before, it was asking me to choose the extension and the kernel, but only the first time, then it was setting my choices as the default values.
But maybe I don't remember correctly.
If it doesn't work this way, should it be a new feature? => if so, I can create a specific topic for that.

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):
Version: 1.0.553001+f0ec3826954ea1ab829b435418328e4aa8db58e2

  • OS
    • Windows 11
    • Windows 10
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • Chrome
    • Edge
    • Firefox
    • Safari
  • Frontend
    • Jupyter Notebook
    • Jupyter Lab
    • nteract
    • Visual Studio Code
    • Visual Studio Code Insiders
    • Visual Studio
    • Other (please specify)
@jonsequitur
Copy link
Contributor

You're remembering correctly. There are two different commands: Polyglot Notebook: Create new blank notebook and Polyglot Notebook: Create default notebook. Can you try the second one and see if it's behaving as you'd like? If so let's use this issue to track a documentation bug, because this is far from obvious.

Image

@marckruzik
Copy link
Contributor Author

The command Polyglot Notebook: Create new blank notebook works as I think it should.
I explain how I think both commands should work.

Note:

  • each property (extension of kernel) is asked for separately.
  • a "property set" means it is already saved in the settings

Polyglot Notebook: Create new blank notebook

Behaviour

  • Each time, ask for extension and kernel

Tests

  • When property is not set (for extension and kernel):

    • check that property is not set
    • ask for property
    • check that property is still not set
  • When property is set (for extension and kernel):

    • check that property is not set
    • do not ask for property
    • check that property has not changed

As the properties are treated separately, it should manage different cases:

  • Test for 0 property set
  • Test for 1 property set extension
  • Test for 1 property set kernel
  • Test for 2 properties set extension and kernel

Polyglot Notebook: Create default notebook

Behaviour

  • If the property is absent from the settings:
    • Ask for missing property
    • Save property in the settings
  • If the property is present in the settings:
    • Ask nothing
    • Use the property from the settings

Tests

  • When no property set (for extension and kernel):

    • check that property is not set
    • ask for property
    • check that property is set
  • When extension set (for extension and kernel)

    • check that property is set
    • do not ask for property
    • check that property is still the same

As the properties are treated separately, it should manage different cases:

  • Test for 0 property set
  • Test for 1 property set extension
  • Test for 1 property set kernel
  • Test for 2 properties set extension and kernel

@jonsequitur
Copy link
Contributor

I see. I read this too quickly yesterday and I missed that you were talking specifically about Create default notebook.

I don't know if this behavior has changed but my memory of it is that the current behavior is intentional. When only one of the two properties is set, then only the other is prompted for. This is a useful behavior because people might vary which file extension they want but not which default language, or vice versa. The followinhg prompt after the notebook is created then allows some responsiveness to set the defaults without having to open VS Code settings:

Image

@brettfo @colombod Want to weigh in?

@brettfo
Copy link
Member

brettfo commented Nov 12, 2024

@jonsequitur @marckruzik Correct, the feature was written so that one or both properties could be manually set as the default, or you could be prompted to set them from your selected values.

For example, the default notebook extension (e.g., .dib or .ipynb) comes from here and the preferDefault flag ultimately came from the command Create default... or Create new.... Even if preferDefault was set, if no default was found then the user will still be prompted.

A few lines down the same pattern is repeated for the default language.

Finally, if the Create default... command was invoked and preferDefaults is true then this is executed which then shows the prompt in Jon's post (the prompt can be easy to miss, though; it appears on the bottom right of the screen and if you have a high resolution set, it can be easy to miss.)

@marckruzik
Copy link
Contributor Author

marckruzik commented Nov 12, 2024

Image

I did not see this pop up recently. Maybe I just did not watch accurately. But now I see it.
With this pop up, I am ok with the behaviour of Polyglot Notebook: Create default notebook, and it works.
So my initial post was incorrect, there is no issue.

I think we can close this issue?

@jonsequitur
Copy link
Contributor

I think so. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants