question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Very bad experience with default F# formatting in notebooks

See original GitHub issue

Describe the bug

I’m opening this issue as a bug report as I’m quite confused about what was discussed and concluded in the previous related issue #642 and I haven’t seen any changes in behavior in the latest dotnet interactive versions.

The problem is that the default formatter for F# values in notebooks does a really bad job, in turn making the user experience quite bad, and in my view unusable, by default. This is especially the case for a newcomer with lots of experience in Python and Juypter, trying out dotnet interactive.

We just need to have a simple plaintext printer by default, which mirrors the conventional Jupyter notebook experience with Python. This can be achieved by these two lines @dsyme kindly provided before:

Formatter.SetPreferredMimeTypeFor(typeof<obj>, "text/plain")
Formatter.Register(fun (x:obj) (writer: TextWriter) -> fprintfn writer "%120A" x )

Can you please make this the default in dotnet interactive for F#?

This is the single biggest problem with the user experience currently.

Screenshots of the default behavior and the updated behavior are attached below.

Please complete the following:

Which version of .NET Interactive are you using? 1.0.211906+4b8eb267854eb055ef2f7b16561ebbcd6cc69b2e

  • OS
    • Windows 10
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • Chrome
    • Edge
    • Firefox
    • Safari
  • Frontend
    • Jupyter Notebook
    • Jupyter Lab
    • nteract
    • Visual Studio Code
    • Visual Studio Code Insiders
    • Other (please specify)

Screenshots

Screenshot with bad user experience (the current default) image

Screenshot with acceptable user experience (after manually having to change the default F# formatter) image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jonsequiturcommented, Apr 23, 2021

My intent was to say that we can change the F# defaults and also we would like input on the HTML formatters, which will be the default for C#, and will remain an option for F# users.

To make this clearer, I’ve opened a specific issue for changing the F# defaults: #1297.

0reactions
gbaydincommented, Apr 25, 2021

Thank you so much @jonsequitur for your response and patience. I’ve been really grumpy about this as it has affected my work for a long time and I believe it also affects the newcomer experience (primarily Python users trying F#/C#/dotnet in their browsers).

Read more comments on GitHub >

github_iconTop Results From Across the Web

F# values display badly in default formatting, esp plaintext
Therer are lots of cases where default formatting for F# values is way off. I'll document a few here and try and make...
Read more >
f-string not working in Jupyter not working
@BrianPrice - I'm running it in a Jupyter notebook with no problem. Try drastically simplifying your code by deleting from your function ...
Read more >
Notebooks suck: change my mind : r/Python
So I guess at least I've had a horrible experience with notebooks ... Formatting should be required for anything outside your personal ......
Read more >
Function Calling very unreliable - Prompting
I was thinking about adding example function calls to the system prompt. How would I format the example function calls ? From previous ......
Read more >
Comprehensive guide to formatting pandas DataFrames
Glorious pandas DataFrame visuals by formatting dates, using thousand separators, currency formats, percentage formats, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found