1. 15 Jul, 2019 4 commits
    • Hardy Jones's avatar
      Document the factors behind formatting · 10c3e410
      Hardy Jones authored
      This is the first pass at writing down these rules.
      We should probably sit on this for a while and think them over.
      There's a good chance some rules were missed.
      There's also a good chance some of these rules aren't that important.
      10c3e410
    • Hardy Jones's avatar
      Merge branch '136-multiline-if-statements-have-incorrect-indentation' into 'master' · 74c43dc6
      Hardy Jones authored
      Resolve "Multiline if statements have incorrect indentation"
      
      Closes #136
      
      See merge request joneshf/purty!125
      74c43dc6
    • Hardy Jones's avatar
      Fix indentation of conditionals · 336f17ab
      Hardy Jones authored
      We were formatting conditionals less than ideally.
      We would format conditionals where they weren't always indented properly.
      For example, we would format conditionals like:
      ```PureScript
      foo = do
        x <- if true then
          pure 1
        else
          pure 2
        pure x
      ```
      
      While that will technically parse,
      and it has the semantics it's supposed to,
      It's not readily apparent that it should do either of those things.
      
      Instead of expecting people to understand the parser (and what it expects),
      we change the formatting to be:
      ```PureScript
      foo = do
        x <-
          if true then
            pure 1
          else
            pure 2
        pure x
      ```
      
      This formatting is a bit easier to understand.
      The conditional is indented as it normally is in other places.
      336f17ab
    • Hardy Jones's avatar
      Add a failing test for conditional layout · 45edc4ad
      Hardy Jones authored
      We're formatting conditionals in a non-ideal way.
      When there's a conditional after a syntactic boundary (`do`, arrows, etc.),
      we aren't indenting the whole conditional correctly.
      
      We add a test to show how we want to format conditionals.
      45edc4ad
  2. 06 Jul, 2019 4 commits
  3. 05 Jul, 2019 3 commits
    • Hardy Jones's avatar
      Fix formatting of characters · 5844d727
      Hardy Jones authored
      There was a bug in the `0.13.0` version of `purescript`.
      Control characters were not being parsed correctly.
      To get around that bug, we decided to use the underlying `Text`
      instead of relying on the parser's source value.
      
      Unfortunately, that meant that we created a new bug.
      Because the underlying `Text` value was converted to the escape code,
      Certain characters (like unicode) were formatted as escape codes
      rather than the original characters that they were.
      
      Worse still, it surfaced an additional bug in the `0.13.0` version
      of `purescript`: other escape code characters were not escaped properly.
      
      The long and short was that there wasn't an easy way to fix the issue.
      We decided to stave off until a new version was released.
      Now that we have `0.13.2` (the next version available),
      we can fix the original issue once and for all.
      5844d727
    • Hardy Jones's avatar
      Add a failing test for character handling · fc91ac5e
      Hardy Jones authored
      There was a bug in the `0.13.0` version of `purescript`.
      Control characters were not being parsed correctly.
      
      We want to fix the bug, so we add a test to validate that it's broken.
      fc91ac5e
    • Hardy Jones's avatar
      Update `purescript` to `0.13.2` · cdad4784
      Hardy Jones authored
      `0.13.2` is currently the latest version.
      This version should have a fix for a bug (improper handling of chars)
      that's been plaguing us for a while.
      
      The impetus for this change is to get that bugfix.
      We'll try switching our code over to take advantage of it.
      cdad4784
  4. 03 Jul, 2019 3 commits
  5. 02 Jul, 2019 4 commits
  6. 28 Jun, 2019 4 commits
    • Hardy Jones's avatar
      Merge branch '128-space-in-inline-type-annotation-is-removed' into 'master' · 3d6b0fb6
      Hardy Jones authored
      Resolve "Space in inline type annotation is removed"
      
      Closes #128
      
      See merge request joneshf/purty!118
      3d6b0fb6
    • Hardy Jones's avatar
      Add a test for kinded types · 810034d8
      Hardy Jones authored
      In a similar way to the typed binders and typed expressions,
      we add a test for kinded types.
      
      Looks like we're formatting these correctly as well.
      Maybe there's a pattern we could figure out?
      810034d8
    • Hardy Jones's avatar
      Fix formatting of typed binders · f9901ced
      Hardy Jones authored
      We weren't putting a space on the colons.
      
      This makes me wonder how many other things aren't being formatted well.
      It also makes me wonder if we can generate examples to look at,
      and then test against.
      How would we know that a generated example makes sense?
      Seems like an interesting area to explore.
      f9901ced
    • Hardy Jones's avatar
      Add a failing test for typed binders · 9f198e91
      Hardy Jones authored
      Looks like we weren't formatting out typed binders appropriately.
      We are not putting a space between the binder and the colons.
      
      Interestingly, we seem to be formatting typed expressions correctly.
      It sees like we could slice the code in a way that these two things
      were formatted the same way.
      Reason being, they're semantically very similar.
      The fact that they're different types isn't worth much at the user-level.
      9f198e91
  7. 25 Jun, 2019 2 commits
  8. 24 Jun, 2019 9 commits
    • Hardy Jones's avatar
      Merge branch '125-indent-multiline-parenthesized-expressions-properly' into 'master' · 6e848d22
      Hardy Jones authored
      Resolve "Indent multiline parenthesized expressions properly"
      
      Closes #125
      
      See merge request joneshf/purty!116
      6e848d22
    • Hardy Jones's avatar
      Handle parenthesized constructs uniformly · bf8a09ac
      Hardy Jones authored
      To address parenthesized constructs getting out of sync with each other,
      we extract a function that has that behavior.
      This should keep things more uniform
      and mitigate the amount of shotgun surgery we have to perform.
      
      Things aren't typed to the point that changes to any parenthesized
      constructs would be caught statically,
      but hopefully this is a good enough compromise.
      bf8a09ac
    • Hardy Jones's avatar
      Add missed changes for constraints · f838003c
      Hardy Jones authored
      Had a slip while making the previous commit.
      We forgot to commit this part.
      The message is the same as the previous commit.
      
      It does sort of highlight that we're doing shotgun surgery here.
      It's a code smell for a reason.
      We should consider handling parenthesized constructs uniformly,
      so this sort of mistake is mitigated.
      f838003c
    • Hardy Jones's avatar
      Indent parenthesized constructs more consistently · d92028cb
      Hardy Jones authored
      We weren't indenting parenthesized things correctly.
      We would end up formatting things like:
      ```PureScript
      foo =
        ( [ 1
        , 2
        , 3
        , 4
        ]
        )
      ```
      
      Now, we format things like:
      ```PureScript
      foo =
        ( [ 1
          , 2
          , 3
          , 4
          ]
        )
      ```
      
      This is more consistent with how we format everything else.
      d92028cb
    • Hardy Jones's avatar
      Add a failing test for parenthesized constraints · bdfaaf73
      Hardy Jones authored
      We added a test for instance constraints,
      but they're formatted a bit differently.
      They're formatted using `OneOrDelimited _`.
      
      They still weren't being formatted correctly.
      So we should fix them.
      But, that wasn't what we were after.
      bdfaaf73
    • Hardy Jones's avatar
      Add failing test for paren indentation · 2f970e3d
      Hardy Jones authored
      We're not indenting enough for any constructs that are parenthesized.
      We add a failing test to validate those failures.
      2f970e3d
    • Hardy Jones's avatar
      Merge branch 'update-gitlab-ci' into 'master' · 1761117a
      Hardy Jones authored
      Use `install-stack.sh` in GitLab CI
      
      See merge request joneshf/purty!115
      1761117a
    • Hardy Jones's avatar
      Ensure that `$HOME/.local/bin` exists · b54daa69
      Hardy Jones authored
      It looks like this path doesn't exist,
      and we're trying to install `stack` there.
      This fails because we cannot `mv` without the directories being there.
      We create the directories, so the script should now work.
      b54daa69
    • Hardy Jones's avatar
      Use `install-stack.sh` · ae2483a5
      Hardy Jones authored
      This script exists because installing stack is non trivial.
      I don't know how I forgot about it.
      
      All the more reason to have a single CI service:
      #97.
      ae2483a5
  9. 18 Jun, 2019 7 commits