1

I am trying out Positron that builds upon VS studio code to be more data science centric. I am used to coding in R Studio which will automatically indent my code inside of functions and I am used to that look. Is there a way to change how Positron does indenting?

Here is an example:

iris |> #Only function indented
 mutate(test= "dog",
test_2 = "cat") #function arguments not indented
iris |> 
 mutate(test= "dog", #Function arguments indented
 test_2 = "cat")
DarkBee
14.4k9 gold badges86 silver badges135 bronze badges
asked Aug 15, 2025 at 19:25

1 Answer 1

2

The intended way to format R code in Positron is via Air, a new formatter for R. Air comes with Positron (actually, it's bundled inside an extension that comes with Positron). The recommended way to opt in to "format my code with Air every time I save" is to put this in your user-level settings:

{
 "[r]": {
 "editor.formatOnSave": true,
 "editor.defaultFormatter": "Posit.air-vscode"
 },
 "[quarto]": {
 "editor.formatOnSave": true,
 "editor.defaultFormatter": "quarto.quarto"
 }
}

You can read more here: <https://posit-dev.github.io/air/editor-vscode.html>

answered Aug 15, 2025 at 20:42
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.