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

Truncate maps in inspector according to config #115

Merged
merged 2 commits into from
Apr 13, 2021

Conversation

yuhan0
Copy link
Contributor

@yuhan0 yuhan0 commented Apr 11, 2021

Extends #111 to make maps truncate the same way as other collections,
showing *max-coll-size* number of elements if they are too long.


Before submitting a PR make sure the following things have been done:

  • The commits are consistent with our contribution guidelines
  • You've added tests to cover your change(s)
  • All tests are passing
  • The new code is not generating reflection warnings
  • You've updated the changelog (if adding/changing user-visible functionality)

Thanks!

Have maps show *max-coll-size* number of elements before truncating
them, similar to the other collections.
@yuhan0
Copy link
Contributor Author

yuhan0 commented Apr 12, 2021

I added a missing comma before the ... to match the previous representation, and changed the :array-long implementation for consistency.
{ :a 1, :b 2 ... }
vs
{ :a 1, :b 2, ... }

If preferred I can squash the commits.

@bbatsov
Copy link
Member

bbatsov commented Apr 13, 2021

I'm fine with the proposed change, but it needs a changelog entry.

I'm also a bit puzzled what's currently the criteria to use commas as separators in some collections and not in others. Seems right now it's just for maps, right? Perhaps we can expose some configuration for this down the road if people want commas for everything sequential.

@yuhan0
Copy link
Contributor Author

yuhan0 commented Apr 13, 2021

Ok, I didn't think it needed a changelog entry as it was an extension to #111.

I just followed the existing behavior with placing commas in maps and arrays. the second commit was to correct a mistake and restore the trailing comma before ....

I do think commas helps readability for homogeneous maps - {1 3 5 8 2 4 7 3 10 9} vs {1 3, 5 8, 2 4, 7 3, 10 9}
But arrays don't seem to justify the commas: java.lang.Long[] { 0, 1, ... }. Most likely they were inserted to mimic Java syntax?

@bbatsov
Copy link
Member

bbatsov commented Apr 13, 2021

Ok, I didn't think it needed a changelog entry as it was an extension to #111.

I thought the second commit was fixing a pre-existing bug, but I might have misunderstood that. Anyways, it's something small, so I'm fine if we don't document this.

But arrays don't seem to justify the commas: java.lang.Long[] { 0, 1, ... }. Most likely they were inserted to mimic Java syntax?

Perhaps. The code is truly ancient there. :-) We can leave this as is for now.

@bbatsov bbatsov merged commit 78584d2 into clojure-emacs:master Apr 13, 2021
@yuhan0 yuhan0 deleted the inspect-truncate-maps branch April 14, 2021 04:55
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