Thats smart. I think I'll try making an alfred workflow to transform it in my clipboard
On Tuesday, May 9, 2023 at 10:06:46 AM UTC-6 william.l...@cargosense.com wrote: > I encounter this often. Here's a small workaround I use. > > I copy/paste the struct into a new VSCode tab and do the following > find/replace > > Search: `.+#.+\n` > Replace: `` (aka nothing) > > Then you can format. E.g. this turns: > > ``` > %User{ > __meta__: #Ecto.Schema.Metadata<:loaded, "users">, > id: 123, > primary_contact_id: 456, > primary_contact: #Ecto.Association.NotLoaded<association :primary_contact > is not loaded>, > name: "Name", > created_at: ~U[2023-03-27 20:27:27.756360Z] > } > ``` > > into > > ``` > %User{ > id: 123, > primary_contact_id: 456, > name: "Name", > created_at: ~U[2023-03-27 20:27:27.756360Z] > } > ``` > > This doesn't really address your concern, but I do it so frequently that I > figured I'd share. > > On Tuesday, May 9, 2023 at 11:51:54 AM UTC-4 José Valim wrote: > >> There is a "structs: false" option but I am not sure if that is supported >> when diffing. >> >> But also keep in mind there are structures that represent memory data >> (such as PIDs and REFs) and those can never really be copy and pasted. And >> sometimes, like above, it shows in a special style because it is private >> and you are not supposed to assert on it (i.e. you should remove it). >> >> On Tue, May 9, 2023 at 5:42 PM Adam Kirk <atom...@gmail.com> wrote: >> >>> I do this ALL the time, but heres a specific example: When I write a >>> test, I do something like >>> >>> assert [] = Repo.all(Thing) >>> >>> it fails, I copy what the match shows into my test and modify it to what >>> I need. >>> >>> except that it outputs stuff like: >>> >>> ``` >>> __meta__: #Ecto.Schema.Metadata<:loaded, "thing"> >>> ``` >>> which isn't valid elixir, so I can't run mix format to make it nice >>> before I modify it. >>> >>> This applies to a ton of workflows I have. I'm curious why it can't be >>> output as valid elixir instead of this special formatting with special >>> characters like `#` etc >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to elixir-lang-co...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-core/3648f1d0-73a0-47a5-ac83-6bec7c933290n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/elixir-lang-core/3648f1d0-73a0-47a5-ac83-6bec7c933290n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/a2813741-6a43-4b7c-92c6-0f2770f9b0a1n%40googlegroups.com.