This extension provides support for the Fortran programming language. It includes syntax highlighting, 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
You can control the include paths to be used by the linter with the fortran.includePaths
setting.
{
"fortran.includePaths": [
"/usr/local/include",
"/usr/local"
]
}
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 fortran.gfortranExecutable
setting.
{
"fortran.gfortranExecutable": '/usr/local/bin/gfortran-4.7',
}
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.
{
"fortran.linterExtraArgs": ['-Wall'],
}
You can configure what kind of symbols will appear in the symbol list by using
{
"fortran.symbols": [ "function", "subroutine"]
}
The available options are
- "function"
- "subroutine"
- "variable"
- "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.
This extension uses a host of tools to provide the various language features. An alternative is to use a single language server that provides the same feature.
Set fortran.useLanguageServer
to true
to use the Fortran language server from Chris Hansen for features like Hover, Definition, Find All References, Signature Help, Go to Symbol in File and Workspace.
- This is an experimental feature and is not available in Windows yet.
- Since only a single language server is spun up for given VS Code instance, having multi-root setup does not work
- If set to true, you will be prompted to install the Fortran language server. Once installed, you will have to reload VS Code window. The language server will then be run by the Fortran extension in the background to provide services needed for the above mentioned features.
- Every time you change the value of the setting
fortran.useLanguageServer
, you need to reload the VS Code window for it to take effect.
For the linter to work you need to have gfortran
on your path, or wherever you configure it to be.
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.
MIT