Improve import and structure output formatting?
Hey @twostraws ! 👋🏼
Based on the screenshot here: https://twitter.com/twostraws/status/1354136797496881154/photo/1
I was wondering why imports are word-wrapped instead of formatted like everything else?
I think a format like this would be easier to read:
Imports
UIKit: 8
Foundation: 63
AppKit: 17
Structure:
UIKit View Controllers: 17
UIKit Views: 23
SwiftUI View: 0
(Also, separating "imports" into its own section seems helpful)
Having discussed this with Jesse on Twitter we've come to the conclusion that perhaps breaking the imports up into separate lines would work well if we cap the number of imports by default to some sensible value and show the most frequent ones.
Whatever the cap is, it should be enough that it isn't always just the obvious candidates (UIKit, SwiftUI, Combine, Foundation, etc), but not so many that the list of imports overwhelms the rest of the report. Perhaps top 8?
We would then add a command-line flag to show all imports – perhaps -v for verbose mode, or similar. I would suggest that the JSON output always includes all imports.
I'm going to tag this as a good first issue; hopefully someone can investigate!
Whatever the cap is, it should be enough that it isn't always just the obvious candidates
Actually, now that you mention this, I think I would prefer ignoring UIKit, AppKit, and Foundation, at least for the "non-verbose mode". Then -v (or whatever) would include these common imports.
You literally can't build an app without those frameworks. 😆