From af4177e61f13720d4ebb754c13f4dae8c9f48bcd Mon Sep 17 00:00:00 2001 From: AdRiley Date: Fri, 31 May 2024 18:02:02 +0300 Subject: [PATCH] Make table default visualisation (#10128) Makes table the default vis type. Before: ![image](https://github.com/enso-org/enso/assets/1720119/8a5d113a-ac06-4dd8-afdb-151cdbc149ab) After: ![image](https://github.com/enso-org/enso/assets/1720119/d7c33cf7-355d-4517-8967-1963ff506f97) Closes #10093 --- .../Standard/Visualization/0.0.0-dev/src/Helpers.enso | 8 ++++++-- .../test/instrument/RuntimeVisualizationsTest.scala | 2 +- test/Visualization_Tests/src/Id_Spec.enso | 11 +++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/distribution/lib/Standard/Visualization/0.0.0-dev/src/Helpers.enso b/distribution/lib/Standard/Visualization/0.0.0-dev/src/Helpers.enso index 9bb4d642917..06c1dda9509 100644 --- a/distribution/lib/Standard/Visualization/0.0.0-dev/src/Helpers.enso +++ b/distribution/lib/Standard/Visualization/0.0.0-dev/src/Helpers.enso @@ -10,9 +10,13 @@ import project.Table as Table_Visualization from project.Text import get_lazy_visualization_text_window ## PRIVATE - Specifies that the builtin JSON visualization should be used for any type, + Specifies that the builtin Table visualization should be used for any type, unless specified otherwise. -Any.default_visualization self = Id.json +Any.default_visualization self = Id.table + +## PRIVATE + Specifies that the builtin JSON visualization should be used for any JS_Objects +JS_Object.default_visualization self = Id.json ## PRIVATE Returns a Text used to display this value in the IDE. diff --git a/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala index 0ba65818335..747d2cd14b1 100644 --- a/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala @@ -2027,7 +2027,7 @@ class RuntimeVisualizationsTest extends AnyFlatSpec with Matchers { data } - new String(data) shouldEqual "(Builtin 'JSON')" + new String(data) shouldEqual "(Builtin 'Table')" val loadedLibraries = attachVisualizationResponses .collect { diff --git a/test/Visualization_Tests/src/Id_Spec.enso b/test/Visualization_Tests/src/Id_Spec.enso index 697f2497c8c..42a70f6415b 100644 --- a/test/Visualization_Tests/src/Id_Spec.enso +++ b/test/Visualization_Tests/src/Id_Spec.enso @@ -32,10 +32,13 @@ add_specs suite_builder = suite_builder.group "Serializable Visualization Identi v_1.to_json.should_equal (expected "enso_dev.Visualization_Tests" "My Vis") v_2.to_json.should_equal (expected "Standard.Base" "Other Vis") - group_builder.specify "specifies default JSON visualization for any type" <| - My_Type.Value 30 . default_visualization . should_equal Visualization.Id.json - "foobar".default_visualization.should_equal Visualization.Id.json - True.default_visualization.should_equal Visualization.Id.json + group_builder.specify "specifies default Table visualization for any type" <| + My_Type.Value 30 . default_visualization . should_equal Visualization.Id.table + "foobar".default_visualization.should_equal Visualization.Id.table + True.default_visualization.should_equal Visualization.Id.table + + group_builder.specify "specifies default json visualization JS_Object type" <| + (Json.parse '{"name":"John","age":25,"email":"john@example.com"}') . default_visualization . should_equal Visualization.Id.json group_builder.specify "specifies default Table visualization for Vector and Array type" <| [1,2,3].default_visualization.should_equal Visualization.Id.table