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

tweak width of output #1189

Closed
wants to merge 2 commits into from
Closed

tweak width of output #1189

wants to merge 2 commits into from

Conversation

olivroy
Copy link
Contributor

@olivroy olivroy commented Mar 28, 2024

follow-up to #1187

The +1 seems to cause rendering issues
It seems like it was added in #165

I know that cli exports cli::ansi_nchar(), but it will probably slow down a little bit the execution to use this.

image

while on main currently, I had
image

Sorry I didn't test this more extensively in the first place.

@olivroy olivroy changed the title tweak appearance tweak width of output Mar 28, 2024
Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 208d9c7 is merged into main:

  •   :ballot_box_with_check:cache_applying: 147ms -> 149ms [-1.52%, +4.79%]
  •   :ballot_box_with_check:cache_recording: 510ms -> 508ms [-1.33%, +0.27%]
  •   :ballot_box_with_check:without_cache: 975ms -> 978ms [-0.48%, +0.98%]

Further explanation regarding interpretation and methodology can be found in the documentation.

@lorenzwalthert
Copy link
Collaborator

Thanks. Seems not to slow down things. 👍 also, can you add a snapshot test for this output? Seems like we don’t have good coverage of that currently. I think there are already snapshot tests in the test-public-api-*.R

@lorenzwalthert
Copy link
Collaborator

FYI @olivroy I am finish ing the release 1.10.3, so if you want this and #1187 to be released as part of that (no idea when the next release comes), please make the changes requested in the next 2 days.

@olivroy
Copy link
Contributor Author

olivroy commented Apr 1, 2024

Thanks! I will be able to make it tomorrow

@olivroy
Copy link
Contributor Author

olivroy commented Apr 2, 2024

Thanks. Seems not to slow down things. 👍 also, can you add a snapshot test for this output? Seems like we don’t have good coverage of that currently. I think there are already snapshot tests in the test-public-api-*.R

Seems like width of output is more difficult to test programatically with snapshots. according to codecov, the lines I changed are already covered..

@lorenzwalthert
Copy link
Collaborator

lorenzwalthert commented Apr 2, 2024

Can you explain what are the hurdles to add a snapshot test? We can set the width of the output programmatically with R option (options(width = 80) using {withr} with local_options() or similar to ensure consistent width.

Even when already covered, current tests seem insufficient to detect regressions like the one you introduced.

@olivroy
Copy link
Contributor Author

olivroy commented Apr 3, 2024

Can you explain what are the hurdles to add a snapshot test? We can set the width of the output programmatically with R option (options(width = 80) using {withr} with local_options() or similar to ensure consistent width.

Even when already covered, current tests seem insufficient to detect regressions like the one you introduced.

It is just that RStudio renders inline markup peculiarly. Before RStudio 2023.12, long output could be truncated, so they introduced a new way to render console output that seems to break lines more often than usual, but that doesn't really show in snapshot tests.. Only interactive testing seems to work for this. rstudio/rstudio#13869

@olivroy
Copy link
Contributor Author

olivroy commented Apr 3, 2024

See the difference how cli markup is rendered vs regular one
(I am using dev usethis, which uses cli internally now)
image

With cli, the message is displayed on 3 lines, while the regular cat() message is displayed on 2 lines. This is to avoid breaking links or markup.

@lorenzwalthert
Copy link
Collaborator

lorenzwalthert commented Apr 3, 2024

With the release candidate,I get
Screenshot 2024-04-03 at 16 04 45

Note that the checks are vertically aligned in the release candidate. Your snapshot test should show that too (but don't I think). So I think we need to work on the implementation of your formatting to more closely mimic the release version.

@olivroy
Copy link
Contributor Author

olivroy commented Apr 3, 2024

Ok. I don't really know how to make console + RStudio agree.
I will send a PR to revert #1187. Sorry for the noise

@olivroy olivroy closed this Apr 3, 2024
@lorenzwalthert
Copy link
Collaborator

Ok. I don't really know how to make console + RStudio agree.

I get this with the console, so console and RStudio look similar tome?
Screenshot 2024-04-03 at 16 11 53

@olivroy
Copy link
Contributor Author

olivroy commented Apr 3, 2024

I agree my fix was incorrect. The problem is that if you have a path that is wider than the width, all checks marks would go to the next line.. But it is better to revert I guess, not much added value!

@lorenzwalthert
Copy link
Collaborator

lorenzwalthert commented Apr 3, 2024

The problem is that if you have a path that is wider than the width, all checks marks would go to the next line..

I agree, but that problem already exists currently, so I would not consider that blocking a merge of this PR. here both release candidate and your PR

enough wide (kind of):
Screenshot 2024-04-03 at 20 24 00

not enough
Screenshot 2024-04-03 at 20 25 14

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.

None yet

2 participants