posit-dev / posit-dev/air

Issue with persistent line break with fun("", {})

Open
#378 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
446
Forks
32
Avg merge
16h 48m
Merged PRs (30d)
1

Description

Description

Let's assume the following code with a persistent line break

list(
foo, bar)
# Which gets formatted as
list(
  foo,
  bar
)

If I switch bar for an expression, it's still formatted as expected:

list(
foo, {bar})
# gets formatted as
list(
  foo,
  {
    bar
  }
)

But if ever foo is a text string, the persistent line break is removed:

list(
"foo", {bar})
# gets formatted as
list("foo", {
  bar
})

only in cases where {} is the second argument:

list(
  "foo","bar",{bar}
)
# gets formatted as
list(
  "foo",
  "bar",
  {
    bar
  }
)

Is this an intended behavior?

Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied R formatting examples and compare the behavior when the first argument is a string versus another expression. Trace the formatter entry point responsible for list calls and determine whether the persistent line break is intentional; done means the behavior is clarified and the relevant formatting case is covered consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.