Polyglot VSCode thinks F# notebooks generated by FSharp.Formatting are C# notebooks
See original GitHub issueDescribe the bug
- This is probably the same issue as #2289, and it breaks all documentation notebooks previously created by F# Formatting.
- For new F# notebooks, I can do a PR to update the F# Formatting library to generate F# notebooks with the metadata that the Polyglot notebooks extension wants. What metadata should we add?
Details follow:
The F# Formatting Library generates .NET interactive notebooks. The VSCode extension previously recognized the code cells as F#, but now the polyglot extension converts them to C#. As far as I can tell it’s necessary to manually go through every cell and change it to F# (not practical). This breaks all documentation notebooks previously created by F# Formatting.
For example, the extension now thinks the F# code in this notebook from the F# Data Library is C# code:
Regarding metadata … A simple notebook generated by the F# formatting tool looks like this below in json and is what used to work with the old VSCode extension.
{
"cells": [
{
"cell_type": "code",
"metadata": {},
"execution_count": 1, "outputs": [],
"source": ["let x = 100\n"]
}
,
{
"cell_type": "code",
"metadata": {},
"execution_count": 2, "outputs": [],
"source": ["let y = 100\n"]
}],
"metadata": {
"kernelspec": {"display_name": ".NET (F#)", "language": "F#", "name": ".net-fsharp"},
"langauge_info": {
"file_extension": ".fs",
"mimetype": "text/x-fsharp",
"name": "C#",
"pygments_lexer": "fsharp",
"version": "4.5"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
From experimentation, it looks like if we change "metadata": {}
in code cells to what I have here then the cells are recognized as being F# code. Is this correct, is there anything else that you suggest?
"metadata": {
"dotnet_interactive": {
"language": "fsharp"
},
"polyglot_notebook": {
"kernelName": "fsharp"
}
}
Please complete the following:
Which version of .NET Interactive are you using? (In a notebook, run the #!about
magic command. ):
.NET Interactive Version: 1.0.360602+9bf026dabac44a6256a65168fa93dcb7e2edcca4 Library version: 1.0.0-beta.22606.2+9bf026dabac44a6256a65168fa93dcb7e2edcca4 Build date: 2023-01-31T11:33:36.0115292Z
Screenshots
If applicable, add screenshots to help explain your problem.
Issue Analytics
- State:
- Created 8 months ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
@nhirschey we published a new extension to our insiders channel, can you give it a shot to see if it fixes this issue? You’ll need to install VS Code - Insiders and then install the extension like normal, it should automatically pick up the correct version, which should be 1.0.4108061.
@brettfo yes I checked docs from a few repos and it’s fixed in the insiders version of VS Code. Thank you!