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
Install the Modern Fortran pre-release
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.
Hello. I was having the same problem as @Or123 and, after searching a lot and trying different things, I found out that the problem for my setup was the python version. In the cluster I work at, the latest version of python was 3.6.8. Then I saw @gnikit mentioned in a stackoverflow post that python 3.6 was not supported anymore. Thus it occurredd to me to locally update the python version of my user account. I used pyenv to install python 3.9.21 (the latest one that worked on my environement), then I installed fortls from this python version. Now Modern Fortran was able to find the executable, and didn’t complain about features of the version. Everything is working fine.
I hope this can help anyone with a similar problem.