fortls is an implementation of the Language Server Protocol (LSP) for Fortran, built with Python 3.7+. It provides rich editor features like code completion, diagnostics, hover information, and symbol navigation for Fortran code. The current version is 3.2.2. It maintains an active development pace with frequent updates and major releases, like v3.0.0 in May 2024, introducing significant changes and new features.
pip install fortlsVerified import paths — ran on the pinned version, not inferred.
fortls is a language server and is primarily used by code editors that support the Language Server Protocol (LSP). The quickstart demonstrates how to verify the `fortls` executable is installed and accessible. For most users, integration involves installing an editor extension (e.g., 'Modern Fortran' for VS Code) which then manages `fortls` automatically.
Review the official fortls documentation and changelog on GitHub for v3.0.0 and subsequent releases. Update editor configurations if necessary. Consider clearing any old configuration files like `.fortlsrc` if encountering issues.
Uninstall `fortran-language-server` before installing `fortls` (e.g., `pip uninstall fortran-language-server`). If both are installed, uninstall `fortran-language-server` and then reinstall `fortls` to ensure proper setup.
Manually add the `pip` scripts directory (e.g., `C:\Users\<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.<version>\LocalCache\local-packages\Python<version>\Scripts`) to your system's PATH environment variable, or explicitly configure the `fortls` executable path in your editor's settings (e.g., `"fortran.fortls.path": "C:\path\to\fortls.exe"` for VS Code).
To disable auto-updating, use the `--disable_autoupdate` command-line option when running `fortls`, or add `"disable_autoupdate": true` to your `.fortlsrc` configuration file.
Configure `fortls` with the `--nthreads` option to limit the number of threads used during initialization (default is 4). Exclude unnecessary directories and file types from parsing using `--excl_paths` and `--excl_suffixes` in the command line or `.fortlsrc` configuration file. If possible, upgrade server hardware or test with smaller subsets of the codebase.
Ensure `fortls` is installed in the active Python environment. Add the Python scripts directory (where `fortls.exe` is located) to your system's PATH. Alternatively, configure your editor to explicitly point to the `fortls` executable's full path.
First, ensure `fortran-language-server` is uninstalled. If the issue persists, try reinstalling `fortls` (`pip install fortls --upgrade`). Verify your project's `.fortlsrc` configuration file or editor settings (e.g., `source_dirs`, `include_dirs`, `pp_defs`) correctly point to your Fortran source files and necessary preprocessor definitions. Restart your code editor after making changes.
Limit the number of threads `fortls` uses for initialization with the `--nthreads` command-line option. Configure `.fortlsrc` or command-line arguments to exclude unnecessary directories (`--excl_paths`) or file types (`--excl_suffixes`) from being parsed. If possible, identify and isolate the problematic Fortran files or directories.
Currently, there is no direct fix within `fortls` for this specific limitation. Users should refer to the full documentation for overloaded procedures if the basic hover/signature help is insufficient. Keep `fortls` updated, as future releases might improve support.