Modern Fortran fortls error in ssh

So, I have a maybe unique setup: I use a Windows computer and ssh to a Linux machine (for which I have limited permissions, for example I don’t have sudo). I use the ssh extension in vscode to access files on the ssh machine and have the Modern Fortran extension installed there too. I am struggling to make fortls work. I get the usual fortls errors. I tried putting the fortls PATH in both my Windows machine and the Linux machine, and I tried to edit the fortls path in the extension in all possible permutations, but nothing seems to work. If someone has experience with this combo or has some advice, I’d be happy to try anything.

(p.s. I have a local python 3.11 installed on the Linux machine, but there are other python versions. For example, if I type $python I’d get the 2.7.5 python. Also, when I first open a f90 file the extension suggests installing fortls and installs fortls 2.1. On my windows pc I have fortls 2.13 from anaconda. Not sure how important that is).

Welcome @Or123. I have used a similar set up in the past. The only settings that matter when you using the Remote SSH extension or Remote Tunnels is in your host i.e. the Linux machine.

Can you try the following

  1. Install the Modern Fortran pre-release
  2. In your Linux machine install with python3 -m pip install --user fortls --upgrade and make a note where is fortls installed. By default the path is ~/local/bin/fortls (for the vscode settings I think you need to expand the ~ to /home/USERNAME.

Also post the:

  • version of VS Code being used
  • version of Modern Fortran extension (should be the latest pre-release)
  • VS Code settings for Modern Fortran in JSON format from the Linux machine

Hey, thanks! It seems that the problem was actually the fortls version. For whatever reason, neither pip nor pip3 gave me the correct one - I had to boot into an anaconda env and only then pip worked. Can’t tell you what happened there, but your advice that it’s only about the host helped a lot.