Line breaks with `$` operators

Open
#163 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
r, rust
Domain
tooling

Research direction

Start by reproducing the bslib R6 method-chaining example with air 0.1.2 and compare its current formatting with the proposed line break after each $. Review the formatter entry points for chained $ expressions, then add coverage for the preferred style and confirm that the example formats consistently.

Written by the indexing model from the issue text.

Description

Niche, but with R6 classes method chaining is common. We have the following line in bslib

tq$find(".accordion-button")$removeClass("collapsed")$removeAttrs("aria-expanded")$addAttrs("aria-expanded" = "true")

that air (0.1.2) reformats as

tq$find(".accordion-button")$removeClass("collapsed")$removeAttrs(
  "aria-expanded"
)$addAttrs("aria-expanded" = "true")

I personally would have rewritten this as

tq$
  find(".accordion-button")$
  removeClass("collapsed")$
  removeAttrs("aria-expanded")$
  addAttrs("aria-expanded" = "true")

Maybe the line break at the first $ could be magical, since most people would probably want to opt into this style.

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

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.

More from posit-dev/air

All issues in posit-dev/air

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.