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

Connect local Positron IDE to Gitpod via SSH? #193

Open
hturner opened this issue Sep 5, 2024 · 3 comments
Open

Connect local Positron IDE to Gitpod via SSH? #193

hturner opened this issue Sep 5, 2024 · 3 comments

Comments

@hturner
Copy link
Member

hturner commented Sep 5, 2024

The Positron IDE has experimental support for remote SSH sessions.

Meanwhile Gitpod has support to connect an IDE/editor via SSH.

So does this mean we can connect a local Positron IDE to our Gitpod workspace?

@hturner hturner changed the title Connect local Positron to Gitpod via SSH? Connect local Positron IDE to Gitpod via SSH? Sep 5, 2024
@lyashevska
Copy link

We have tried to achieve this functionality in several ways.

Via vscode.

  1. Create a gitpod workspace for a given repository.
  2. Install 'Gitpod' extension in vscode
  3. Sign in via extension to gitpod account
  4. A list of workspace will be available.
  5. Pick one and connect.
  6. Worked as expected.

Via Terminal.

  1. Select 'Connect via ssh' and copy
  2. Connect via terminal.
  3. Worked as expected.

Via Positron

  1. Create a gitpod workspace for a given repository.
  2. Install 'Gitpod' extension in vscode
  3. Sign in via extension to gitpod account
  4. 'Bad request' error
  5. Did not work.

We think that there is a problem between gitpod API and positron. This is need some further investigation.

@hturner
Copy link
Member Author

hturner commented Sep 30, 2024

Thanks for investigating this. To give a bit more info on the 'Connect via ssh' method:

  1. Start the Dev Container as a Gitpod workspace.
  2. From https://gitpod.io/workspaces, click on the three dots next to the workspace to expand the menu, select Connect via SSH. If necessary set up an SSH key. Copy the command, something like (modified from actual!):
    ssh 'rdevel-rdevenv-13ik2dk36zo@rdevel-rdevenv-13ik2dk36zo.ssh.ws-eu116.gitpod.io'
    Run this command from the terminal.

There are a couple of options based on the SSH method that could work:

  1. Connect to Gitpod via SSH from the terminal in Positron. A quick trial shows that this connects to the workspace folder /workspace/r-dev-env, but the environment variables are set wrong (e.g. BUILDDIR="/home/gitpod/build/r-devel" vs BUILDDIR = "/workspace/r-dev-env/build/r-devel". Also as we only have access through the terminal, the remote folder is not opened in the Positron explorer, I'm not sure how to work with files locally...this is probably not what we want.

  2. Connect to Gitpod from Positron via Remote SSH. In other words:

    • In Positron Settings, search "remote host" and check the box under "Positron: Remote Host Experimental".
    • From the command palette, select Remote-SSH: Connect to Host. When prompted, enter the user@hostname in the SSH command copied from Gitpod, e.g.
      rdevel-rdevenv-13ik2dk36zo@rdevel-rdevenv-13ik2dk36zo.ssh.ws-eu116.gitpod.io
    • From the explorer, select Open folder, when prompted, enter workspace/r-dev-env. The environment variables are set as expected and the remote folder opens as a usual folder, so we can easily open the remote files

The second option seems promising! The scripts to update R won't work as Positron doesn't use an R terminal the same way as VS code. Some open questions:

  1. Can we open straight in the correct folder?
  2. How much of the tutorials will still work?
  3. Assuming we can build R, is there a way we can get Positron to find it, to run in the Positron console?

The last question is the most crucial for us to be able to make this a user-friendly option. But it could still be interesting to be able to build R in the terminal and work with the built R there, whilst being able to edit test/source files in Positron.

@savsch
Copy link

savsch commented Mar 20, 2025

Some open questions:

1. Can we open straight in the correct folder?

@hturner Yes:

$ positron --folder-uri "vscode-remote://ssh-remote+rdevel-rdevenv-xyzxyzxyzxy@rdevel-rdevenv-xyzxyzxyzxy.ssh.ws-us999.gitpod.io/workspace/r-dev-env"

This allows opening straight in the correct folder. Note that the ssh-remote+ part of the uri needs to be included verbatim, so the URI syntax is vscode-remote://ssh-remote+<user@hostname>/workspace/r-dev-env. So the environment variables are set as expected (i.e. TOP_SRCDIR=/workspace/r-dev-env/svn/r-devel and so on).

Here is the discussion about making this happen directly from the GUI (without resorting to configuring settings.json which imo is a more tedious solution than just using the cli), but it hasn't been implemented yet.


2. How much of the [tutorials](https://contributor.r-project.org/r-dev-env/tutorials/running_r/) will still work?

Much of it, I believe.

I was able to build R by simply following Building R.

However, the part about R: (not attached) (in Running R) doesn't work as the R extension isn't installed or used by positron. For the same reason, the which_r script (which is made for that extension) seems to have no effect. So the next question follows:

3. Assuming we can build R, is there a way we can get Positron to find it, to run in the Positron console?

Building R is possible (as mentioned above). However, I am yet to figure out a way to get Positron to find it and run it in the console.

Update: I found a couple of settings: positron.r.customRootFolders and positron.r.customBinaries which influence the "R: Select Interpreter" command palette option (and thus the positron console)).

Using "positron.r.customBinaries": ["/workspace/r-dev-env/build/r-devel/bin/R"] makes it possible to run the built R binary in the positron console, but it only ended up in failure for me (tried a bunch of recent revisions).

Image

The The process exited abnormally (signal: 6 (SIGABRT)) shows up in Positron console even though the binary runs fine in the terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants