"Native" language support for R? #25758
Replies: 2 comments 4 replies
-
In my view, natively supporting R in Zed presents some challenges. The primary hurdle is that the only Language Server Protocol (LSP) available for R is the 'languageserver' package, which inherently depends on R itself. This means that, unlike Pyright for Python, the 'languageserver' cannot operate independently. Additionally, R lacks the capability to create a virtual environment to run the 'languageserver', like py-lsp for Python. |
Beta Was this translation helpful? Give feedback.
-
We're not looking to add additional languages to the core supported set at this time. Although languages included in core are slightly more performant (tree-sitters compile to native code instead of wasm) this comes at the expense of increased compile times, increased code size in the editor binary and additional staff time reviewing PRs with any changes. But I think the broader question you're asking is valid. You're providing an language server for files in Zed with |
Beta Was this translation helpful? Give feedback.
-
We've just recently added support for Air a very fast R code formatter (similar to Ruff and Biome), as a language server Zed extension. zed-industries/extensions#2128
I'm also the maintainer of tree-sitter-r.
Our Air users noticed that you need the R Zed extension for Zed to recognize R files so it can call Air on them
posit-dev/air#252 (comment)
That's this extension https://github.com/ocsmit/zed-r, which contributes both:
I wanted to ask and see if the Zed devs would be open to having R language support natively supported in Zed itself.
I see the list of natively supported languages here:
https://github.com/zed-industries/zed/tree/main/crates/languages/src
And I see how you register a native tree-sitter language here:
zed/crates/languages/src/lib.rs
Line 54 in 5c400da
And how you register varying amounts of native language support here:
zed/crates/languages/src/lib.rs
Lines 162 to 169 in 5c400da
I believe I'm just advocating for
language!("r")
here - it's likely fine for extensions to provide language servers and other tools, but it would be great if native Zed could recognize and highlight R files without any additional support.It currently feels like overkill to install https://github.com/ocsmit/zed-r and get both R language support and a full R language server, just to be able to run the Air extension. It is also likely that Air itself will eventually provide other language server features beyond just formatting in the future, in which case it would be nice for users to have a way to not get the language server that currently comes from zed-r.
If native R language support sounds okay to you all, I can probably do most of the work for it when I get some time over the next month or two.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions