r.md

 1# R
 2
 3R support is available through the [R extension](https://github.com/ocsmit/zed-r).
 4
 5- Tree-sitter: [r-lib/tree-sitter-r](https://github.com/r-lib/tree-sitter-r)
 6- Language-Server: [REditorSupport/languageserver](https://github.com/REditorSupport/languageserver)
 7
 8## Installation
 9
101. [Download and Install R](https://cloud.r-project.org/).
112. Install the R packages `languageserver` and `lintr`:
12
13```R
14install.packages("languageserver")
15install.packages("lintr")
16```
17
183. Install the [R Zed extension](https://github.com/ocsmit/zed-r) through Zed's extensions manager.
19
20For example on macOS:
21
22```sh
23brew install --cask r
24Rscript --version
25Rscript -e 'options(repos = "https://cran.rstudio.com/"); install.packages("languageserver")'
26Rscript -e 'options(repos = "https://cran.rstudio.com/"); install.packages("lintr")'
27Rscript -e 'packageVersion("languageserver")'
28Rscript -e 'packageVersion("lintr")'
29```
30
31## Ark Installation
32
33To use the Zed REPL with R you need to install [Ark](https://github.com/posit-dev/ark), an R Kernel for Jupyter applications.
34You can down the latest version from the [Ark GitHub Releases](https://github.com/posit-dev/ark/releases) and then extract the `ark` binary to a directory in your `PATH`.
35
36For example to install the latest non-debug build:
37
38```sh
39# macOS
40cd /tmp
41curl -L -o ark-latest-darwin.zip \
42    $(curl -s "https://api.github.com/repos/posit-dev/ark/releases/latest" | \
43    jq -r '.assets[] | select(.name | contains("darwin-universal") and (contains("debug") | not)) | .browser_download_url')
44unzip ark-latest-darwin.zip ark
45sudo mv /tmp/ark /usr/local/bin/
46```
47
48```sh
49# Linux X86_64
50cd /tmp
51curl -L -o ark-latest-linux.zip \
52    $(curl -s "https://api.github.com/repos/posit-dev/ark/releases/latest" \
53        | jq -r '.assets[] | select(.name | contains("linux-x64") and (contains("debug") | not)) | .browser_download_url'
54    )
55unzip ark-latest-linux.zip ark
56sudo mv /tmp/ark /usr/local/bin/
57```
58
59<!--
60TBD: R REPL Docs
61-->