Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features and Changes for v2.0.0 release #12

Merged
merged 19 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
fail-fast: false
runs-on: ${{ matrix.os }}

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
.vscode
*.egg-info
dist/
dist/
docs/_build/
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# CHANGELONG

## 2.0.0

### Adds

- Adds support for including preprocessor definitions from files same as `pp_defs`
- Adds hover support for preprocessor variables
- Adds Go To Definition for `include` statements
- Adds intrinsic support for `OpenACC` version 3.1
- Adds sphinx autogenerated documentation
- Adds `incl_suffixes` as a configuration option

### Changes

- Update constant parameters for `omp_lib` and `omp_lib_kinds` Interface v5.0
- Format json files with `prettier`

### Fixes

- Fixes the hover of preprocessor functions. It now displays the function name
witout the argument list and the function body. The argument list cannot be
multiline but the function body can.

## 1.16.0

### Adds
Expand Down
47 changes: 31 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

`fortls` is an implementation of the [Language Server Protocol](https://github.com/Microsoft/language-server-protocol)
(LSP) for Fortran using Python (3.6+).
(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
Expand All @@ -28,29 +28,30 @@ potentially subject to change.

## Features

- Document symbols (`textDocument/documentSymbol`)
- Auto-complete (`textDocument/completion`)
- Signature help (`textDocument/signatureHelp`)
- GoTo/Peek definition (`textDocument/definition`)
- Hover (`textDocument/hover`)
- GoTo implementation (`textDocument/implementation`)
- Find/Peek references (`textDocument/references`)
- Project-wide symbol search (`workspace/symbol`)
- Project-wide and Document symbol detection and Renaming
- Hover support, Signature help and Auto-completion
- GoTo/Peek implementation and Find/Peek references
- Symbol renaming (`textDocument/rename`)
- Documentation parsing ([Doxygen](http://www.doxygen.org/) and
[FORD](https://github.com/Fortran-FOSS-Programmers/ford) styles)
- Diagnostics (limited)
- Access to multiple intrinsic modules and functions
- `ISO_FORTRAN_ENV` GCC 11.2.0
- `IOS_C_BINDING` GCC 11.2.0
- `IEEE_EXCEPTIONS`, `IEEE_ARITHMETIC`, `IEEE_FEATURES` GCC 11.2.0
- OpenMP `OMP_LIB`, `OMP_LIB_KINDS` v5.0
- OpenACC `OPENACC`, `OPENACC_KINDS` v3.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"/"CLASS" definition
- Unknown user-defined type used in `TYPE`/`CLASS` definition
(only if visible in project)
- Unclosed blocks/scopes
- Invalid scope nesting
- Unknown modules in "USE" statement
- Unknown modules in `USE` statement
- Unimplemented deferred type-bound procedures
- Use of unimported variables/objects in interface blocks
- Statement placement errors ("CONTAINS", "IMPLICIT", "IMPORT")
- Statement placement errors (`CONTAINS`, `IMPLICIT`, `IMPORT`)
- Code actions (`textDocument/codeAction`) \[Experimental\]
- Generate type-bound procedures and implementation templates for
deferred procedures
Expand All @@ -59,14 +60,15 @@ potentially subject to change.

- Signature help is not available for overloaded subroutines/functions
- Diagnostics are only updated when files are saved or opened/closed
- Files included for preprocessor are not parsed for Fortran objects

## Installation

```sh
pip install fortls
```

## fortls settings
## Settings

The following global settings can be used when launching the language
server.
Expand Down Expand Up @@ -155,6 +157,7 @@ All command line options are also available through the **options** file as well
- `max_line_length` Maximum line length (default: none)
- `max_comment_line_length` Maximum comment line length (default:
none)
- `incl_suffixes` Add more Fortran extensions to be parsed by the server

## Additional settings

Expand Down Expand Up @@ -184,6 +187,7 @@ By default all source directories under `root_dir` are recursively included.
Source file directories can also be specified manually by specifying
their paths in the `source_dirs` variable in the configuration options file.
Paths can be absolute or relative to `root_dir`.
`root_dir` does not need to be specified manually as it is always included.

When defining `source_dirs` in the configuration options filethe default behaviour (i.e. including
all files in all subdirectories under `root_dir`) is overriden. To include them
Expand All @@ -195,8 +199,6 @@ back again one can do
}
```

> NOTE: `root_dir` does not need to be specified manually as it is always included.

### Preprocessing

**Note:** Preprocessor support is not "complete", see below. For
Expand Down Expand Up @@ -278,6 +280,19 @@ Diagnostics:

![image](https://raw.githubusercontent.com/gnikit/fortran-language-server/master/images/fortls_diag.png) -->

## 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](https://github.com/hansec/)
Expand Down
25 changes: 25 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SPHINXAPIDOC ?= sphinx-apidoc
PANDOC ?= pandoc
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

modules:
@$(SPHINXAPIDOC) -f -H "Developers' documentations" ../fortls -o .
1 change: 1 addition & 0 deletions docs/README.md
94 changes: 94 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys

sys.path.insert(0, os.path.abspath(".."))


# -- Project information -----------------------------------------------------

project = "fortls"
copyright = "2021, Giannis Nikiteas"
author = "Giannis Nikiteas"

# The full version, including alpha/beta/rc tags
release = "1.16.0"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.intersphinx",
"sphinx.ext.inheritance_diagram",
"sphinx_autodoc_typehints",
"sphinx.ext.autosectionlabel",
"myst_parser",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
source_suffix = [".rst", ".md"]


# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "alabaster"
html_theme = "sphinx_rtd_theme"


# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]


display_toc = True
# autodoc_default_flags = ["members"]
autosummary_generate = True


intersphinx_mapping = {
"python": ("https://docs.python.org/3.10", None),
}

inheritance_graph_attrs = {
"size": '"6.0, 8.0"',
"fontsize": 32,
"bgcolor": "transparent",
}
inheritance_node_attrs = {
"color": "black",
"fillcolor": "white",
"style": '"filled,solid"',
}
inheritance_edge_attrs = {
"penwidth": 1.2,
"arrowsize": 0.8,
}
77 changes: 77 additions & 0 deletions docs/fortls.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
fortls package
==============

Submodules
----------

fortls.constants module
-----------------------

.. automodule:: fortls.constants
:members:
:undoc-members:
:show-inheritance:

fortls.helper\_functions module
-------------------------------

.. automodule:: fortls.helper_functions
:members:
:undoc-members:
:show-inheritance:

fortls.intrinsics module
------------------------

.. automodule:: fortls.intrinsics
:members:
:undoc-members:
:show-inheritance:

fortls.jsonrpc module
---------------------

.. automodule:: fortls.jsonrpc
:members:
:undoc-members:
:show-inheritance:

fortls.langserver module
------------------------

.. automodule:: fortls.langserver
:members:
:undoc-members:
:show-inheritance:

fortls.objects module
---------------------

.. automodule:: fortls.objects
:members:
:undoc-members:
:show-inheritance:

fortls.parse\_fortran module
----------------------------

.. automodule:: fortls.parse_fortran
:members:
:undoc-members:
:show-inheritance:

fortls.regex\_patterns module
-----------------------------

.. automodule:: fortls.regex_patterns
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: fortls
:members:
:undoc-members:
:show-inheritance:
26 changes: 26 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.. fortls documentation master file, created by
sphinx-quickstart on Mon Jan 10 11:32:27 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

fortls
==================================

.. toctree::
:maxdepth: 2
:caption: Contents:

README.md
modules.rst

..
Include native markdown into native rst
.. include:: README.md
:parser: myst_parser.sphinx_

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Loading