Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected indentation behavior for function args on new lines in R scripts #5754

Open
markjrieke opened this issue Dec 16, 2024 · 2 comments
Labels
area: editor Issues related to Editor category. area: formatting Issues related to formatting and indentation support

Comments

@markjrieke
Copy link

System details:

Positron and OS details:

Positron Version: 2024.12.0 (Universal) build 96
Code - OSS Version: 1.93.0
Commit: c5ce275dc502f6b15433b271802cb33e1ba5ef68
Date: 2024-11-28T02:47:29.898Z (2 wks ago)
Electron: 30.4.0
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Darwin arm64 22.6.0

Interpreter details:

R version 4.3.2 (2023-10-31) -- "Eye Holes"

Describe the issue:

Howdy! Trying out positron for the first time today. Coming from RStudio, some of the indentation behavior is unexpected:

  • function args don't line up on enter
  • on auto-format (Cmd + I), args on their own lines just get indented by the default (2 spaces), rather than matching the indentation of the prior line's function arg

Steps to reproduce the issue:

(open up a new R script & run the following)

positron-indentation.mov

Expected or desired behavior:

Ideally, formatting/indentation would automatically follow RStudio's built-in styling/indentation, with the expected output of:

mtcars %>%
  ggplot(aes(x = qsec,
             y = hp) +
  geom_point()

I'm a fan of RStudio's built-in styling/indentation, so the only reason that I don't use VSCode for R is because RStudio-style formatting isn't available and there are no plans in REditor to support this. I am not a fan of styler-style formatting, so in an ideal world, positron would mirror RStudio-style formatting for R scripts by default.

It sounds like there is possibly an upcoming release that addresses formatting, so maybe this issue will be out of date shortly.

Thanks for all the work here, really excited to use a single IDE for R/python!

@nstrayer nstrayer added area: editor Issues related to Editor category. area: formatting Issues related to formatting and indentation labels Dec 17, 2024
@nstrayer
Copy link
Contributor

Since the formatting for R code is driven by Ark, that may be a better place for this issue. @DavisVaughan and @lionel- would know better, though!

@lionel-
Copy link
Contributor

lionel- commented Dec 17, 2024

@nstrayer We use the Positron tracker for issues that affect Positron UX, so here is a good place.

@markjrieke

function args don't line up on enter

That does seem like a bug in Ark.

on auto-format (Cmd + I), args on their own lines just get indented by the default (2 spaces), rather than matching the indentation of the prior line's function arg

This is #574. We are thinking about not supporting this particular style of formatting in Positron though. See https://github.com/posit-dev/air/blob/main/docs/formatter.md#mixing-tabs-and-spaces for some discussions about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: editor Issues related to Editor category. area: formatting Issues related to formatting and indentation support
Projects
None yet
Development

No branches or pull requests

3 participants