Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge version 0.7.0 from upstream #2

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

brandonstubbs
Copy link

This is the initial part in order to solve BetterThanTomorrow/calva#807

I have merged an "as-is" approach the indentation changes on top of the latest 0.7.0 version.
While doing this I can see there is a lot of history discussed around this topic: weavejester#77

The tests have purposely been left as failing to keep them open as discussion points. Some will fail as the indentation is applied.
However, see others below:

Do we want to remove the comma in this case?

# case 1
FAIL in (test-remove-multiple-non-indenting-spaces) (core_test.cljc:638)
expected: ["{a, b}"]
  actual: ["{a b}"]

We should probably remove the comma in this case, or keep it like the next case?

# case 2
FAIL in (test-options) (core_test.cljc:1001)
expected: ["{:one two, " " :three four}"]
  actual: ["{:one   two" " , " " :three four}"]
# case 3
FAIL in (test-options) (core_test.cljc:1007)
expected: ["{:one two," " :three four}"]
  actual: ["{:one   two," " :three four}"]

Another comma case:

# case 4
FAIL in (test-surrounding-whitespace) (core_test.cljc:676)
surrounding whitespace removed
expected: ["{:x 1, :y 2}"]
  actual: ["{:x 1" " , :y 2}"]

Then I would like to add the case from BetterThanTomorrow/calva#807 which is the alignment when there is type hinting:

# case 5
(is (reformats-to?
       ["(let [^String x \"foo\""
        "      some-longer-var \"bar\"])"]
       ["(let [^String x       \"foo\""
        "      some-longer-var \"bar\"])"]
       {:split-keypairs-over-multiple-lines? true}))

FAIL in (test-options) (core_test.cljc:886)
expected: ["(let [^String x       \"foo\"" "      some-longer-var \"bar\"])"]
  actual: ["(let [^String x               \"foo\"" "      some-longer-var \"bar\"])"]

@brandonstubbs brandonstubbs marked this pull request as draft October 10, 2020 17:39
@PEZ
Copy link
Owner

PEZ commented Oct 10, 2020

Hello. Meny thanks for working with this!

It is a bit late here and I am too tired to make much sense of anything, so will have to get back to this tomorrow. 😄

Generally for comma cases, I think that default behaviour should be to never add or remove commas. (Not sure what the failing tests means regarding, since I don't see the input.)

Also generally. I think Calva's cljfmt should behave as much as possible as the current 0.7.0 one. I can from the top of my head not come up with any other exception than this alignment option, which is the only reason we use a fork.

I realise those two general observations could be in conflict. Are they?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants