-
Notifications
You must be signed in to change notification settings - Fork 391
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
New code cells in F# default notebook are missing metadata, are treated as C# #3544
Comments
Seeing same issue with PowerShell cells.
I downgraded to a few versions back to 1.0.4403* and saw similar results, though in the current version the save file retains the notebook level metadata, in those older versions even that would go away. |
Since this keeps bugging me, a few more observations: Observation 1
Observation 2
Observation 3
I could keep going with all kinds of weird results, some reproducible, some not (at one time, I had a markdown cell with csharp language in the metadata). It seems every variation of sequence when a notebook is saved, when and where a new cell is added, when the cell is executed, ... results in a different outcome. Though none of the outcomes so far result in the expected behavior, that a new code cell is created as a fsharp cell. This makes it an inconsistent and frustrating user experience. I'm now on the following version of .NET Interactive: Still Windows 11, Edge and VSCode. |
Thanks, that is the workaround I currently use. I hope we agree that this should not be the normal workflow for a user. |
@brettfo It seems you did the change with #2712 where a new notebook is initialized with the default language setting. Do you have pointers on how to get started with changing the behavior when new code cells are being added to a notebook? I've been looking at the code in vscode-common for a while, commands.ts in particular. But nothing obvious has been jumping out at me so far. |
Note that this affects only @DonJayamanne, does this ring any bells? It seems related to the removal of support for the |
@jonsequitur You Sir just made my day! Thanks for this much more practical workaround. Combined with the "Save notebook as..." command I can use .dib as editing format and .ipynb as publishing format. |
@jonsequitur @colombod |
It seems that the edit sent to the cell and notebook metadata is not persisted. I wonder if this is also part of the issue that opening a notebook marks it as modified |
If you step into this 👍
you see we calculate the metadata but after the edit is not persisted. |
Please can you share where this edit is made, thanks a lot |
@DonJayamanne this is the "race" we reported a while back. We need to deep test and isolate where the issue is, so far everything points to internal implementations in the vs side, but still need to isolate this. |
Describe the bug
I mainly write notebooks for F# and PowerShell, with the occasional C# cell in the mix. The default notebook language setting is set to fsharp.
The last few times I worked with the notebooks, I noticed that new code cells show in the top bottom corner my default language setting "fsharp - F# Script Code". However, if valid F# code is entered in the cell, it gets a lot of red squiggles (screenshot 1). When executing the cell, there are a lot of CS errors, indicating that the code is treated as C# (screenshot 2).
When I open the notebook in a text editor, I see that the metadata node of the cell is empty. Other working cells have metadata indicating F# in there (screenshot 3). See also a gist of the file in that state: https://gist.github.com/FH-Inway/34984cfacc39b27e206873048a16fb3e?short_path=51a4666
When I explicitely set the code cell via the language selector in the bottom right corner to F#, all is well again.
When I close a notebook with such an "invalid" cell, it is opened again right away, showing unsaved changes. The cell can now be executed successfully and after saving the file, the cell shows F# metadata.
Please complete the following:
Which version of .NET Interactive are you using? (In a notebook, run the
#!about
magic command. ):Version: 1.0.522904+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074
Library version: 1.0.0-beta.24229.4+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074
Build date: 2024-05-05T09:37:02.5479468Z
Screenshots
Related issues
#3263 Polyglot Notebook: [DevExE2E][Regression] The kernelName and language show as csharp in the created Untitled-1.ipynb contents.
#3480 Default language not applied after open an python ipynb file
#2794 New cells use notebook default language instead of previous cell language
The text was updated successfully, but these errors were encountered: