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

Reindenting lines only removes all indentation #3916

Open
andrewheiss opened this issue Jul 7, 2024 · 2 comments
Open

Reindenting lines only removes all indentation #3916

andrewheiss opened this issue Jul 7, 2024 · 2 comments
Labels
area: formatting Issues related to formatting and indentation enhancement New feature or request lang: r support

Comments

@andrewheiss
Copy link

Positron Version:

Positron Version: 2024.07.0 (Universal) build 15
Code - OSS Version: 1.90.0
Commit: d8da3ec
Date: 2024-07-05T03:51:32.592Z
Electron: 29.4.0
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0

Steps to reproduce the issue:

  1. Enable RStudio keybindings
  2. Select R code that isn't consistently indented
  3. Type cmd + i or use the "Reindent lines" command from the Command Palette
  4. All line indentation is removed

Here's a quick video:

positron-reindent.mov

What did you expect to happen?

In RStudio, the same command results in code that is indented:

rstudio-reindent.mov

Were there any error messages in the output or Developer Tools console?

Nope.

@andrewheiss andrewheiss added the bug Something isn't working label Jul 7, 2024
@andrewheiss
Copy link
Author

Actually, it seems to do this just for pipes and ggplot +s. Arguments inside parentheses get aligned correctly:

indent-arguments.mov

This might be related to #1316, though that was for indent-as-you-type indentation

@juliasilge
Copy link
Contributor

This is related to #19 where we realized that the "reindent lines" command uses a whole separate code path. We will be solving this via a real formatter for R, rather than the rudimentary styler + indent-only formatter we have now.

Let's keep this issue open for the cases to check. 👍

@juliasilge juliasilge added enhancement New feature or request and removed bug Something isn't working labels Jul 8, 2024
@juliasilge juliasilge added this to the Release Candidate milestone Jul 8, 2024
@lionel- lionel- added the area: formatting Issues related to formatting and indentation label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: formatting Issues related to formatting and indentation enhancement New feature or request lang: r support
Projects
None yet
Development

No branches or pull requests

4 participants