Skip to main content

FORTRAN Language Server for the Language Server Protocol

Project description

https://travis-ci.org/hansec/fortran-language-server.svg?branch=master https://ci.appveyor.com/api/projects/status/github/hansec/fortran-language-server?branch=master&svg=true https://img.shields.io/github/license/hansec/fortran-language-server.svg

A Fortran implementation of the Language Server Protocol using Python (2.7+).

Editor extensions using this language server to provide autocomplete and other IDE-like functionality are available for Atom, Visual Studio Code, and (Neo)vim.

Note: This language server is currently in the early stages of development. Not all features are supported or planned.

Language Server Features

Document Symbols:

https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_outline.png

Auto Completion:

https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_autocomplete.gif

Signature Help (beta):

Note: Not available for overloaded subroutines/functions.

https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_sigHelp.gif

Go to definition:

https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_gotodef.gif

Hover:

https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_hover.gif

Find references:

Note: Currently for global and top level module objects only.

https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_refs.png

Diagnostics:

  • Multiple use of the same variable name

  • Unknown module in USE statement

  • Variable masking definition from parent scope

https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_diag.png

Installation

pip install fortran-language-server

Language server settings

The following global settings can be used when launching the language server.

  • --symbol_skip_mem Do not include type members in document symbol results

  • --incremental_sync Use incremental document synchronization (beta)

  • --autocomplete_no_prefix Do not filter autocomplete results by variable prefix

  • --lowercase_intrinsics Use lowercase for intrinsics and keywords in autocomplete requests

  • --use_signature_help Use signature help instead of snippets for subroutines/functions (beta)

  • --variable_hover Show hover information for variables (default: subroutines/functions only)

Debug settings:

The following settings can be used to perform standalone debug tests on the language server.

  • --debug_filepath=DEBUG_FILEPATH File path for language server tests

  • --debug_rootpath=DEBUG_ROOTPATH Root path for language server tests

  • --debug_line=DEBUG_FILEPATH Line position for language server tests (1-indexed)

  • --debug_char=DEBUG_ROOTPATH Character position for language server tests (1-indexed)

  • --debug_parser Test source code parser on specified file

  • --debug_symbols Test symbol request for specified file

  • --debug_completion Test completion request for specified file and position

  • --debug_signature Test signatureHelp request for specified file and position

  • --debug_definition Test definition request for specified file and position

Configuration

Project specific settings can be specified by placing a JSON file named .fortls (example below) in the root_dir directory.

Setup module search paths:

By default all files with the suffix F,F77,F90,F95,F03,F08,FOR,FPP (case-insensitive) in the root_dir directory, specified during initialization, and all its sub-directories are parsed and included in the project.

Directories and files can be excluded from the project by specifying their paths (relative to root_dir) in the excl_paths variable in the .fortls file. Excluded directories also exclude all sub-directories.

Module directories can also be specified manually by specifying their paths (relative to root_dir) in the mod_dirs variable in the .fortls file. When mod_dirs is specified directories are not added recursively, so any nested sub directories must be explicitly listed. However, root_dir does not need to be specified manually as it is always included.

{
  "mod_dirs": ["subdir1", "subdir2"],
  "excl_paths": ["subdir3", "subdir1/file_to_skip.F90"]
}

Bug reports

When filing bugs please provide example code to reproduce the observed issue.

License

This project is made available under the MIT License.

Support

If you really like this package you can buy me a coffee to say thanks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fortran-language-server-0.7.2.tar.gz (43.6 kB view details)

Uploaded Source

File details

Details for the file fortran-language-server-0.7.2.tar.gz.

File metadata

File hashes

Hashes for fortran-language-server-0.7.2.tar.gz
Algorithm Hash digest
SHA256 76543bb0769619a94a31533b1757c3f0e1b4f7d28b7194c47f2809771ce62ec8
MD5 62ce1362eac6c5a93ba112b8f6358302
BLAKE2b-256 98aa21b90e9e1ecc8632038aecbe7a9cd1d972954811c28fcbb232e4bb492ffd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page