Indenting VSCode like RStudio

Viewed 530

I'm using VS Code and i miss RStudio's ctrl+i to indent lines.

I've read stuff online about LSP and other extensions and formatting with shift+alt+F but all i get is linter.

So, whats the equivalent if is there at all?

1 Answers

Found a solution but there a few things to take note.

First, VSCode notive options are language-agnostic, meaning it can't indent R code 'cause it doesn't understand it. You got to download extensions to make i work.

Extensions required are

  1. Yuki Ueda's R for language support
  2. REditorSupport's R LSP Client

Also, in order to R LSP Client to work, CRAN package {languageserver} is required.

Then, usage. If you're working functions, differently from RStudio in which one can hit ctrl+i and that'd indent that specifically line or selection, this solution works only if one selects the entire function. If you have functions inside another, you gotta indent everything (won't work for just a foo inside another).

Related