From 08be5965063fd3d335dcadd25b141fedea6dd7ad Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Wed, 30 Apr 2025 14:25:53 -0400 Subject: [PATCH 1/2] Add documentation on how to use Air in Zed --- CHANGELOG.md | 2 ++ docs/_quarto.yml | 3 +- docs/editor-zed.qmd | 81 +++++++++++++++++++++++++++++++++++++++++++++ docs/editors.qmd | 2 ++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 docs/editor-zed.qmd diff --git a/CHANGELOG.md b/CHANGELOG.md index e9f46c18..57b910d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ # Development version +- Added documentation on using Air in [Zed](https://github.com/zed-industries/zed). + # 0.5.0 diff --git a/docs/_quarto.yml b/docs/_quarto.yml index fb85761e..5780aff7 100644 --- a/docs/_quarto.yml +++ b/docs/_quarto.yml @@ -25,8 +25,9 @@ website: - section: "Editors" href: editors.qmd contents: - - editor-rstudio.qmd - editor-vscode.qmd + - editor-rstudio.qmd + - editor-zed.qmd - editor-neovim.qmd - editor-helix.qmd diff --git a/docs/editor-zed.qmd b/docs/editor-zed.qmd new file mode 100644 index 00000000..52e207db --- /dev/null +++ b/docs/editor-zed.qmd @@ -0,0 +1,81 @@ +--- +title: "Zed" +editor: + markdown: + wrap: sentence + canonical: true +--- + +[Zed](https://github.com/zed-industries/zed) is a collaborative editor with an extension system and builtin support for the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/). + +# Installation + +To use Air in Zed, you currently need to install the following two Zed extensions by running the command `zed: extensions`: + +- `R` + + - Adds *language* support for R, teaching Zed about R file types, syntax highlighting, and other basic editor capabilities. + This is required for Zed to detect R files and call Air on them. + + - Adds *language server* support for R, backed by the [`languageserver`](https://github.com/REditorSupport/languageserver) R package. + This is turned on by default, but is optional if you just want to use Air. + The languageserver package provides a more comprehensive language server than Air. + While Air's language server is currently focused on formatting, this also provides help, go to definition, and other nice features. + +- `Air` + + - Adds *language server* support for R, backed by Air. + The Air language server is primarily used for document formatting. + +You won't need to install the Air command line tool - the Zed extension will download it for you as needed. + +To configure Zed to use the Air language server to format R files, add the following to your Zed `settings.json`: + +``` json +{ + "languages": { + "R": { + "language_servers": ["air"] + } + } +} +``` + +If you'd like to also use [`languageserver`](https://github.com/REditorSupport/languageserver) through the Zed R extension, use the following configuration: + +``` json +{ + "languages": { + "R": { + "language_servers": ["air", "r_language_server"] + } + } +} +``` + +::: callout-caution +## It's important that `"air"` is provided before `"r_language_server"`, otherwise Air won't get formatting requests! +::: + +If you use `"r_language_server"`, note that languageserver provides on-type formatting support. +Notably, it will automatically break pipe chains of \>1 pipe over multiple lines when you type a closing `)`. +If you don't want this and would like Air to be fully in charge of formatting, then use this configuration: + +``` json +{ + "languages": { + "R": { + "language_servers": ["air", "r_language_server"], + "use_on_type_format": false + } + } +} +``` + +# Features + +## Format on save + +The Zed setting `format_on_save` is `"on"` by default, so there is no additional configuration required to get Zed to format your R files on save using Air. + + diff --git a/docs/editors.qmd b/docs/editors.qmd index d63c55b7..16a7d778 100644 --- a/docs/editors.qmd +++ b/docs/editors.qmd @@ -17,6 +17,8 @@ Follow one of our editor specific guides to get set up with Air in your preferre - [RStudio](editor-rstudio.qmd) +- [Zed](editor-zed.qmd) + - [Neovim](editor-neovim.qmd) - [Helix](editor-helix.qmd) From 8d25974e0e4a673357f464a32509025d839cd5ef Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Thu, 1 May 2025 14:35:40 -0400 Subject: [PATCH 2/2] Update docs/editor-zed.qmd Co-authored-by: Lionel Henry --- docs/editor-zed.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/editor-zed.qmd b/docs/editor-zed.qmd index 52e207db..174d0145 100644 --- a/docs/editor-zed.qmd +++ b/docs/editor-zed.qmd @@ -20,7 +20,7 @@ To use Air in Zed, you currently need to install the following two Zed extension - Adds *language server* support for R, backed by the [`languageserver`](https://github.com/REditorSupport/languageserver) R package. This is turned on by default, but is optional if you just want to use Air. The languageserver package provides a more comprehensive language server than Air. - While Air's language server is currently focused on formatting, this also provides help, go to definition, and other nice features. + While Air's language server is currently focused only on formatting, languageserver also provides help, go to definition, and other nice features. - `Air`