Re: [elixir-core:11370] Format inspect output as valid elixir

2023-05-09 Thread Adam Kirk
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 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  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_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.


Re: [elixir-core:11368] Format inspect output as valid elixir

2023-05-09 Thread Adam Kirk
Yeah, I was afraid it might be a poor cost/benefit ratio. I guess I posted 
here in case a lot of other people felt this pain as well.

On Tuesday, May 9, 2023 at 10:03:36 AM UTC-6 José Valim wrote:

> Yeah, I see. One solution would be to introduce /* ... */ style comments 
> (not exactly with this syntax) but it sounds like a large change for small 
> benefits. Can anyone think of other approaches?
>
> On Tue, May 9, 2023 at 5:57 PM Adam Kirk  wrote:
>
>> Ok, I guess I just wish it was `mix format` friendly because then its 
>> much much easier to remove it
>>
>> On Tuesday, May 9, 2023 at 9:51:54 AM UTC-6 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  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_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-co...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elixir-lang-core/f71d0cca-a625-4885-b09f-c5c679cd37e1n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elixir-lang-core/f71d0cca-a625-4885-b09f-c5c679cd37e1n%40googlegroups.com?utm_medium=email_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/90bac4b8-affc-4387-920b-00d5f975b282n%40googlegroups.com.


Re: [elixir-core:11366] Format inspect output as valid elixir

2023-05-09 Thread Adam Kirk
Ok, I guess I just wish it was `mix format` friendly because then its much 
much easier to remove it

On Tuesday, May 9, 2023 at 9:51:54 AM UTC-6 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  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_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/f71d0cca-a625-4885-b09f-c5c679cd37e1n%40googlegroups.com.


[elixir-core:11364] Format inspect output as valid elixir

2023-05-09 Thread Adam Kirk
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-core+unsubscr...@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.


[elixir-core:7945] Re: [Proposal] debugger statement

2018-03-27 Thread Adam Kirk
It does not allow stepping. If you're not sure what code path a test 
scenario is triggering, pry won't help you, you have to litter inspect 
statements everywhere

On Tuesday, March 27, 2018 at 2:47:26 PM UTC-6, OvermindDL1 wrote:
>
> Doesn't `IEX.pry` work well for that?  You can even gate it behind a 
> configuration variable or so too.
>
> On Saturday, March 24, 2018 at 6:29:54 AM UTC-6, Adam Kirk wrote:
>>
>> Ok so this is just an idea and it might be ignorant: 
>>
>> What is `iex` had a `—debug` option that could be: 
>>
>> 1) called with no value and by default elixir would find all `debugger` 
>> statements in your code, strip them out and set breakpoints on them. Maybe 
>> `debugger(3)` would skip 3 times 
>>
>> 2) allow `—debug=file.ex:45` to set a breakpoint 
>>
>> 3) maybe also a `—gui` option too? 
>>
>> The reason is, I write tests to debug things. I write a test that 
>> reproduces a problem and then I get the test to pass. Then it’ll never 
>> regress. But I’m stuck with IO.inspect and IEx.pry because Its not obvious 
>> how to use the step debugger when starting with `iex -S mix test` 
>>
>> Iex.pry is fine for stopping and looking around and trying things in 
>> context, so we’re half way there, but being able to just as easily step 
>> through code so i dont have to litter io.inspect everywhere would be so 
>> awesome. 
>>
>> One of the main reasons I’d love this is that while it requires me to 
>> edit my source, putting debugger where i want to stop is so much 
>> easier than the setup work currently required (type file and line number or 
>> entire module and function name) 
>>
>> A debugger statement is so super easy to remember and use and people are 
>> familiar with it from ruby and javascript. It is the number one thing by 
>> far I miss from Ruby.
>
>

-- 
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/548790dc-e3ac-4dbc-958f-30a2f1991d84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elixir-core:7943] [Proposal] debugger statement

2018-03-24 Thread Adam Kirk
Ok so this is just an idea and it might be ignorant:

What is `iex` had a `—debug` option that could be:

1) called with no value and by default elixir would find all `debugger` 
statements in your code, strip them out and set breakpoints on them. Maybe 
`debugger(3)` would skip 3 times

2) allow `—debug=file.ex:45` to set a breakpoint

3) maybe also a `—gui` option too?

The reason is, I write tests to debug things. I write a test that reproduces a 
problem and then I get the test to pass. Then it’ll never regress. But I’m 
stuck with IO.inspect and IEx.pry because Its not obvious how to use the step 
debugger when starting with `iex -S mix test`

Iex.pry is fine for stopping and looking around and trying things in context, 
so we’re half way there, but being able to just as easily step through code so 
i dont have to litter io.inspect everywhere would be so awesome.

One of the main reasons I’d love this is that while it requires me to edit my 
source, putting debugger where i want to stop is so much easier than 
the setup work currently required (type file and line number or entire module 
and function name) 

A debugger statement is so super easy to remember and use and people are 
familiar with it from ruby and javascript. It is the number one thing by far I 
miss from Ruby.

-- 
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/0712cacc-6552-42f7-900f-4e3550ab0d76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.