posit-dev / posit-dev/air

Issue with auto format on save for .qmd documents

Open
#381 5 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

Currently running latest version of Positron, with the quarto and air extensions installed. Super strange issue happening with auto format on save with a .qmd document. Won't work when there is one specific section of ggplot code in a separate chunk, but once that code is removed, auto format on save works fine. Replicated it in a separate .qmd file with just two chunks of code, one with this ggplot code and another with purposefully poorly formatted code.

ggplot(data_rep_persist, aes(x = condition, y = purchase, fill = condition)) + geom_violin(trim = FALSE, alpha = 0.4) + geom_jitter(width = 0.2, alpha = 0.7, color = "grey") + stat_summary(fun = mean, geom = "point", shape = 18, size = 3, color = "black") + stat_summary(fun = mean, geom = "text", aes(label = round(after_stat(y), 2)), vjust = -0.5, color = "black") + labs(x = "Condition", y = "Follow through", title = "Follow through in purchasing by Condition with Means (Replication)") + theme_minimal() +    theme(legend.position = "none")

Sometimes the issue randomly resolves itself, but never consistently. Sometimes removing the theme_minimal() + line fixes the issue, but never consistently. Additionally, there are plenty of other occurrences of theme_minimal() + throughout my code with no issues.

Happy to share more with people individually, but can't share the full code publicly. Also willing to do whatever steps to document/troubleshoot on my side that I can.

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

Reproduce the report in a minimal .qmd file containing the supplied ggplot chunk and a deliberately poorly formatted second chunk, then run auto format on save repeatedly. Compare behavior with and without the theme_minimal() line; done means the formatter behaves consistently and formats the other chunk while the ggplot chunk is present.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.