-
Notifications
You must be signed in to change notification settings - Fork 352
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
Worksheet doesn't show correct Array Output #6499
Comments
Thanks for reporting! This one looks like another issue with mdoc. |
I assume it is using the toString method, which yields exactly that result in the REPL. |
Ach, actually it's a special mechanism, which usually looks a bit better than normal toString, but we seem to have a bug here. |
Ach, actually I think for Scala 3 we use the normal to String and that's the actual toString method. Better to use List in worksheets. Take a look at https://scastie.scala-lang.org/msia7oRwQdav11jDrGGVag |
Makes sense, seems like List is preferred over Array in most cases. In the book I use (scala for the impatient) arrays are introduced first and lists mentioned much later, I wonder why. Nevertheless, it would probably be still good to fix this case, right? There are probably other cases, where the logic currently fails if it relies on the toString method (Possibly everywhere, where we deal with more classic Java types?). |
I think from the usability standpoint yes, but correctness wise it might not be a perfect solution. If one expects things on the right to be just a The other solution is to use pprint library as for Scala 2, but I was faced with opposition to it as it is more principled for some people to always just use toString. So, overall I am not sure what is best here :/ |
Describe the bug
Creating an array in a worksheet, outputs (part) of the object reference instead of the values:

As you can see with ArrayBuffer the output is as expected, while with fixed arrays object references are shown instead of values. And only a single, the rest is cutt off (hovering doesn't reveal more either).
I'm rather new to scala, but I don't think this is expected. It is certainly not what the REPL does.
Expected behavior
No response
Operating system
Linux
Editor/Extension
VS Code
Version of Metals
v1.3.1
Extra context or search terms
No response
The text was updated successfully, but these errors were encountered: