"Had trouble installing fortls, please install manually"

Hi @seme4ka008, welcome.

Please follow these steps mentioned on the Modern Fortran- VSCode pageModern Fortran- Visual Studio

Here are possible steps, which you should follow (copying text from the page mentioned above):

  1. Allow for fortls to be automatically installed with pip or Anaconda and if the location where fortls is installed is not in your PATH point VS Code to the fortls location by setting
{
  "fortran.fortls.path": "/custom/path/to/fortls"
}
  1. Linting: may be you can safely ignore if you are using gfortran.

By default, the linter used is gfortran, Intel’s ifort and Intel’s LLVM based compiler ifx are also supported. One can use a different linter compiler via the option

{
  "fortran.linter.compiler":  "ifx/gfortran"
}
  1. Debugging: The extension uses the debugger from Microsoft’s C/C++ extension for Visual Studio Code. This allows this extension to use the full functionality of the C/C++ extension for debugging applications.

Therefore C/C++ extensions are necessary.

  1. Formatting:

Two formatters are supported findent and fprettify. Both of them can be installed with pip automatically through the extension.

The formatter is controlled by the user option

{
  "fortran.formatting.formatter": "findent" | "fprettify" | "Disabled"
}

In nutshell, you need to install ifortls and fprettify/findent though conda or pip.

For fortls:

With pip

pip uninstall fortran-language-server
pip install fortls --upgrade

or with Anaconda

conda uninstall fortran-language-server
conda install -c conda-forge fortls

for fprettify:

pip install fprettify

conda install -c programfan fprettify

Hope this helps. Good luck!!

1 Like