Commit graph

120 commits

Author SHA1 Message Date
Sean Hagstrom
e2e77a2324
formatter: add newlines between parens delimiters for multiline expressions 2022-05-24 11:19:30 +01:00
Sean Hagstrom
c53f6cf2fe
formatter: remove spaces at the beginning and end of single-line square bracket expressions 2022-05-22 14:06:34 +01:00
Sean Hagstrom
c7e6547c9a
formatter: support outdenting multi-line annotations for record types and tag unions 2022-05-21 20:18:32 +01:00
Ayaz Hafiz
e78b345ee0
Format has-derived clauses 2022-05-19 18:29:31 -04:00
Sean Hagstrom
08777434b6
formatter: support removing blank lines between all when branches in when expressions 2022-05-19 09:26:04 +01:00
Sean Hagstrom
802422e6f4
formatter: support removing blank lines between when branches if all branches are single line 2022-05-19 09:07:31 +01:00
Sean Hagstrom
7def844302
formatter: support allowing single line value expressions in when expressions 2022-05-19 09:07:30 +01:00
Ayaz Hafiz
50769b81e6
Format other stdlib modules 2022-05-18 15:40:02 -04:00
Ayaz Hafiz
33945a7d5c
Add env var for workspace root and scaffold builtins fmt test 2022-05-18 14:30:03 -04:00
Richard Feldman
2c09907116
Merge pull request #3078 from rtfeldman/formatter-multiline-fn-type-annotated-bodies
Fix multi-line function type annotations for annotated bodies
2022-05-17 23:25:21 -04:00
Sean Hagstrom
98a174c984
fix(formatter): ensure multi-line function type annotations for annotated bodies are indented properly 2022-05-16 22:25:01 +01:00
Sean Hagstrom
750ca52deb
improvement(formatter): format empty record patterns without spaces 2022-05-16 22:23:58 +01:00
Sean Hagstrom
b91d6aa5a9 fix(formatter): ensure arguments and return value in multi-line function annotation are on separate lines
Added tests based on the examples in: Issue #2587
Removed outdated comment and debug_assert statement
Updated the tests for multi-line higher order function annotations
2022-05-14 14:23:56 +01:00
Richard Feldman
fd40fed937
Fix a bunch of errors from clippy --tests 2022-05-10 15:21:48 -04:00
Richard Feldman
36255b056b
Test expected == actual after verifying idempotence 2022-05-06 14:45:59 -04:00
Richard Feldman
a8991dc268
Trim inputs and expected in fmt tests 2022-05-06 14:37:23 -04:00
Richard Feldman
eb1d572b24
Test that modules reformat stably too 2022-05-06 14:37:23 -04:00
Richard Feldman
ad51624eb2
Write a better test for tui example 2022-05-06 14:37:23 -04:00
Richard Feldman
eb8e7d6a97
Verify stable formatting in fmt tests 2022-05-06 14:37:22 -04:00
Richard Feldman
7be5948476
Add formatter test 2022-05-06 14:37:22 -04:00
Sean Hagstrom
4707528caa feature(formatter): allow single blank line around comments in lists, records, type annotations 2022-05-01 18:28:49 +01:00
Sean Hagstrom
e6621e5167 remove outdated test for inline comment formatting
I tested if the formatter was still inconsistent by locally changing the helloWorld example to have:
```
main =
    greeting = "Hello, World!\n" # This variable is for greeting

    greeting
```
And running the formatter multiple times with `cargo run -- formatter`.
At the moment the results are consistent and the inline comments remains inlined.
2022-04-30 14:37:53 +01:00
Sean Hagstrom
e36aad6310 fix(formatter): format and allow inline comments for defs 2022-04-30 14:34:33 +01:00
Sean Hagstrom
477ed3c5e8 feat(formatter): allow single-line function call ending with multi-line lambda 2022-04-24 18:55:57 +01:00
Sean Hagstrom
b147890b08 feat(formatter): implement outdent formatting for multiline lists and records 2022-04-24 16:52:02 +01:00
Kevin Gillette
9ed4ca9739
remove Num.mod and Num.modUnchecked 2022-04-18 13:54:40 -06:00
Anton-4
56dc06a139
fixed the previous formatting change when inside longer pipeline 2022-03-09 14:07:52 +01:00
Anton-4
ba5d47d270
Merge branch 'trunk' of github.com:rtfeldman/roc into roc_fmt_fixes 2022-03-08 13:57:20 +01:00
Anton-4
21a30b1e83
fixed indentation for apply args 2022-03-07 16:23:15 +01:00
Anton-4
454933e2c6
fixed unnecessary double indentation 2022-03-07 16:02:11 +01:00
Folkert
836967b919
some other clippy things in tests 2022-03-06 19:07:38 +01:00
Pierre-Henri Trivier
1d3aa26193 Fixes #2586 2022-03-04 23:50:00 +01:00
Richard Feldman
881bae7267
Merge branch 'trunk' into fix-module-formatting 2022-02-04 23:03:52 -05:00
Folkert
885500712c remove old Effect module things 2022-02-03 23:55:02 +01:00
Folkert
a98635ed06 update other examples 2022-02-03 22:45:15 +01:00
Richard Feldman
200e237393
Add tests for multiline interface and hosted modules 2022-02-01 21:22:35 -05:00
Richard Feldman
099a0b5d41
Add formatting test for hosted modules 2022-01-30 20:40:51 -05:00
Folkert
f76a75b00e formatting fixes 2022-01-23 21:25:20 +01:00
Jan Van Bruggen
1e9d2d1239 Remove accidental trailing spaces 2022-01-18 22:25:46 -07:00
Joshua Warner
8b58d5cbc7 Switch to always encoding package names / paths as strings
This will simplify parsing and make it possible to have a uniform lexer for the language. Previously unquoted package names were allowed to include '-'s, which aren't valid identifiers.

In the future, we'll distinguish local paths from packages in the package-manager by looking for a ".roc" suffix, which should only be present in local paths.
2021-12-23 20:11:14 -08:00
Joshua Warner
825b93696c Improve error message & comment 2021-12-21 18:23:04 -08:00
Joshua Warner
6786acb939 Remove redundant space in aliases 2021-12-21 18:16:58 -08:00
Joshua Warner
4fed812389 add test_fmt_examples 2021-12-21 17:25:36 -08:00
Joshua Warner
61cdbd1531 Fix formatting of pipelined call exprs 2021-12-18 16:36:51 -08:00
Richard Feldman
cb4a74ac46
Merge pull request #2233 from rtfeldman/joshuawarner32/encapsulate-state
Encapsulate the `bytes` field of State in the parser
2021-12-17 14:42:06 -05:00
Joshua Warner
49818343dd extract state 2021-12-16 17:13:53 -08:00
Joshua Warner
c36b853286 Also assert module formatting is stable 2021-12-16 17:07:05 -08:00
Jan Van Bruggen
d03a51c75b Rename base package to pf everywhere, to match tutorial 2021-12-12 05:57:39 -07:00
Folkert
873ccc5d96 remove incorrect space 2021-12-06 09:45:11 +01:00
Folkert de Vries
8459339230
Merge branch 'trunk' into joshuawarner32/keep-trailing-comments 2021-12-06 09:19:13 +01:00