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

Bad indentation after curly braces #1683

Open
thomasp85 opened this issue Oct 25, 2023 · 2 comments
Open

Bad indentation after curly braces #1683

thomasp85 opened this issue Oct 25, 2023 · 2 comments
Assignees
Labels
area: formatting Issues related to formatting and indentation area: kernels Issues related to Jupyter kernels and LSP servers bug Something isn't working lang: r

Comments

@thomasp85
Copy link

Positron Version:

Positron Version: 2023.10.0 (Universal) build 1356
Code - OSS Version: 1.83.0
Commit: d1119ff
Date: 2023-10-23T03:06:35.396Z
Electron: 25.8.4
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 23.0.0

Steps to reproduce the issue:

When having code like the following:

{
  lapply(1:10, function(x) {

  })
}

and pressing return while the cursor is placed between the closing curly brace of the anonymous function and the closing bracket of the lapply() function you get this:

{
  lapply(1:10, function(x) {

  }
)
}

ie. the closing bracket gets moved out one indentation level

What did you expect to happen?

The indentation of the closing bracket should be the same as the opening bracket

@juliasilge
Copy link
Contributor

I think the most reasonable way to solve problems like this is to have a formatter that can correct the indentation, probably when you save. The workflow we might end up best supporting is "type type type, save to format, type type type, save to format, etc".

@thomasp85
Copy link
Author

I think that would be a concession. Most people would not want to wait for saving to fix the look of their file so it would create a very awkward workflow. Of course I don't know anything about how the indentation is handled but it very much looks like a bug that needs fixing. If anything but a closing parenthesis is present as the next token the indentation works correctly

@jennybc jennybc added this to the Release Candidate milestone Feb 23, 2024
@wesm wesm added lang: r bug Something isn't working labels Feb 29, 2024
@lionel- lionel- added the area: kernels Issues related to Jupyter kernels and LSP servers label May 16, 2024
@lionel- lionel- added the area: formatting Issues related to formatting and indentation label Jun 11, 2024
@lionel- lionel- self-assigned this Feb 5, 2025
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 area: kernels Issues related to Jupyter kernels and LSP servers bug Something isn't working lang: r
Projects
None yet
Development

No branches or pull requests

5 participants