extensions
extensions copied to clipboard
R
Check for existing issues
- [X] Completed
Language
R
Tree Sitter parser link
https://github.com/r-lib/tree-sitter-r
Language server link
https://cran.r-project.org/web/packages/languageserver/index.html
Misc notes
R is usually written as standalone R scripts *.R files or as part of Markdown notebooks/reports (R Markdown) *.Rmd, where R code is embedded inside code blocks marked with {r}, e.g.:
```{r}
print("this is some R code")
```
Is there some way for community members to help in implementing this? I really like the editor and would like to use it more, but lack of language support is problem. E.g. I see that this is now classified as "potential plugin". Is there a plugin API yet?
Hey @tzakharko, thanks for reaching out. It's currently not possible for the community to extend Zed, but extensibility is on our radar. The potential plugin label is mostly for our own sake as it helps us see what the community is asking for. Unfortunately, I don't have any timeline at this point, but I'll make sure to leave an update whenever we've got something to share. 🙂
Thanks @hovsater! Keep up the good work! Looking forward to see what you will cook up!
rlang is a good keyword to mention for easier search than just "r"
Hi! I would like to work on this :)
for helix editor, there is some R language support perhaps we can use as reference to build R support in zed:
https://github.com/helix-editor/helix/tree/master/runtime/queries/r https://github.com/r-lib/tree-sitter-r
Hi all, R language support was merged as an extension in #100 and I just opened #656 which adds updated highlighting, outline, and LSP support.
Any suggestions or fixes very much welcomed!
I really like Zed, but as it stands, if I cannot run R code directly from the editor, I will probably prefer RStudio to Zed. RStudio allows for the current line to be executed with CMD+Enter, at which point the cursor moves to the next line.
@jtlandis these days I mostly use vscode R extension (https://github.com/REditorSupport/vscode-R ), which has really good evaluation/send code blocks to the terminal etc. Together with some keybindings, vscode/R can even mimics nvim-R keybindings.
I think the vscode R extension would be something that can used as a reference if such functionality would be implemented in zed - wondering if @ocsmit is interested at these?
I really like Zed, but as it stands, if I cannot run R code directly from the editor, I will probably prefer RStudio to Zed. RStudio allows for the current line to be executed with
CMD+Enter, at which point the cursor moves to the next line.
@jtlandis these days I mostly use vscode R extension (https://github.com/REditorSupport/vscode-R ), which has really good evaluation/send code blocks to the terminal etc. Together with some keybindings, vscode/R can even mimics nvim-R keybindings.
I think the vscode R extension would be something that can used as a reference if such functionality would be implemented in zed - wondering if @ocsmit is interested at these?
I fully agree with what has been said about eval/send-code functionality. I have been keeping an eye on the development of the core zed repo, but right now my understanding is there is not a sure fire way to send text to the integrated terminal (although I would love to be wrong!).
Actually, there is preliminary support for inline code execution through a Jupyter kernel with the REPL feature (https://github.com/ocsmit/zed-r/issues/1#issuecomment-2231811820). Just tested with the ark kernel and Zed Preview and works well! Thanks @rgbkrk for bringing to my attention!
For reference this what it looks like in the zed settings to enable. The Ark R-kernel will need to be installed following the instructions on their git page.
"jupyter": {
"enabled": true,
"kernels": {
"R": "ark"
}
}
Awesome! I've got some more fixes coming in for the REPL feature, keep the feedback coming with new issues!
@rgbkrk Just had a play with the repl using ark and there is a lot to like! Where is the best place to submit issues on this - in the /zed-industries/extensions repo or elsewhere? Thanks!
Hooray! Please report them to zed-industries/zed. There are some known things we will be unable to do (for now), which you can see in the two tracking issues covering Jupyter + Zed:
- https://github.com/zed-industries/zed/issues/9778
- https://github.com/zed-industries/zed/issues/13942
I’d like to bring to your attention two minor issues I encountered while working with Zed and R. Since I’m not entirely certain about the nature of the problem, I believe this thread is an appropriate forum to discuss it and gather more information.
-
I get auto-completion suggestions when writing comments, which can be a bit annoying, as I constantly have to press escape and pay attention to what is being emitted in the editor. Is this an issue with the language server or something within Zed itself? Note that I don't have this behavior working with other LSP-enabled editors like VSCode or Sublime using R's language server.
-
The R kernel appears to be localized in German for some reason? My machine's locale is set to en_US.UTF-8, so is R. Here is the locale output from the built-in Zed terminal running R:
> Rscript -e "Sys.getlocale()" [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8"and here the same from the R REPL within Zed
# %% Sys.getlocale() [1] C/en_US.UTF-8/C/C/C/CI get the correct locale when running an R kernel from Positron (which also uses ark). Any ideas what the issue might be?
I'd be very happy to contribute a patch, and I'd appreciate any leads as to what I should be looking at.
I get auto-completion suggestions when writing comments, which can be a bit annoying, as I constantly have to press escape and pay attention to what is being emitted in the editor.
That's either due to CoPilot/Supermaven (AI Completion) or the R extension https://github.com/ocsmit/zed-r.