roaldarbol / r-template

🚀 Pixi Template for R
1 stars 0 forks source link

VS Code R discovery #4

Closed roaldarbol closed 2 months ago

roaldarbol commented 2 months ago

So an annoying issue is discovering Pixi R interpreters in VS Code. I don't know if there's a current solution - the R extension expects a single installation, there's rig, but no good solutions for project-wise installations at present. I've also got an issue following this for Positron: https://github.com/posit-dev/positron/issues/3724

roaldarbol commented 2 months ago

Maybe some useful info here:

So R paths can possibly be specified inside a settings.json file, which then serve as Workspace Settings.

roaldarbol commented 2 months ago

@robinlovelace-ate This is somewhat resolved now! I've added a workspace settings file that automatically uses the R installation of the current project. I don't have a Linux station nearby (and it's been a while); how would you normally open VS Code from the command line on Linux? I've added a task to open it for MacOS (see the pixi.tomlfile), so can easily make a task for Linux too. :-)

On Mac, now you can use the template and simply run pixi run code and VS Code opens - it's got radian, httpgd and languageserver, so the setup should work well now!

Just a note - there's no API for managing extensions yet (I'll add a link to the relevant vscode issue later), so you'll need to install extensions manually (e.g. Quarto).

I'll also change later to ask about which setup people will use (RStudio, VS Code, Jupyter). Or at least whether or not to install Jupyter as it's quite big.

Let me know if it works!

roaldarbol commented 2 months ago

The discovery doesn't work for VS Codium - need to figure out what that's about.

robinlovelace-ate commented 2 months ago

how would you normally open VS Code from the command line on Linux?

code path/to/project

Or via GitHub codespaces.

robinlovelace-ate commented 2 months ago

The discovery doesn't work for VS Codium - need to figure out what that's about.

No issue for now as I'm mostly using VS Code.

robinlovelace-ate commented 2 months ago

On Mac, now you can use the template and simply run pixi run code and VS Code opens - it's got radian, httpgd and languageserver, so the setup should work well now!

Bingo, that sounds really good, and kind of wondering why I didn't think of that!

robinlovelace-ate commented 2 months ago

Just a note - there's no API for managing extensions yet (I'll add a link to the relevant vscode issue later), so you'll need to install extensions manually (e.g. Quarto).

That can be handled by the devcontainer.json file when using the wonderful devcontainer setup for Dockerised VS Code.

roaldarbol commented 2 months ago

I think this is now resolved - for opening in a Docker container, if you can provide me with a minimal devcontainer.json and let me know if it needs to go in a specific folder I can add that too. :-)

robinlovelace-ate commented 2 months ago

OK awesome, thanks @roaldarbol, will cc in my main account also @robinlovelace.