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

Choosing a kernel should provide a reasonable default language for cells in a new notebook. #4490

Closed
LadyNaggaga opened this issue Jan 25, 2021 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@LadyNaggaga
Copy link

Environment data

  • VS Code version: 1.53.0-insiders
  • Jupyter Extension version (available under the Extensions sidebar):v2020.12.414227025
  • Python Extension version (available under the Extensions sidebar): Python isn't installed
  • OS (Windows | Mac | Linux distro) and version: Windows 10
  • Python and/or Anaconda version: Isn't installed
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Jupyter server running: N/A
  • .NET Interactive extension: v1.0.207203

Expected behaviour

Once the user selects the one of a .Net Interactive kernel is selected from the kernel picker I expect the kernel to be recognize it. This only happens in the initial install of .NET Interactive but, doesn't work in a new instance of VS Code.

Actual behaviour

The .NET Interactive kernel isn't recognized in new VS Code instance. The user can select one of the .NET Interactive kernels however, when they hit the run button you are promoted to "Select a kernel to run the notebook"

Steps to reproduce:

Opening a New Notebook

  • Open a new window in VS Code Ctrl + Shift + N
  • Opened a new notebook - Using the Jupyter
    image
  • Cell default to a non .NET Interactive kernel
    image
    what kernel is it looking at ?
  • Switching to C# .NET Interactive by clicking on the c# label. .
    image
  • Selected C# .NET Interactive hit run and promoted to select a kernel
    image

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

XXX

@LadyNaggaga LadyNaggaga added the bug Issue identified by VS Code Team member as probable bug label Jan 25, 2021
@DavidKutu
Copy link

DavidKutu commented Jan 25, 2021

Thanks for filing @LadyNaggaga. Currently, that is the expected behavior, selecting the language in a cell does not select the kernel. To select it, please run the command: 'Notebook: Select Notebook Kernel' and select the kernel you want to use.

  • Does the kernel picker shows your .NET kernel?
  • Also, what happens if you just create a new notebook and run the first cell? Does the kernel picker appear? Or does it select a kernel you don't want?

@DavidKutu DavidKutu added the info-needed Issue requires more information from poster label Jan 25, 2021
@DonJayamanne

This comment has been minimized.

@DonJayamanne DonJayamanne reopened this Jan 25, 2021
@DonJayamanne DonJayamanne reopened this Jan 25, 2021
@greazer greazer changed the title Jupyter Ext + .NET Interactive: New Instance of VS code doesn't Choosing a kernel should provide a reasonable default language for cells in a new notebook. Jan 26, 2021
@DonJayamanne
Copy link
Contributor

@rchiodo @brettfo
How about the .NET extension chanage the language of the cells when a .NET interactive kernel is selecrted.
This is what we do today.

  • Add handler for notebook kernel selection (notebook.onDidChangeActiveNotebookKernel)
  • Look for cells in the notebook document & change the language from C# to C# .NET Interact
    • You can use the VSC API to update the langauages of existing cells

Does this work?

@LadyNaggaga
Copy link
Author

Thanks for getting back to me @DavidKutu please find my responses below

Thanks for filing @LadyNaggaga. Currently, that is the expected behavior, selecting the language in a cell does not select the kernel. To select it, please run the command: 'Notebook: Select Notebook Kernel' and select the kernel you want to use.

  • Does the kernel picker shows your .NET kernel?
    Yes, the .NET Interactive Kernel does appear in the language list. However, when you select C# .NET Interactive for example then hit run the user is promoted to "Select a kernel to run the notebook" but provides no options.
  • Also, what happens if you just create a new notebook and run the first cell? Does the kernel picker appear? Or does it select a kernel you don't want?
    The same thing happens if I open a new notebook in the same new VS Code instance.

@DavidKutu

This comment has been minimized.

@brettfo
Copy link
Member

brettfo commented Jan 26, 2021

@DonJayamanne We have some unpublished changes that listen for kernel change and if the new kernel is us, then we update the document's allowed languages to our restricted subset of 5. With a recent change to Insiders that fixed extension activation, the story now is pretty good for us regarding languages, but only if our kernel is selected. I added a comment to another issue here where I discuss how to auto-select our kernel if/when appropriate and some open questions around that experience.

@joyceerhl
Copy link
Contributor

@brettfo @LadyNaggaga hey team, checking in regarding this issue as it's been a couple months. It sounds like the .NET Interactive extension now selects a default .NET language when the .NET Interactive kernel is selected (and I was able to verify this behavior with v1.0.2207011 of the .NET Interactive extension). Were there any other changes that your team needed from us for this issue to be marked resolved?

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Apr 12, 2021

We're going to have to make changes to the API to make this possible.

  • Rather than getting .net to call our API registerNewNotebookContent
    • We will query all extensions & check if they contribute to us (read package.json and look for their contributions & update the list of the notebooks in the quick pick
  • Modify CreationOptions.registrations in src/client/datascience/notebook/creation/creationOptionsService.ts
    • Read package.json of other extensions using vscode.extensions.all.filter(item => item.packageJSON?.contributes?['jupyter.kernels'].....
contributes: {
  jupyter.kernels: [
    {
      title: ".NET Interactive Notebook (C#)",
      defaultlanguage: "dotnet-interactive.csharp" // this is how our special languages register with vscode
    } ,
    {
      title: ".NET Interactive Notebook (F#)",
      defaultlanguage: "dotnet-interactive.fsharp"
    }
  ]
}

Note sure we need kernelId (I'd personally remove that as we don't need it)

@DonJayamanne DonJayamanne added this to the May 2021 Release milestone Apr 12, 2021
@DavidKutu DavidKutu self-assigned this Apr 12, 2021
@DonJayamanne
Copy link
Contributor

@DavidKutu Please make note of the changes from displayName to title

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants