Inconsistent/unexpected behavior when choosing which line function arguments go on
Within my UI definition, different blocks are getting formatted in different ways
miniUI::miniTabPanel(
title = "Feed",
icon = shiny::icon("table"),
miniUI::miniContentPanel(
gt::gt_output("pals"),
shiny::actionButton("reload_pals", "Refresh", # This is the unexpected behavior
icon = shiny::icon("fas fa-refresh")),
shiny::actionButton( # This is my expected behavior - One argument per line. However, if I style only this block on its own, it does the style like the block above
"story-current",
"Story from current script",
icon = shiny::icon("far fa-file-code")
),
shiny::actionButton(
"story-clip",
"Story from Clipboard",
icon = shiny::icon("far fa-clipboard-list")
),
# shiny::fileInput("story-file")
)
)
This one's a little hairy, but when I style this, it changes the fontawesome::fa call to be in the "first argument on the same line as the function call" style
df_pals <- eventReactive(input$reload_pals, {
read_pals() %>%
dplyr::mutate(button = purrr::map(
uname,
.f = ~ action_button_gt(
.x,
"_story",
label = fontawesome::fa(
"far fa-file-code",
stroke = "grey",
height = "30px"
)
)
))
})
Hope this makes sense, thanks for the awesome package! #:smile_cat:
hmmm.... They all seem to be styling correctly for me... Here they are as individual snippets.
grkstyle::grk_style_text('
shiny::actionButton("reload_pals", "Refresh", # This is the unexpected behavior
icon = shiny::icon("fas fa-refresh"))
')
#>
#> shiny::actionButton(
#> "reload_pals",
#> "Refresh", # This is the unexpected behavior
#> icon = shiny::icon("fas fa-refresh")
#> )
grkstyle::grk_style_text('
shiny::actionButton( # This is my expected behavior - One argument per line. However, if I style only this block on its own, it does the style like the block above
"story-current",
"Story from current script",
icon = shiny::icon("far fa-file-code")
)
')
#>
#> shiny::actionButton(
#> # This is my expected behavior - One argument per line. However, if I style only this block on its own, it does the style like the block above
#> "story-current",
#> "Story from current script",
#> icon = shiny::icon("far fa-file-code")
#> )
grkstyle::grk_style_text('
shiny::actionButton(
"story-clip",
"Story from Clipboard",
icon = shiny::icon("far fa-clipboard-list")
)
')
#>
#> shiny::actionButton(
#> "story-clip",
#> "Story from Clipboard",
#> icon = shiny::icon("far fa-clipboard-list")
#> )
Or if I copy and paste your first block and style it...
clipr::write_clip(grkstyle::grk_style_text(clipr::read_clip()))
I get this (note I'm using tabs here but that's globally configurable)...
miniUI::miniTabPanel(
title = "Feed",
icon = shiny::icon("table"),
miniUI::miniContentPanel(
gt::gt_output("pals"),
shiny::actionButton(
"reload_pals",
"Refresh", # This is the unexpected behavior
icon = shiny::icon("fas fa-refresh")
),
shiny::actionButton(
# This is my expected behavior - One argument per line. However, if I style only this block on its own, it does the style like the block above
"story-current",
"Story from current script",
icon = shiny::icon("far fa-file-code")
),
shiny::actionButton(
"story-clip",
"Story from Clipboard",
icon = shiny::icon("far fa-clipboard-list")
),
# shiny::fileInput("story-file")
)
)
Same story for the second example.
Could you maybe share the output from running this function?
sessioninfo::session_info(c("grkstyle", "styler"))
Weird, running the functions you showed produces the same behavior that you're showing. But when I'm in RStudio and highlight/ctrl + shift + A, it does the unexpected behavior.
Here is the output:
- Session info ------------------------------------------------------------------------
setting value
version R version 4.0.4 (2021-02-15)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/Chicago
date 2022-08-04
- Packages ----------------------------------------------------------------------------
package * version date lib source
cli 3.2.0 2022-02-14 [1] CRAN (R 4.0.5)
digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.3)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.0.5)
fansi 0.4.2 2021-01-15 [1] CRAN (R 4.0.3)
glue 1.6.2 2022-02-24 [1] CRAN (R 4.0.5)
grkstyle 0.2.1 2022-08-03 [1] Github (gadenbuie/grkstyle@5d29abb)
lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.0.5)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.0.5)
pillar 1.8.0 2022-07-18 [1] CRAN (R 4.0.4)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.0)
purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.0)
R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.0.4)
R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.0.4)
R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.0.4)
R.utils 2.12.0 2022-06-28 [1] CRAN (R 4.0.4)
rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.0.0)
rlang 1.0.2 2022-03-04 [1] CRAN (R 4.0.5)
rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.0.4)
styler 1.7.0 2022-03-13 [1] CRAN (R 4.0.5)
tibble 3.1.6 2021-11-07 [1] CRAN (R 4.0.5)
utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.0)
vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.0.5)
withr 2.4.1 2021-01-26 [1] CRAN (R 4.0.4)
[1] C:/Users/ethan/Documents/R/win-library/4.0
[2] C:/Program Files/R/R-4.0.4/library