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

Ark: Global handling of warnings #1881

Open
lionel- opened this issue Nov 23, 2023 · 0 comments
Open

Ark: Global handling of warnings #1881

lionel- opened this issue Nov 23, 2023 · 0 comments
Labels
area: kernels Issues related to Jupyter kernels and LSP servers lang: r

Comments

@lionel-
Copy link
Contributor

lionel- commented Nov 23, 2023

Now that #1824 is fixed, messages are no longer shown in red but warnings still are. This creates inconsistent styling and causes warnings to stand out more than errors:

Screenshot 2023-11-23 at 09 32 04

I propose to add a condition handler for warnings too. Since we have a read_console() method with which we can detect the end of a top-level command, we have greater control than in a package like rlang. This allows us to reliably collect warnings emitted during top-level commands.

This would let us style the warning prefix differently and leave the message styled in normal text:

Screenshot 2023-11-23 at 09 58 58

We could also emit the warnings to the frontend so they get their own special box like errors. By the same token, this would allow us to record elided warnings persistently in the output. Currently you can lose elided warnings when running multiple commands. In the following example the warning("bar") call overwrites the 50 warnings that were hidden from the user:

for (i in 1:100) warning("foo")
#> There were 50 or more warnings (use warnings() to see the first 50)

# Overwrites
warning("bar")
#> Warning message:
#> bar

# 100 warnings now lost
warnings()
#> Warning message:
#> bar

Instead we could emit the warnings (or a summary if there are too many) to the frontend that would display them in a collapsable box. The warnings would no longer be sensitive to the state of the R REPL.

@lionel- lionel- added this to the Release Candidate milestone Feb 23, 2024
@wesm wesm added the lang: r label Feb 29, 2024
@lionel- lionel- added the area: kernels Issues related to Jupyter kernels and LSP servers label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: kernels Issues related to Jupyter kernels and LSP servers lang: r
Projects
None yet
Development

No branches or pull requests

2 participants