Skip to content

wdaniau/vscode-fortran-support

 
 

Repository files navigation

Modern Fortran language support for VSCode

Build Status codecov MIT License Installs GitHub release

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.

Features

  • 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

symbol_nav

Settings

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"
}

Snippets

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.

Program skeleton

program snippet

Module skeleton

module snippet

Error wiggles

To trigger code validations you must save the file first.

Requirements

For the linter to work you need to have gfortran on your path, or wherever you configure it to be.

Issues

Please report any issues and feature request on the GitHub repo here

Notice

The syntax highlight support was imported from TextMate bundle

The idea of using gfortran comes from this awesome fortran plugin for Sublime Text.

LICENSE

MIT

About

Fortran language support for Visual Studio Code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.2%
  • Other 0.8%