-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework website to be easier to navigate
- Loading branch information
1 parent
bd7bec7
commit f4ba2c1
Showing
9 changed files
with
174 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: "RStudio" | ||
editor: | ||
markdown: | ||
wrap: sentence | ||
canonical: true | ||
--- | ||
|
||
RStudio does not support the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/), but you can still use Air as an *external formatter*. | ||
|
||
# Installation | ||
|
||
::: callout-note | ||
## Air is currently only supported on macOS and Windows. Linux support is coming soon! | ||
::: | ||
|
||
Ensure you have at least RStudio version 2024.12.0, which you can download from [here](https://posit.co/download/rstudio-desktop/). | ||
Additionally, you'll need to install the Air [command line tool](cli.qmd). | ||
|
||
Open `Tools -> Global Options -> Code` and change the option to use an `External` formatter. | ||
Then set the `Reformat command` to {`path/to/air} format`. | ||
|
||
The easiest way to figure out `{path/to/air}` for yourself is to run `which air` from a Terminal on Unix, and `where air` from the Command Prompt on Windows. | ||
|
||
![](./images/rstudio-external-formatter.png){fig-alt="Setting Air as an external formatter with Tools -> Global Options -> Code -> Formatting" fig-align="center"} | ||
|
||
# Features | ||
|
||
## Format on save | ||
|
||
After you've set Air as an external formatter, you can either tell RStudio to format all documents on save, or set this on a per document basis. | ||
|
||
To format all documents on save, open `Tools -> Global Options -> Code -> Saving` and check `Reformat documents on save`. | ||
|
||
![](images/rstudio-format-on-save.png){fig-alt="Setting RStudio to format all documents on save in Tools -> Global Options -> Code -> Saving" fig-align="center"} | ||
|
||
To format individual documents on save, open the file specific settings and check `Reformat Document on Save`. | ||
|
||
![](images/rstudio-reformat-document-on-save.png){fig-align="center"} | ||
|
||
<!--# Come back and add video of formatting in action --> | ||
|
||
## Quarto | ||
|
||
There is currently no way to use Air in RStudio with Quarto documents. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
title: "VS Code and Positron" | ||
editor: | ||
markdown: | ||
wrap: sentence | ||
canonical: true | ||
--- | ||
|
||
Air provides first class support for both VS Code and Positron, which both support the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/). | ||
|
||
# Installation | ||
|
||
::: callout-note | ||
## Air is currently only supported on macOS and Windows. Linux support is coming soon! | ||
::: | ||
|
||
Air is available [as an Extension](https://marketplace.visualstudio.com/items?itemName=Posit.air-vscode) for both VS Code and Positron. | ||
The extension comes pre-bundled with an Air binary, so you don't need anything else to get going! | ||
The Air extension is hosted in the VS Code Marketplace and on OpenVSX. | ||
|
||
# Features | ||
|
||
## Format on save | ||
|
||
Once you have the extension installed, turn on Format on Save for R documents by opening your `settings.json` and adding: | ||
|
||
``` json | ||
{ | ||
"[r]": { | ||
"editor.formatOnSave": true | ||
} | ||
} | ||
``` | ||
|
||
You should now be able to simply open an R document, save it, and have the entire document formatted by Air. | ||
You can also explicitly call the command `Format Document` if you'd like to control this manually. | ||
|
||
<!--# Come back and add video --> | ||
|
||
## Format selection | ||
|
||
To format a selection of code, highlight it with your cursor and run the command `Format Selection`. | ||
Formatting a selection may *expand* that selection to find the nearest complete fragment of code that is formattable. | ||
|
||
<!--# Come back and add video --> | ||
|
||
## Quarto | ||
|
||
Quarto support currently only works in VS Code. | ||
There is an [issue](https://github.com/posit-dev/air/issues/77) in VS Code itself that currently prevents it from working correctly in Positron, we will fix this in Positron soon. | ||
|
||
### Format on save | ||
|
||
To format all R code cells on save, set this in your `settings.json`: | ||
|
||
``` json | ||
{ | ||
"[quarto]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"[r]": { | ||
"editor.formatOnSave": true | ||
} | ||
} | ||
``` | ||
|
||
<!--# Come back and add video --> | ||
|
||
### Format cell | ||
|
||
When inside an R cell in a Quarto document, use the chorded key combination `Cmd+K Cmd+F` or the command `Quarto: Format Cell` to format a single cell. | ||
|
||
<!--# Come back and add video --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.