Skip to content

Fix/positron onload#166

Open
MMenninger wants to merge 2 commits into
masterfrom
fix/positron-onload
Open

Fix/positron onload#166
MMenninger wants to merge 2 commits into
masterfrom
fix/positron-onload

Conversation

@MMenninger

Copy link
Copy Markdown
Collaborator

No description provided.

From AI -- Problem. The whole working tree currently shows as modified in git, but git diff --ignore-all-space shows zero real changes — it is pure CRLF↔LF line-ending noise. Without fixing this first, every later PR diff is buried under thousands of phantom line-ending changes and nothing reviews cleanly.

Change.

Add a .gitattributes that forces LF for text files (* text=auto eol=lf
plus explicit entries for .R, .Rmd, .Rd, .md, .yaml/.yml,
DESCRIPTION, NAMESPACE, .Rproj) and marks binaries (.rda, .png,
.ico, .svg) as binary.
Set the RStudio project to write LF (LineEndingConversion: Posix in
cmapplot.Rproj) so RStudio doesn't re-introduce CRLF on save.
Run git add --renormalize . in the same commit.

Files. .gitattributes (new), cmapplot.Rproj.

Review note. The diff looks huge but is mechanical — "line endings only."
Problem. R/cmapplot.R (~lines 110–131) gates graphics setup on
rstudioapi::isAvailable() / rstudioapi::getVersion(). In Positron,
isAvailable() returns TRUE (Positron ships a partial rstudioapi shim), so
execution enters the RStudio branch, where getVersion() can error outside real
RStudio — risking an error on package load. The RStudioGD.backend option is
meaningless to Positron (its Ark device already auto-uses ragg), and the
"please install RStudio" fallback message is wrong advice for Positron users.

Change. Detect the IDE via environment variables instead:

RStudio: Sys.getenv("RSTUDIO") == "1"
Positron: Sys.getenv("POSITRON_VERSION") != ""

In RStudio, keep the existing RStudioGD.backend = "ragg" behavior. In
Positron, skip the option entirely and drop the RStudio-install message. Keep
the plain-R fallback message.

Files. R/cmapplot.R
@MMenninger MMenninger self-assigned this Jul 17, 2026
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