posit-dev / positron

Positron, a next-generation data science IDE
Other
1.59k stars 43 forks source link

Ark: `harp_format()` errors on quosures #3115

Open DavisVaughan opened 1 month ago

DavisVaughan commented 1 month ago

I'm not entirely sure how we got here in the first place, but this came from a private beta user https://github.com/posit-dev/positron-beta/discussions/19#discussioncomment-9407240

[R] 2024-05-12T16:18:40.325464000Z [ark-unknown] WARN crates/harp/src/utils.rs:102: `format()` method for <quosure/formula> should return the same number of elements.
[R] 2024-05-12T16:18:40.326057000Z [ark-unknown] WARN crates/ark/src/variables/variable.rs:299: Error while formatting variable: Error evaluating harp_format(~NULL): Unexpected length from `base::format()`.
[R] R backtrace:
[R] 1. safe_evalq(harp_format(~NULL), <environment>)
[R] 2. withCallingHandlers(list(out, NULL), error = handler)
[R] 3. harp_format(~NULL)
[R] 4. format_oo(x, ...)
[R] 5. format_fallback(x, ...)
[R] 6. stop("Unexpected length from `base::format()`.")
[R] 2024-05-12T16:16:16.793140000Z [ark-unknown] WARN crates/harp/src/utils.rs:102: `format()` method for <quosure/formula> should return the same number of elements.
[R] 2024-05-12T16:16:16.793596000Z [ark-unknown] WARN crates/ark/src/variables/variable.rs:299: Error while formatting variable: Error evaluating harp_format(~everything()): Unexpected length from `base::format()`.
[R] R backtrace:
[R] 1. safe_evalq(harp_format(~everything()), <environment>)
[R] 2. withCallingHandlers(list(out, NULL), error = handler)
[R] 3. harp_format(~everything())
[R] 4. format_oo(x, ...)
[R] 5. format_fallback(x, ...)
[R] 6. stop("Unexpected length from `base::format()`.")
juliasilge commented 1 month ago

This looks to be the same as #2801 to me. What do you think?

DavisVaughan commented 1 month ago

Reprex from #2801

library(ggplot2)

df <- data.frame(x = 1:10, y = rnorm(10))
p1 <- ggplot(data = df, mapping = aes(x=x,y=y)) + geom_point() + theme_bw()
p1
lionel- commented 1 month ago

Two actions we could take here:

DavisVaughan commented 1 month ago

In particular I noticed this when searching for Error in the log text, so removing the word Error would probably help a lot, as it makes it hard to find "real" problems