dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.8k stars 374 forks source link

code block formatting issue in github after the update #3447

Open SANDEEPKANDATALA opened 4 months ago

SANDEEPKANDATALA commented 4 months ago

Previously it used to render properly image

now the code block format have issue after upgrading to latest version image

It works great in VSCode but in github, there is formatting issue

jonsequitur commented 4 months ago

Are you referring to the code coloring?

There's a known issue (#2683) with code coloring when using a dev container, including in Codespaces.

mika76 commented 3 months ago

My code coloring does has not worked for a way longer time than just that update. I do not use dev containers. When I open my .dib file I have lots of C# code blocks but in the bottom right of each cell it says "Code" when I first open the file and there is no syntaxtcoloring.

Screenshot 2024-03-13 at 07 58 13

If I manually go and click "Code" and select "Auto Detect" it then changes to "C#" and the syntax coloring appears.

Screenshot 2024-03-13 at 07 58 41

But I have to do this manually - and if I save the file, close and reopen it it is back to "Code" and no syntax coloring.

So I assume it's the auto detect functionality which does not work.

PS: I'm on a mac, vscode version: 1.87.2 (Universal), OS: Darwin x64 23.2.0

PPS: This is all mentioned on #2683

jonsequitur commented 3 months ago

Can you provide any logs from the Output > Polyglot Notebooks : diagnostic view here?

image

mika76 commented 3 months ago

Sure can

I created a new notebook, wrote Console.WriteLine("hi") and run it - there was no syntax highlight.

Polyglot notebook diagnostics

Starting kernel for 'untitled:Untitled-1.dib?polyglot-notebook' using: dotnet tool run dotnet-interactive -- [vscode] stdio --working-dir /Users/mm/Downloads
Kernel for 'untitled:Untitled-1.dib?polyglot-notebook' started (7650).

Then I selected the "Code" part in the bottom right on the cell, selected Auto Detect. The label changed to C# and the C# output windows popped up with the following. Syntax working.

C# Output

Installing Razor Telemetry Version = 7.0.0-preview.24165.1...
Platform: darwin, x86_64

Downloading package 'Razor Language Server Telemetry (macOS / x64)' (9340 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'Razor Language Server Telemetry (macOS / x64)'

Finished

Using dotnet configured on PATH
Dotnet path: /usr/local/share/dotnet/dotnet
Activating C# + C# Dev Kit + C# IntelliCode...
waiting for named pipe information from server...
[stdout] {"pipeName":"/var/folders/d8/rfmf5v3j70s4jxtpw70c59k40000gn/T/78b9387d.sock"}
received named pipe information from server
attempting to connect client to server...
client has connected to server
[Info  - 15:59:48] [Program] Language server initialized
[Error - 15:59:48] Request textDocument/codeAction failed.
  Message: Unsupported extension '.dib?polyglot-notebook#W0sdW50aXRsZWQ=' and LSP language id ''
  Code: -32000 
[object Object]
[Error - 15:59:48] Request textDocument/inlayHint failed.
  Message: Unsupported extension '.dib?polyglot-notebook#W0sdW50aXRsZWQ=' and LSP language id ''
  Code: -32000 
[object Object]

I assume the lines from [Info -15:59:48]... are the new ones...

jonsequitur commented 3 months ago

Auto-detect prevents the cell from being runnable because it typically chooses a language that's not supported. That issue is unrelated to the syntax highlighting bug.

I'm more interested in whether there are additional outputs in Output > Polyglot Notebooks : diagnostic and Output > Polyglot Notebooks : logger if you wait and don't use auto-detect.

mika76 commented 3 months ago

Ok I created a new notebook, wrote the Console.WriteLine statement and just waited. Nothing new in the diagnostic output.

Extension started for VS Code Stable.
Started process 10141: dotnet tool run dotnet-interactive -- notebook-parser
Starting kernel for 'untitled:Untitled-1.dib?polyglot-notebook' using: dotnet tool run dotnet-interactive -- [vscode] stdio --working-dir /Users/mladenmihajlovic/Downloads
Kernel for 'untitled:Untitled-1.dib?polyglot-notebook' started (10148).

In the logger output I have this but I think it appears as soon as I create a new notebook.

[Error] extension host: Error parsing language configuration for language axaml
[Error] extension host: Error parsing language configuration for language gitignore
[Error] extension host: Error parsing language configuration for language vbs
[Error] extension host: Error parsing language configuration for language log
[Error] extension host: Error parsing language configuration for language svg
[Error] extension host: Error parsing language configuration for language sln
[Error] extension host: Error parsing language configuration for language pico-8
[Error] extension host: Error parsing language configuration for language pico-8-lua
[Error] extension host: Error parsing language configuration for language vue
[Error] extension host: Error parsing language configuration for language markdown
[Error] extension host: Error parsing language configuration for language html
[Error] extension host: Error parsing language configuration for language jade
[Error] extension host: Error parsing language configuration for language plaintext
[Error] extension host: Error parsing language configuration for language scriban
[Error] extension host: Error parsing language configuration for language scriban-txt
[Error] extension host: Error parsing language configuration for language scriban-csharp
[Error] extension host: Error parsing language configuration for language scriban-html