posit-dev / positron

Positron, a next-generation data science IDE
Other
2.31k stars 68 forks source link

Errors when creating new notebook with Positron Notebooks enabled #3492

Open sharon-wang opened 2 months ago

sharon-wang commented 2 months ago

Positron Version: 2024.06.0-50

Steps to reproduce the issue:

Pre-req: Enable the Positron Notebooks configuration setting positron.notebooks.usePositronNotebooks

via New File

  1. Create a Jupyter Notebook via New File > Jupyter Notebook
  2. An empty notebook file will open, but the kernel may not be connected and many errors will show in the developer console

via Project Wizard

  1. Create a Jupyter Notebook via the Project Wizard with default selections
  2. An empty notebook file will open, but subsequent project initialization tasks will not run and console startup hangs indefinitely
  3. Reloading the window restores the IDE to a usable state.

What did you expect to happen?

The behaviour should match the default notebooks (when positron.notebooks.usePositronNotebooks is disabled). There should not be a series of errors in the developer console. Via the Project Wizard, a new project should be created successfully and the selected interpreter should be selected. See #2820.

Were there any error messages in the output or Developer Tools console?

Console errors

Several ERR Illegal state: Expected notebook editor: Error: Illegal state: Expected notebook editor errors logged -- I am only including the first one in the details below.

Details ``` contextKeyService.ts:446 Element already has context attribute: positron-notebook-container ... ERR Illegal state: Expected notebook editor: Error: Illegal state: Expected notebook editor at illegalState (vscode-file://vscode-app/Users/sashimi/positron/out/vs/base/common/errors.js:149:20) at Object.getComparisonKey (vscode-file://vscode-app/Users/sashimi/positron/out/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js:51:53) at InlineChatSessionServiceImpl._key (vscode-file://vscode-app/Users/sashimi/positron/out/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js:566:24) at InlineChatSessionServiceImpl.getSession (vscode-file://vscode-app/Users/sashimi/positron/out/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js:560:30) at EmptyCellEditorHintContribution._shouldRenderHint (vscode-file://vscode-app/Users/sashimi/positron/out/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js:92:47) at EmptyCellEditorHintContribution._shouldRenderHint (vscode-file://vscode-app/Users/sashimi/positron/out/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js:33:44) at EmptyCellEditorHintContribution.update (vscode-file://vscode-app/Users/sashimi/positron/out/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js:110:43) at UniqueContainer.value (vscode-file://vscode-app/Users/sashimi/positron/out/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js:50:73) at Emitter._deliver (vscode-file://vscode-app/Users/sashimi/positron/out/vs/base/common/event.js:889:26) at Emitter._deliverQueue (vscode-file://vscode-app/Users/sashimi/positron/out/vs/base/common/event.js:900:22) at Emitter.fire (vscode-file://vscode-app/Users/sashimi/positron/out/vs/base/common/event.js:923:22) at CodeEditorWidget.setModel (vscode-file://vscode-app/Users/sashimi/positron/out/vs/editor/browser/widget/codeEditor/codeEditorWidget.js:303:36) at vscode-file://vscode-app/Users/sashimi/positron/out/vs/workbench/contrib/positronNotebook/browser/notebookCells/CellEditorMonacoWidget.js:81:24 ... ERR Notebook Editor creation failure for document {"$mid":1,"fsPath":"Untitled-1.ipynb","external":"untitled:Untitled-1.ipynb?jupyter-notebook","path":"Untitled-1.ipynb","scheme":"untitled","query":"jupyter-notebook"}: Error: Notebook Editor creation failure for document {"$mid":1,"fsPath":"Untitled-1.ipynb","external":"untitled:Untitled-1.ipynb?jupyter-notebook","path":"Untitled-1.ipynb","scheme":"untitled","query":"jupyter-notebook"} at ExtHostCommands._executeContributedCommand (/Users/sashimi/positron/out/vs/workbench/api/common/extHostCommands.js:211:23) ... ```

Positron Notebook Controllers Output

[debug] Failed to get preferred runtime for language: python No language runtimes registered for language ID 'python'.
nstrayer commented 1 month ago

This happens even without using the project wizard. It's due to some reused notebook code expecting the vscode notebook editor class to be the one responsible for the document.

sharon-wang commented 1 month ago

Thanks for the additional context! I've updated the issue title and description 👍