Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R #157

Closed
1 task done
mr-mobster opened this issue Mar 10, 2023 · 17 comments
Closed
1 task done

R #157

mr-mobster opened this issue Mar 10, 2023 · 17 comments
Labels
language A request to add a language extension

Comments

@mr-mobster
Copy link

mr-mobster commented Mar 10, 2023

Check for existing issues

  • 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")
```
@mr-mobster mr-mobster added the language A request to add a language extension label Mar 10, 2023
@JosephTLyons JosephTLyons changed the title Add support for R language for statistical computing R support Apr 6, 2023
@tzakharko
Copy link

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?

@hovsater
Copy link

hovsater commented May 5, 2023

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. 🙂

@tzakharko
Copy link

Thanks @hovsater! Keep up the good work! Looking forward to see what you will cook up!

@jangorecki
Copy link

rlang is a good keyword to mention for easier search than just "r"

@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
@doriancodes
Copy link

Hi! I would like to work on this :)

@JosephTLyons JosephTLyons changed the title R support R Feb 26, 2024
@JosephTLyons JosephTLyons transferred this issue from zed-industries/zed Feb 26, 2024
@JosephTLyons JosephTLyons mentioned this issue Feb 19, 2024
Closed
1 task
@ipstone
Copy link

ipstone commented Apr 1, 2024

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

@ocsmit
Copy link
Contributor

ocsmit commented Apr 30, 2024

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!

@jtlandis
Copy link

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.

@ipstone
Copy link

ipstone commented Jun 11, 2024

@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?

@JosephTLyons
Copy link
Collaborator

SCR-20240716-lzmm

@ocsmit
Copy link
Contributor

ocsmit commented Jul 17, 2024

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!).

@ocsmit
Copy link
Contributor

ocsmit commented Jul 17, 2024

Actually, there is preliminary support for inline code execution through a Jupyter kernel with the REPL feature (ocsmit/zed-r#1 (comment)). 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"
    }
  }

@rgbkrk
Copy link
Member

rgbkrk commented Jul 17, 2024

Awesome! I've got some more fixes coming in for the REPL feature, keep the feedback coming with new issues!

@h-a-graham
Copy link

@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!

@rgbkrk
Copy link
Member

rgbkrk commented Jul 18, 2024

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:

@tzakharko
Copy link

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.

  1. 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.

  2. 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/C
    

    I 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.

@rgbkrk
Copy link
Member

rgbkrk commented Aug 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language A request to add a language extension
Projects
None yet
Development

No branches or pull requests