I am trying to use Remote Development using SSH with PlatformIO IDE. Remote Development using SSH is a preview feature, but would be great if this would work in the future.
https://code.visualstudio.com/docs/remote/ssh
I followed Scott Hanselman's blog to set up my environment, https://www.hanselman.com/blog/VisualStudioCodeRemoteDevelopmentOverSSHToARaspberryPiIsButter.aspx
My use case is I want to develop for the Raspberry PI using C/C++ and to use the awesome Platform IO to managed dependencies and build process.
PlatformIO IDE: 1.8.1

Could you run in this RPi terminal $ pio home --no-open? Do you see any errors?
There are no errors. I get
/\-_--\ PlatformIO Home
/ \_-__\
|[]| [] | http://127.0.0.1:8008
|__|____|_______________________
Open PIO Home in your browser by this URL => http://127.0.0.1:8008
PIO Home has been started. Press Ctrl+C to shutdown.

I had the window open since I took the screen shot above and the PIO Home screen and libraries show up...
Ah, yes! It will not work. You run PIO Home Server on the remote machine via SSH where PIO Home Backend points to localhost. You can open PIO Home in your standalone browser via http://your-rpi-ip:8008.
Is there any way to have the window in visual studio code point to a remote adress? This is also an issue when using Remote Developent through for example code-server
I'm having the same problem when trying to get it to work on the Raspberry Pi.

The PIO home page never loads and I get this error:

I also noticed the C/C++ extension that PIO depends on throws an error saying ARM is not supported:

Any fix for this?
As a workaround for the connection issue adding this to the ssh_config seems to work:
LocalForward 127.0.0.1:8010 127.0.0.1:8010
However, when i created a new Project named 'bpTest' it was created as ~/Documents/PlatformIO/Projects\bpTest where Projects\bpTest is a folder name.
Also C/C++ problem highlighting does not work.
So there is more to it than setting up port forwardung...
Edit:
After fixing the path manually C/C++ problem highlighting works and I cant find any other issue.
As a workaround for the connection issue adding this to the ssh_config seems to work:
LocalForward 127.0.0.1:8010 127.0.0.1:8010However, when i created a new Project named 'bpTest' it was created as
~/Documents/PlatformIO/Projects\bpTestwhereProjects\bpTestis a folder name.Also C/C++ problem highlighting does not work.
So there is more to it than setting up port forwardung...
Edit:
After fixing the path manually C/C++ problem highlighting works and I cant find any other issue.
I didn't have any ssh problems, but could you please elaborate on how you fixed the path manually? And is this on an ARM architecture (such as the raspberry pi)? Thanks.
Thx @VishalDhayalan.
Works for me :).
In your ssh/config file, The description of your remote, you add the line from @VishalDhayalan :
LocalForward 127.0.0.1:8010 127.0.0.1:8010
It'll forward the port between your host and remote. So VScode will displayed on localhost:8010 the localhost:8010 of your VM.
Sadly, the window appear.
But when I want to import a arduino project.
I can't display my folder tree than one level.
$ ls -l workspace/
drwxrwxr-x 7 vagrant vagrant 4096 Feb 6 19:20 ESP32
drwxrwxr-x 9 vagrant vagrant 4096 Feb 22 12:28 MQTTnet
Even If I want to see the content of folder in /tmp, doesn't work.
If I open the webpage from host webbrowser it doesn't work.
But If I open the webpage on guest webbrowser, it works
After searching, I found this : https://docs.platformio.org/en/latest/userguide/cmd_home.html#cmd-home
Default host option is 127.0.0.1. So if you want used with outbound connection, you have to put 0.0.0.0. I tried launching this command :
pio home --host 0.0.0.0 --no-open
Now I can open the webpage with host webbrowser.
But I have the same problem with the vscode image. I can't display my folder tree.
I can't open project. Maybe a Windows/Linux path problem.
Error: {'code': -32000, 'message': 'Server error', 'data': {'type': 'FileNotFoundError', 'args': (2, 'No such file or directory'), 'message': "[Errno 2] No such file or directory: '/home/vagrant/Documents/PlatformIO/Projects/200303-200258-esp32dev\\\\platformio.ini'"}}
API Exception: {'type': 'FileNotFoundError', 'args': (2, 'No such file or directory'), 'message': "[Errno 2] No such file or directory: '/home/vagrant/Documents/PlatformIO/Projects/200303-200258-esp32dev\\\\platformio.ini'"}
Here my path :
鈺扳攢 ll ~/Documents/PlatformIO/Projects/200303-200258-esp32dev/
total 20K
drwxrwxr-x 2 vagrant vagrant 4.0K Mar 3 20:02 include
drwxrwxr-x 2 vagrant vagrant 4.0K Mar 3 20:02 lib
-rw-rw-r-- 1 vagrant vagrant 440 Mar 3 20:04 platformio.ini
drwxrwxr-x 2 vagrant vagrant 4.0K Mar 3 20:02 src
drwxrwxr-x 2 vagrant vagrant 4.0K Mar 3 20:02 test
Hello again,
I think I found the problem :)
So a summarize.
I run vscode on windows host with remote ssh extension on a linux guest.
platformio extension is installed on guest.
After adding the port forwarding to my ssh config.
(To make it work, we can launch pio with --host 0.0.0.0 to accept outbound config)
I have the page but I can't navigate in my file system.
For me it's a problem of Windows/Linux useragent problem.
What are my tests.
I launch a new instance of pio on my guest
pio home --host 0.0.0.0 --port 8008 --no-open
I launch firefox on my host with guest ip. Same problem than vscode.
But if I launch firefox on an other linux computer. Navigation works and folder creation too. Miracle :)
I tried to install an extension on firefox to change useragent.
The goal is to send an useragent with linux OS with my firefox on windows.
I use the useragent modifier extension below. Change the useragent in the websocket connection and it works.
https://add0n.com/useragent-switcher.html?version=0.3.4&type=install
Now I don't know how to update vscode to change the user agent and the impact for this app
Another issue in remote-SSH is that PIO Home --> New Project is showing host filesystem, not guest filesystem.
However, when i created a new Project named 'bpTest' it was created as
~/Documents/PlatformIO/Projects\bpTestwhereProjects\bpTestis a folder name.
I do not exactly know what causes this. After looking a bit in the source code I was however able to find some places where we use the native fs module instead of the one provided by the VSCode API. This _may_ lead to such problems. Even if it does not lead to problems the usage of the native module is discouraged anyways as it apparently runs in the editor process unlike most other stuff accessible over the vscode api. Currently I do not have a remote machine setup with which I could test this but I may be able to in a few days...
Most helpful comment
Is there any way to have the window in visual studio code point to a remote adress? This is also an issue when using Remote Developent through for example code-server