elm-community / SublimeElmLanguageSupport

Elm language syntax highlighting and tool integration for ST2/3.
https://packagecontrol.io/packages/Elm%20Language%20Support
MIT License
33 stars 12 forks source link

Added debug snippet #19

Closed Bernardoow closed 6 years ago

Bernardoow commented 7 years ago

I added a new snippet for debug.

Bernardoow commented 7 years ago

Hi @sentience, can see this pr?

sentience commented 7 years ago

Hi @Bernardoow! Thanks for the PRs! ❤️ I will review them and give you some feedback this weekend.

Bernardoow commented 7 years ago

@sentience OK !

I sent email to you in your address thatguy@kevinyank.com. Can you check this too? ;D

stoivo commented 7 years ago

I believe the full snippet should me

<snippet>
    <content><![CDATA[
|> Debug.log "${1:$TM_LINE_NUMBER}"
]]></content>
    <description>Debug line based.</description>
    <tabTrigger>debug</tabTrigger>
    <scope>source.elm</scope>
</snippet>

I think the work flow would be somethink like this. asd

Most I create my code, test it, then see that doesn't work. Then I would like to add the debug statement?

How are your workflow?

Bernardoow commented 7 years ago

Usually I Put debug for see some party of code without change flux, because this I create debug with line numbers for I can create many I need.

stoivo commented 7 years ago

Ok, do you create new variables when you are debugging or inserting the debugger in the existing variables?

Bernardoow commented 7 years ago

@stoivo Your suggestion for debug snippets is better. Much Better!!!

sentience commented 7 years ago

Speaking for myself, my workflow is usually to wrap the existing expression in a Debug.log call:

Before:

fn a b =
    let
        c =
            a + b
    in
        c ** 2

After:

fn a b =
    let
        c =
            Debug.log "debug" (a + b)
    in
        c ** 2

Elm gives you a lot of flexibility in how you compose functions and expressions…

Debug.log "debug" expression
expression |> Debug.log "debug"
Debug.log "debug" <| expression

…so it's hard to imagine a single “most common” way that Debug.log might be applied via a snippet. I wonder if it might be better just to make the snippet this:

Debug.log "${1:debug}" 

…and you can decide how to use it in each circumstance.

Bernardoow commented 7 years ago

@sentience Done.

stoivo commented 7 years ago

I think we should make the content

Debug.log "${1:$TM_LINE_NUMBER}"
or 
Debug.log "${1:debug $TM_LINE_NUMBER:}"

When you may not need to add addition comment.

Bernardoow commented 7 years ago

Ok. In few hours I will update. I'm traveling now.

Bernardoow commented 7 years ago

Done.

stoivo commented 7 years ago

This looks good, I think we can squash and merge.