Modern Fortran language support for VSCode
This extension provides support for the Fortran programming language. It includes syntax highlighting, debugging, code snippets and a linting based on
gfortran. You can download the Visual Studio Code editor from here.
- Syntax highlighting
- Code Snippets
- Documentation on hover for intrinsic functions
- Code linting based on
gfortran to show errors wiggles in your code
- Code autocompletion (beta)
- Symbols provider
- Debugger, uses Microsoft's C/C++ extension
You can control the include paths to be used by the linter with the
By default the
gfortran executable is assumed to be found in the path. In order to use a different one or if it can't be found in the path you can point the extension to use a custom one with the
If you want to pass extra options to the
gfortran executable or override the default one, you can use the setting
fortran.linterExtraArgs. By default
-Wall is the only option.
You can configure what kind of symbols will appear in the symbol list by using
"fortran.symbols": [ "function", "subroutine"]
The available options are
- "module" (not supported yet)
- "program" (not supported yet)
and by default only functions and subroutines are shown
You can also configure the case for fortran intrinsics auto-complete by using
"fortran.preferredCase": "lowercase" | "uppercase"
This is a list of some of the snippets included, if you like to include additional snippets please let me know and I will add them.
To trigger code validations you must save the file first.
The extension uses the debugger from Microsoft's
for Visual Studio Code. This allows this extension to use the full functionality
of the C/C++ extension for debugging applications:
(un)conditional breaking points, expression evaluation, multi-threaded debugging,
call stack, stepping, watch window.
launch.json script, responsible for controlling the debugger, is
provided below. However, Visual Studio Code is also capable of autogenerating
launch.json file and the configurations inside the file.
More details about how to setup the debugger can be found in Microsoft's website:
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"name": "(gdb) Fortran",
"args": , // Possible input args for a.out
"description": "Enable pretty-printing for gdb",
For the linter to work you need to have
gfortran on your path, or wherever you configure it to be.
For debugging you need to have one of the following debuggers installed:
- Linux: GDB
- macOS: GDB or LLDB
- Windows: GDB or Visual Studio Windows Debugger
Please report any issues and feature request on the GitHub repo here
The syntax highlight support was imported from TextMate bundle
The idea of using
gfortran comes from this awesome fortran plugin for Sublime Text.