Fortran development in Visual Studio Code

Visual Studio Code is a free open source code editor with numerous extensions supporting most code languages, including for proprietary languages like Matlab. Fortran is well-supported by Visual Studio Code using the Modern Fortran extension, which supports linting, formatting integration, symbol navigation, and works well with fortls.

Typical setup:

  1. Install a Fortran compiler such as GFortran.
  2. Install the Modern Fortran extension.
  3. Install fortls for improved language-server features:
python -m pip install fortls

If GFortran is on PATH, Modern Fortran can use it for linting automatically.