Skip to main content

fortls - Fortran Language Server

Project description


fortls - Fortran Language Server

PyPI PyPI - Python Version PyPi Downloads via PePy Conda GitHub License GitHub Workflow Status (branch) GitHub Workflow Status (branch) Codecov Code style: black GitHub Repo stars


fortls is an implementation of the Language Server Protocol (LSP) for Fortran using Python (3.7+).

All code editors that support LSP can integrate with fortls see the section Editor Integration in the documentation. Some supported code editors include: Visual Studio Code, Atom, Sublime Text, (Neo)Vim, and Emacs.


  • Project-wide and Document symbol detection and Renaming
  • Hover support, Signature help and Auto-completion
  • GoTo/Peek implementation and Find/Peek references
  • Preprocessor support
  • Documentation parsing (Doxygen and FORD styles)
  • Access to multiple intrinsic modules and functions
    • ISO_FORTRAN_ENV GCC 11.2.0
    • IOS_C_BINDING GCC 11.2.0
    • OpenMP OMP_LIB, OMP_LIB_KINDS v5.0
  • Diagnostics
    • Multiple definitions with the same variable name
    • Variable definition masks definition from parent scope
    • Missing subroutine/function arguments
    • Unknown user-defined type used in TYPE/CLASS definition (only if visible in project)
    • Unclosed blocks/scopes
    • Invalid scope nesting
    • Unknown modules in USE statement
    • Unimplemented deferred type-bound procedures
    • Use of non-imported variables/objects in interface blocks
    • Statement placement errors (CONTAINS, IMPLICIT, IMPORT)
  • Code actions
    • Generate type-bound procedures and implementation templates for deferred procedures


  • Signature help and hover does not handle elegantly overloaded functions i.e. interfaces

fortls vs fortran-language-server

This project was originally based on fortran-language-server LSP implementation, but the two projects have since diverged.

fortls (this project) is now developed independently of the upstream hansec/fortran-language-server project and contains numerous new features and bug fixes the original fortran-language-server does not.

For a complete and detailed list of the differences between the two Language Servers see the Documentation section: Unique fortls features (not in fortran-language-server)

The name of executable for this project has been chosen to remain fortls to allow for integration with pre-existing plugins and workflows, but it could change in the future.



pip install fortls


conda install -c conda-forge fortls

for more information about the Anaconda installation see

Common installation problems

It is NOT recommended having fortls and fortran-language-server simultaneously installed, since they use the same binary name. If you are having trouble getting fortls to work try uninstalling fortran-language-server and reinstalling 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


fortls can be configured through both the command line e.g. fortls --hover_signature or through a Configuration json file. The two interfaces are identical and a full list of the available options can be found in the Documentation or through fortls -h

An example for a Configuration file is given below

  "incremental_sync": true,
  "lowercase_intrinsics": true,
  "hover_signature": true,
  "use_signature_help": true,
  "excl_paths": ["tests/**", "tools/**"],
  "excl_suffixes": ["_skip.f90"],
  "include_dirs": ["include/**"],
  "pp_suffixes": [".F90", ".h"],
  "pp_defs": { "HAVE_HDF5": "", "MPI_Comm": "integer" }

Implemented server requests

Request Description
workspace/symbol Get workspace-wide symbols
textDocument/documentSymbol Get document symbols e.g. functions, subroutines, etc.
textDocument/completion Suggested tab-completion when typing
textDocument/signatureHelp Get signature information at a given cursor position
textDocument/definition GoTo definition/Peek definition
textDocument/references Find all/Peek references
textDocument/documentHighlight Same as textDocument/references
textDocument/hover Show messages and signatures upon hover
textDocument/implementation GoTo implementation/Peek implementation
textDocument/rename Rename a symbol across the workspace
textDocument/didOpen Document synchronisation upon opening
textDocument/didSave Document synchronisation upon saving
textDocument/didClose Document synchronisation upon closing
textDocument/didChange Document synchronisation upon changes to the document
textDocument/codeAction Experimental Generate code


This project would not have been possible without the original work of @hansec in fortran-language-server

Bug reports

When filing bugs please provide example code to reproduce the observed issue.

Security Policy

To report a security vulnerability please follow the instructions in our Security page.


This project is made available under the MIT License.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fortls-2.13.0.tar.gz (6.9 MB view hashes)

Uploaded source

Built Distribution

fortls-2.13.0-py3-none-any.whl (92.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page