fortls - Fortran Language Server
Project description
fortls - the Fortran Language Server
fortls is an implementation of the Language Server Protocol
(LSP) for Fortran using Python (3.7+).
Editor extensions that can integrate with fortls to provide autocomplete and
other IDE-like functionality are available for
Visual Studio Code,
Atom,
Visual Studio,
(Neo)vim,
and Emacs.
fortls vs fortran-language-server
This project is based on @hansec's original Language Server implementation but the two projects have since diverged.
fortls (this project) is now developed independently of the upstream hansec/fortran-language-server project and contains numerous bug fixes and new features
the original fortran-language-server does not.
For a complete and detailed list of the differences between the two Language Servers see the Documentation section: Unique fortls features (not in fortran-language-server)
The name of executable for this project has been chosen to remain fortls
to allow for integration with pre-existing plugins and workflows but it is
potentially subject to change.
Features
- Project-wide and Document symbol detection and Renaming
- Hover support, Signature help and Auto-completion
- GoTo/Peek implementation and Find/Peek references
- Preprocessor support
- Documentation parsing (Doxygen and FORD styles)
- Access to multiple intrinsic modules and functions
ISO_FORTRAN_ENVGCC 11.2.0IOS_C_BINDINGGCC 11.2.0IEEE_EXCEPTIONS,IEEE_ARITHMETIC,IEEE_FEATURESGCC 11.2.0- OpenMP
OMP_LIB,OMP_LIB_KINDSv5.0 - OpenACC
OPENACC,OPENACC_KINDSv3.1
- Diagnostics
- Multiple definitions with the same variable name
- Variable definition masks definition from parent scope
- Missing subroutine/function arguments
- Unknown user-defined type used in
TYPE/CLASSdefinition (only if visible in project) - Unclosed blocks/scopes
- Invalid scope nesting
- Unknown modules in
USEstatement - Unimplemented deferred type-bound procedures
- Use of unimported variables/objects in interface blocks
- Statement placement errors (
CONTAINS,IMPLICIT,IMPORT)
- Code actions (
textDocument/codeAction) [Experimental]- Generate type-bound procedures and implementation templates for deferred procedures
Notes/Limitations
- Signature help is not available for overloaded subroutines/functions
- Diagnostics are only updated when files are saved or opened/closed
Installation
pip install fortls
Warning: it is not recommended having
fortlsandfortran-language-serversimultaneously installed, since they use the same binary name. If you are having trouble gettingfortlsto work try uninstallingfortran-language-serverand reinstallingfortls.pip uninstall fortran-language-server pip install fortls --upgrade
Settings
fortls can be configured through both the command line e.g.
fortls --hover_signature or through a Configuration json file.
The two interfaces are identical and a full list of the available options can
be found in the Documentation
or through fortls -h
An example for a Configuration file is given below
{
"incremental_sync": true,
"lowercase_intrinsics": true,
"hover_signature": true,
"use_signature_help": true,
"excl_paths": ["tests/**", "tools/**"],
"excl_suffixes": ["_skip.f90"],
"include_dirs": ["include/**"],
"pp_suffixes": [".F90", ".h"],
"pp_defs": { "HAVE_HDF5": "", "MPI_Comm": "integer" }
}
Implemented server requests
| Request | Description |
|---|---|
workspace/symbol |
Get workspace-wide symbols |
textDocument/documentSymbol |
Get document symbols e.g. functions, subroutines, etc. |
textDocument/completion |
Suggested tab-completion when typing |
textDocument/signatureHelp |
Get signature information at a given cursor position |
textDocument/definition |
GoTo implementation/Peek implementation |
textDocument/references |
Find all/Peek references |
textDocument/rename |
Rename a symbol across the workspace |
textDocument/codeAction |
Experimental Generate code |
Acknowledgements
This project would not have been possible without the original work of @hansec
and the original fortran-language-server
Support
If you want to support this project you can do it through
Support the original project go here
Bug reports
When filing bugs please provide example code to reproduce the observed issue.
License
This project is made available under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fortls-2.2.0.tar.gz.
File metadata
- Download URL: fortls-2.2.0.tar.gz
- Upload date:
- Size: 4.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cea1844571e3c1db928c95c10e314f81e51696086f62d1758a6183fe86ddc4a1
|
|
| MD5 |
8029555d23e813ddf08760a382242a12
|
|
| BLAKE2b-256 |
ef25f70df6da9b557a2316e7a58e68cf2f2d6a0b0152a2a0945c28d427a72e1e
|
File details
Details for the file fortls-2.2.0-py3-none-any.whl.
File metadata
- Download URL: fortls-2.2.0-py3-none-any.whl
- Upload date:
- Size: 82.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f942f778f7528ed0ee7f3ab200a49abe7d57a42a1b653a4a67d883228bb9a62b
|
|
| MD5 |
47ddfd4bfbafffec58f0cd4e50bba2f1
|
|
| BLAKE2b-256 |
4eb65a9d61f5d1a0fb236d007738ae372874439b6c7ad43cd2718fa7d56633b8
|