Skip to content

Commit

Permalink
- Better File_Format widget.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdunkerley committed May 2, 2023
1 parent ffba738 commit 8facc20
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ format_widget =
all_types = [Auto_Detect] + format_types
make_ctor type_obj =
type_name = Meta.get_qualified_type_name type_obj

## Temporary work around to work out if need to add the constructor name
is_singleton_type = type_obj==JSON_Format || (type_name.ends_with "_Format" . not)
if is_singleton_type then type_name else
simple_name = Meta.get_simple_type_name type_obj
"(" + type_name + "." + (simple_name.replace "_Format" "") + ")"
ctors = Meta.meta type_obj . constructors
if ctors.length == 0 then type_name else
"(" + type_name + "." + ctors.first.name + ")"
make_name type_obj = type_obj.to_text.replace "_Format" "" . replace "_" " "
Single_Choice display=Display.Always values=(all_types.map n->(Option (make_name n) (make_ctor n)))

Expand Down

0 comments on commit 8facc20

Please sign in to comment.