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

Align worksheet decorations #149

Open
tgodzik opened this issue Sep 10, 2020 · 3 comments
Open

Align worksheet decorations #149

tgodzik opened this issue Sep 10, 2020 · 3 comments

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Sep 10, 2020

Is your feature request related to a problem? Please describe.

It was suggested by @odersky that currently worksheets are not super clear if each decoration is in a different column like:

val a : Int = 1234 + 1234 // : Int = 2468
1 + 2 // : Int = 3

Describe the solution you'd like

Find the common margin and display the decorations there:

val a : Int = 1234 + 1234 // : Int = 2468
1 + 2                     // : Int = 3

Some issues:

  • if a statement result is longer than the screen width, we might want to show it without the margin
  • spaces should be taken into account as worksheets lose any information about them when evaluating
  • we probably need to calculate all margins first, which might not be super efficient

Describe alternatives you've considered
Worksheets working as is with no common column position

Additional context
I did some initial work here: https://github.com/tgodzik/metals/tree/add-align but would love to gather some feedback before spending any more time.

image

Search terms:
align worksheets

@ckipp01
Copy link
Member

ckipp01 commented Sep 12, 2020

So I've been thinking about this a bit since I originally read it. Maybe it's that I've just gotten so used to them being the way the are, but dare I saw that I actually think I prefer them the way the currently are? There are a couple things that come to mind that are worth considering.

More than likely a lot of the examples we'd test this with or show are single line expressions, which give way to really nice examples sort of like you have above with 5 lines right in a row all one after another lined up. When in reality, I've found that that's not often how my worksheets end up looking.

For example, here is a real one that I have laying around:
Screenshot 2020-09-12 at 13 09 44

If we were to align the evaluations all in the right column it'd pose a couple challenges. I almost always have my screen split, so there is almost no way I'd see even close to the full evaluation. My example is maybe bad for this because they are quite long and I need to hover on them anyways, but you get the idea. Also, where I would care about the evaluations the most, are the final two lines, and I actually really like that I can look at my method call, and then see the evaluation directly after it. I'm not sure how I'd like to scan to the other side of the screen to see it. Again, I may just be very used to how we have worksheets now.

if a statement result is longer than the screen width, we might want to show it without the margin

Again, at least in my example, this is every evaluation. I know this won't always be the case, but if we were to do this, I'd rather do it for every evaluation, not just the long ones. I find it pretty jarring to have some all aligned and then others not.

I'm not opposed to this, but I'm just curious if it will actual improve the worksheet experience. This is a great example of something I think we should hear more about from the community of users and what they think before implementing it.

@kpbochenek
Copy link

Example from intellij:
(It puts worksheet output into separate frame splitted on right and you can adjust width of it as you want)

2020-09-14-091946_1009x446_scrot

I think that aligning output in some cases makes sense, in others it doesn't.
(just added bunch of spaces to align decorations)
2020-09-14-092448_416x194_scrot

  • (-) if you have a few statements on left and far on right their output it is actually harder to match statement to output. You can move cursor to your statement and it highlights whole line but this is worse than what we have now
  • (-) if you have one long statement followed by a bunch of short ones it might
    one: cause short statements output to be truncated even though their output would fit on screen
    two: force user to artificially split lines just to get more output on screen
  • (+) if you copy/paste bunch of code, it might contain comments, you might not recognize easily where evaluation output starts if it is not aligned.
  • (+) you might want to compare output from 3 statements, it is nice to have output aligned in that case (although as in my case you can just add bunch of spaces at the end to move decoration)

My number 1 option would be to make it configurable. Users will be able to choose what they prefer, it doesn't seem hard from technical point of view, but I know you don't prefer to make worksheets configurable, but that's my point.

My number 2 if we can't configure it would be to split worksheet into blocks of code(separation would be let's say empty line) and align output separately for each block:
2020-09-14-094547_1100x163_scrot

But then again I don't use worksheets on daily basis so what do I know 🤷‍♂️

@odersky
Copy link

odersky commented Sep 14, 2020 via email

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

No branches or pull requests

4 participants