Hello all,
Across multiple platforms (Windows, WSL2 Ubuntu, and Ubuntu via SSH), I have consistently struggled to set up Modern Fortran in VSCode. On all platforms, I install fortls as per the instructions, and then install the extension, but it is never able to find the installation for fortls. I always get a notification from the extension to install fortls. At first, I thought it was an issue with my environment, but after experiencing this in three separate environments, I’m starting to think it isn’t just me. Any help would be appreciated, because I still can’t figure this out.
5 Likes
Check that fortls is in your $PATH by running fortls --version in a terminal. Depending on how you install it, this might not happen automatically (for example, if you pip install fortls, it usually puts it in ~/.local/bin, which is not in your $PATH by default).
If you get something like command not found, then you’ll need to do one of two things:
- Find where
fortls has been installed and put that in your $PATH (usually by adding a line like PATH=/directory/containing/fortls/:$PATH in your ~/.bashrc)
- Or manually set
fortran.fortls.path in VS Code to your full path to fortls
If fortls is in your $PATH, then that sounds like a bug and you should open an issue on the Modern Fortran repo
1 Like