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

Use of boxes for rendering types in JSON output #2239

Closed
nwolverson opened this issue Jul 19, 2016 · 5 comments
Closed

Use of boxes for rendering types in JSON output #2239

nwolverson opened this issue Jul 19, 2016 · 5 comments

Comments

@nwolverson
Copy link
Contributor

I think this applies to both compiler JSON output and psc-ide output - types are always rendered to a string using boxes.

E.g. psc-ide completion or type info, or type annotation suggestion.

In some cases this may be desirable if this is simply displayed in a fixed-width form, but often we would want either something suitable for display (e.g. tooltip) or insertion into code itself. For the latter, any side by side rendering breaks things, and the excessive space is an annoyance; for the former, I've mostly been ignoring all spaces, but again side by side rendering means this is incorrect.

My feeling is for the specific JSON fields here (i.e. not actual error message content which may be embedded) we should have an alternative simplistic/linear formatting. Something structural seems over-complicated and hard to consume

@garyb
Copy link
Member

garyb commented Jul 19, 2016

#1645 has some similiar discussion. It's better than it was there, but yeah, it can be an issue.

If you look at that ridiculous type I used as an example though, I don't really think a single line presentation is going to help there 😉

@nwolverson
Copy link
Contributor Author

No, specifically some types are resulting in side by side rendering (an example here nwolverson/atom-ide-purescript#112 which I also linked to the related issue #2039). The point is this formatting is for a fixed-width font terminal and is not just bad but incorrect if you ignore the spacing.

@garyb
Copy link
Member

garyb commented Jul 19, 2016

Oh, sure, I saw that, but I'd consider that output to be broken - I'm not sure it's specifically boxes related, although it does occur due to the way it's being used. You should be able to take all the newlines out from any of these kind of things and have them as valid syntax.

@nwolverson
Copy link
Contributor Author

OK, if the assumption is that every pretty-printed type should be valid syntax to be pasted into your code - I guess it's fine that it appears in the JSON output - it's easy enough to remove undesired whitespace vs adding it. I'll close this on that basis.

(I usually kill 90% of the space in the compiler's type output but maybe that's my preference)

@garyb
Copy link
Member

garyb commented Jul 19, 2016

every pretty-printed type should be valid syntax

Maybe I'm wrong in that, but I think anything else would be rather surprising. 😄

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

No branches or pull requests

2 participants