Skip to content

Treat multiline strings as groupable trailing arguments - #550

Draft
randy3k wants to merge 1 commit into
posit-dev:mainfrom
randy3k:groupable-multiline-strings
Draft

randy3k wants to merge 1 commit into
posit-dev:mainfrom
randy3k:groupable-multiline-strings

Conversation

@randy3k

@randy3k randy3k commented Oct 23, 2026 •

Copy link
Copy Markdown

Related to #380 and #530.

This mirrors current styler behavior for calls with a trailing multiline string to minimize migration churn when transitioning existing codebases from styler to air.

Specifically, it treats multiline strings (including raw strings) as groupable in argument_is_groupable() so their opening and closing quotes can hug the surrounding call arguments without forcing all arguments to break out onto new lines.

Because is_hugging_call() delegates to argument_is_groupable(), this also allows nested single-argument calls with a trailing multiline string (such as sql(glue("..."))) to hug ( and ). Persistent line breaks after ( and comments on the trailing argument continue to prevent grouping via has_persistent_line_break() and should_group_last_argument().

Examples

# Single unnamed multiline string
fn("
  this
  that
")

# Trailing multiline string in a multi-argument call
DBI::dbGetQuery(con, "
  SELECT *
  FROM table
")

# Named trailing multiline string
fn(arg, name = "multiline
  string")

# Nested hugging calls
sql(glue("(
  SELECT *
  FROM table
)"))

# Persistent line break after `(` is preserved
fn(
  "this
  that"
)

@randy3k
randy3k force-pushed the groupable-multiline-strings branch from 242d1dd to 2a369a4 Compare October 23, 2026 20:35
@randy3k
randy3k force-pushed the groupable-multiline-strings branch from 2a369a4 to c48b96c Compare October 23, 2026 21:01

This branch has not been deployed

No deployments
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.

1 participant