All Projects → krvajal → vscode-fortran-support

krvajal / vscode-fortran-support

Licence: MIT license
Fortran language support for Visual Studio Code

Programming Languages

typescript
32286 projects
fortran
972 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vscode-fortran-support

Hashlink Debugger
Visual Studio Code Debugger for Haxe/HashLink applications
Stars: ✭ 35 (-28.57%)
Mutual labels:  debugger, vscode-extension
Golite
Add essential language support for the Go language to Sublime Text 3.
Stars: ✭ 14 (-71.43%)
Mutual labels:  formatting, linter
Android Dev Ext
Android debugging support for VS Code
Stars: ✭ 141 (+187.76%)
Mutual labels:  debugger, vscode-extension
Luapanda
lua debug and code tools for VS Code
Stars: ✭ 738 (+1406.12%)
Mutual labels:  debugger, vscode-extension
vscode-stylelint-plus
A Visual Studio Code extension to lint CSS/SCSS/Less with stylelint, support auto fix on save.
Stars: ✭ 32 (-34.69%)
Mutual labels:  linter, vscode-extension
Hxcpp Debugger
Visual Studio Code Debugger for Haxe/HXCPP applications
Stars: ✭ 18 (-63.27%)
Mutual labels:  debugger, vscode-extension
vue-snippets
Visual Studio Code Syntax Highlighting For Vue3 And Vue2
Stars: ✭ 25 (-48.98%)
Mutual labels:  snippets, vscode-extension
Omi Snippets
🔖Visual Studio Code Syntax Highlighting For Single File React And Omi Components - 编写React和Omi单文件组件的VSC语法高亮插件
Stars: ✭ 149 (+204.08%)
Mutual labels:  snippets, vscode-extension
Wikitext-VSCode-Extension
A Visual Studio Code Extension that provides language support for Wikitext.
Stars: ✭ 50 (+2.04%)
Mutual labels:  snippets, vscode-extension
vscode-R
R Extension for Visual Studio Code
Stars: ✭ 788 (+1508.16%)
Mutual labels:  snippets, vscode-extension
Vscode Php Debug
PHP Debug Adapter for Visual Studio Code 🐞⛔
Stars: ✭ 569 (+1061.22%)
Mutual labels:  debugger, vscode-extension
vscode-uncrustify
Code format using uncrustify
Stars: ✭ 62 (+26.53%)
Mutual labels:  formatting, vscode-extension
Vscode Go
Go extension for Visual Studio Code
Stars: ✭ 2,268 (+4528.57%)
Mutual labels:  debugger, vscode-extension
Vscode Lldb
A native debugger extension for VSCode based on LLDB
Stars: ✭ 866 (+1667.35%)
Mutual labels:  debugger, vscode-extension
Vscode Restructuredtext
reStructuredText Language Support in Visual Studio Code
Stars: ✭ 243 (+395.92%)
Mutual labels:  snippets, linter
clang-format-action
GitHub Action for clang-format checking
Stars: ✭ 48 (-2.04%)
Mutual labels:  formatting, linter
Coddx Alpha
Coddx - a collection of tools that help developers program efficiently. One of the features is generating multiple files from templates quickly.
Stars: ✭ 132 (+169.39%)
Mutual labels:  snippets, vscode-extension
Processing Vscode
A Visual Studio Code extension for the programming language Processing
Stars: ✭ 141 (+187.76%)
Mutual labels:  snippets, vscode-extension
atom-perl6-editor-tools
A collection of useful Perl 6 editor tools
Stars: ✭ 19 (-61.22%)
Mutual labels:  snippets, linter
stencil-snippets
An extension to add some snippets on vs code
Stars: ✭ 21 (-57.14%)
Mutual labels:  snippets, vscode-extension

GitHub Actions Downloads Installs VS Marketplace MIT License

Key Features

  • Syntax highlighting (Free and Fixed forms)
  • Hover support, Signature help and Auto-completion
  • GoTo/Peek implementation and Find/Peek references
  • Project-wide and Document symbol detection and Renaming
  • Native Language Server integration with fortls
  • Linting support for gfortran, flang and ifort
  • Debugger C/C++ extension
  • Formatting with findent or fprettify
  • Code snippets (more can be defined by the user see)

Language Server integration

The Fortran Language Server fortls is responsible for providing a lot of the higher level, IDE functionality. By default, Modern Fortran will attempt to use it for hover, autocompletion, symbols and Go to & Peeking into definitions.

Allow for fortls to be automatically installed with pip or Anaconda and if the location where fortls is installed is not in your PATH point VS Code to the fortls location by setting

{
  "fortran.fortls.path": "/custom/path/to/fortls"
}

For more about the Language Server's capabilities please refer to the documentation of fortls.

Linting

Linting allows for compiler error and warning detection while coding without the user having to compile.

Using an invalid if expression

alt

Using incorrect type and rank as function argument

alt

📝 Note
Save your file to generate linting results

Linting results can be improved by providing additional options to the compiler.

Including directories

You can control the include paths to be used by the linter with the fortran.linter.includePaths option.

Important
For the best linting results linter.includePaths should match the included paths for your project's compilation.
{
  "fortran.linter.includePaths": ["/usr/include/**", "${workspaceFolder}/include/**"]
}
Important
If a glob pattern is used only directories matching the pattern will be included

Additional linting options

More options can be passed to the linter via

{
  "fortran.linter.extraArgs": [
    "-fdefault-real-8",
    "-fdefault-double-8",
    "-Wunused-variable",
    "-Wunused-dummy-argument"
  ]
}

Default value is -Wall (or -warn all for ifort).

Changing linting compiler

By default, the linter used is gfortran, Intel's ifort and LLVM's flang are also supported. One can use a different linter compiler via the option

{
  "fortran.linter.compiler": "ifort" | "gfortran" | "flang" | "Disabled"
}

The linter executable is assumed to be found in the PATH. In order to use a different executable or if the executable can't be found in the PATH you can point the extension to another linter with the fortran.linter.compilerPath option.

{
  "fortran.linter.compilerPath": "/opt/oneapi/compiler/2022.0.2/linux/bin/intel64/ifort"
}

Debugging

alt

The extension uses the debugger from Microsoft's C/C++ extension 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, multithreaded debugging, call stack, stepping, watch window.

A minimal launch.json script, responsible for controlling the debugger, is provided below. However, Visual Studio Code is also capable of autogenerating a launch.json file and the configurations inside the file.

More details about how to set up 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
  "version": "0.2.0",
  "configurations": [
    {
      "name": "(gdb) Fortran",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/a.out",
      "args": [], // Possible input args for a.out
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

Formatting

Two formatters are supported findent and fprettify. Both of them can be installed with pip automatically through the extension.

findent fprettify
alt alt

The formatter is controlled by the user option

{
  "fortran.formatting.formatter": "findent" | "fprettify" | "Disabled"
}

Additional arguments to the formatter can be input using

{
  "fortran.formatting.findentArgs": ["-Cn", "-Rr"],
  "fortran.formatting.fprettifyArgs": ["--whitespace-comma", "--enable-decl"]
}

If the formatter is not present in the PATH its location can be input with

{
  "fortran.formatting.path": "/custom-path-to-formatter-binary"
}
📝 Note
findent can also be used to generate dependency files for a project.

Snippets

Snippets are included by both fortls Language Server and the Modern Fortran VS Code extension. Some available snippets can be seen below. Users can define their own snippets by following these VS Code instructions.

If you think a snippet should be shipped by with the extension feel free to submit a feature request

Program skeleton

program snippet

Module skeleton

module snippet

Advanced options

To show the symbols in the file outline enable provide.symbols. Symbols can be served by the fortls, the built-in, both or none. By default fortls is used.

{
  "fortran.provide.symbols": "fortls" | "Built-in" | "Both" | "Disable"
}

You can also configure the case for fortran intrinsics auto-complete by using

{
    "fortran.preferredCase": "lowercase" | "uppercase"
}

Requirements

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

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].