Skip to content

Commit f709a85

Browse files
authored
Merge pull request #12 from gnikit:feature/preproc-hover
Features and Changes for v2.0.0 release
2 parents ebfe243 + d1eac20 commit f709a85

30 files changed

+3432
-487
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
os: [ubuntu-latest]
12-
python-version: ["3.8", "3.9", "3.10"]
12+
python-version: ["3.7", "3.8", "3.9", "3.10"]
1313
fail-fast: false
1414
runs-on: ${{ matrix.os }}
1515

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.pyc
22
.vscode
33
*.egg-info
4-
dist/
4+
dist/
5+
docs/_build/

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# CHANGELONG
22

3+
## 2.0.0
4+
5+
### Adds
6+
7+
- Adds support for including preprocessor definitions from files same as `pp_defs`
8+
- Adds hover support for preprocessor variables
9+
- Adds Go To Definition for `include` statements
10+
- Adds intrinsic support for `OpenACC` version 3.1
11+
- Adds sphinx autogenerated documentation
12+
- Adds `incl_suffixes` as a configuration option
13+
14+
### Changes
15+
16+
- Update constant parameters for `omp_lib` and `omp_lib_kinds` Interface v5.0
17+
- Format json files with `prettier`
18+
19+
### Fixes
20+
21+
- Fixes the hover of preprocessor functions. It now displays the function name
22+
witout the argument list and the function body. The argument list cannot be
23+
multiline but the function body can.
24+
325
## 1.16.0
426

527
### Adds

README.md

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
77

88
`fortls` is an implementation of the [Language Server Protocol](https://github.com/Microsoft/language-server-protocol)
9-
(LSP) for Fortran using Python (3.6+).
9+
(LSP) for Fortran using Python (3.7+).
1010

1111
Editor extensions that can integrate with `fortls` to provide autocomplete and
1212
other IDE-like functionality are available for
@@ -28,29 +28,30 @@ potentially subject to change.
2828

2929
## Features
3030

31-
- Document symbols (`textDocument/documentSymbol`)
32-
- Auto-complete (`textDocument/completion`)
33-
- Signature help (`textDocument/signatureHelp`)
34-
- GoTo/Peek definition (`textDocument/definition`)
35-
- Hover (`textDocument/hover`)
36-
- GoTo implementation (`textDocument/implementation`)
37-
- Find/Peek references (`textDocument/references`)
38-
- Project-wide symbol search (`workspace/symbol`)
31+
- Project-wide and Document symbol detection and Renaming
32+
- Hover support, Signature help and Auto-completion
33+
- GoTo/Peek implementation and Find/Peek references
3934
- Symbol renaming (`textDocument/rename`)
4035
- Documentation parsing ([Doxygen](http://www.doxygen.org/) and
4136
[FORD](https://github.com/Fortran-FOSS-Programmers/ford) styles)
42-
- Diagnostics (limited)
37+
- Access to multiple intrinsic modules and functions
38+
- `ISO_FORTRAN_ENV` GCC 11.2.0
39+
- `IOS_C_BINDING` GCC 11.2.0
40+
- `IEEE_EXCEPTIONS`, `IEEE_ARITHMETIC`, `IEEE_FEATURES` GCC 11.2.0
41+
- OpenMP `OMP_LIB`, `OMP_LIB_KINDS` v5.0
42+
- OpenACC `OPENACC`, `OPENACC_KINDS` v3.1
43+
- Diagnostics
4344
- Multiple definitions with the same variable name
4445
- Variable definition masks definition from parent scope
4546
- Missing subroutine/function arguments
46-
- Unknown user-defined type used in "TYPE"/"CLASS" definition
47+
- Unknown user-defined type used in `TYPE`/`CLASS` definition
4748
(only if visible in project)
4849
- Unclosed blocks/scopes
4950
- Invalid scope nesting
50-
- Unknown modules in "USE" statement
51+
- Unknown modules in `USE` statement
5152
- Unimplemented deferred type-bound procedures
5253
- Use of unimported variables/objects in interface blocks
53-
- Statement placement errors ("CONTAINS", "IMPLICIT", "IMPORT")
54+
- Statement placement errors (`CONTAINS`, `IMPLICIT`, `IMPORT`)
5455
- Code actions (`textDocument/codeAction`) \[Experimental\]
5556
- Generate type-bound procedures and implementation templates for
5657
deferred procedures
@@ -59,14 +60,15 @@ potentially subject to change.
5960

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

6365
## Installation
6466

6567
```sh
6668
pip install fortls
6769
```
6870

69-
## fortls settings
71+
## Settings
7072

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

159162
## Additional settings
160163

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

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

198-
> NOTE: `root_dir` does not need to be specified manually as it is always included.
199-
200202
### Preprocessing
201203

202204
**Note:** Preprocessor support is not "complete", see below. For
@@ -278,6 +280,19 @@ Diagnostics:
278280
279281
![image](https://raw.githubusercontent.com/gnikit/fortran-language-server/master/images/fortls_diag.png) -->
280282

283+
## Implemented server requests
284+
285+
| Request | Description |
286+
| ----------------------------- | ------------------------------------------------------ |
287+
| `workspace/symbol` | Get workspace-wide symbols |
288+
| `textDocument/documentSymbol` | Get document symbols e.g. functions, subroutines, etc. |
289+
| `textDocument/completion` | Suggested tab-completion when typing |
290+
| `textDocument/signatureHelp` | Get signature information at a given cursor position |
291+
| `textDocument/definition` | GoTo implementation/Peek implementation |
292+
| `textDocument/references` | Find all/Peek references |
293+
| `textDocument/rename` | Rename a symbol across the workspace |
294+
| `textDocument/codeAction` | **Experimental** Generate code |
295+
281296
## Acknowledgements
282297

283298
This project would not have been possible without the original work of [@hansec](https://github.com/hansec/)

docs/Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SPHINXAPIDOC ?= sphinx-apidoc
9+
PANDOC ?= pandoc
10+
SOURCEDIR = .
11+
BUILDDIR = _build
12+
13+
# Put it first so that "make" without argument is like "make help".
14+
help:
15+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
16+
17+
.PHONY: help Makefile
18+
19+
# Catch-all target: route all unknown targets to Sphinx using the new
20+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
21+
%: Makefile
22+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
23+
24+
modules:
25+
@$(SPHINXAPIDOC) -f -H "Developers' documentations" ../fortls -o .

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../README.md

docs/conf.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
16+
sys.path.insert(0, os.path.abspath(".."))
17+
18+
19+
# -- Project information -----------------------------------------------------
20+
21+
project = "fortls"
22+
copyright = "2021, Giannis Nikiteas"
23+
author = "Giannis Nikiteas"
24+
25+
# The full version, including alpha/beta/rc tags
26+
release = "1.16.0"
27+
28+
29+
# -- General configuration ---------------------------------------------------
30+
31+
# Add any Sphinx extension module names here, as strings. They can be
32+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33+
# ones.
34+
extensions = [
35+
"sphinx.ext.autodoc",
36+
"sphinx.ext.autosectionlabel",
37+
"sphinx.ext.autosummary",
38+
"sphinx.ext.napoleon",
39+
"sphinx.ext.intersphinx",
40+
"sphinx.ext.inheritance_diagram",
41+
"sphinx_autodoc_typehints",
42+
"sphinx.ext.autosectionlabel",
43+
"myst_parser",
44+
]
45+
46+
# Add any paths that contain templates here, relative to this directory.
47+
templates_path = ["_templates"]
48+
source_suffix = [".rst", ".md"]
49+
50+
51+
# List of patterns, relative to source directory, that match files and
52+
# directories to ignore when looking for source files.
53+
# This pattern also affects html_static_path and html_extra_path.
54+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
55+
56+
57+
# -- Options for HTML output -------------------------------------------------
58+
59+
# The theme to use for HTML and HTML Help pages. See the documentation for
60+
# a list of builtin themes.
61+
#
62+
html_theme = "alabaster"
63+
html_theme = "sphinx_rtd_theme"
64+
65+
66+
# Add any paths that contain custom static files (such as style sheets) here,
67+
# relative to this directory. They are copied after the builtin static files,
68+
# so a file named "default.css" will overwrite the builtin "default.css".
69+
html_static_path = ["_static"]
70+
71+
72+
display_toc = True
73+
# autodoc_default_flags = ["members"]
74+
autosummary_generate = True
75+
76+
77+
intersphinx_mapping = {
78+
"python": ("https://docs.python.org/3.10", None),
79+
}
80+
81+
inheritance_graph_attrs = {
82+
"size": '"6.0, 8.0"',
83+
"fontsize": 32,
84+
"bgcolor": "transparent",
85+
}
86+
inheritance_node_attrs = {
87+
"color": "black",
88+
"fillcolor": "white",
89+
"style": '"filled,solid"',
90+
}
91+
inheritance_edge_attrs = {
92+
"penwidth": 1.2,
93+
"arrowsize": 0.8,
94+
}

docs/fortls.rst

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
fortls package
2+
==============
3+
4+
Submodules
5+
----------
6+
7+
fortls.constants module
8+
-----------------------
9+
10+
.. automodule:: fortls.constants
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
fortls.helper\_functions module
16+
-------------------------------
17+
18+
.. automodule:: fortls.helper_functions
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
fortls.intrinsics module
24+
------------------------
25+
26+
.. automodule:: fortls.intrinsics
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
fortls.jsonrpc module
32+
---------------------
33+
34+
.. automodule:: fortls.jsonrpc
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
fortls.langserver module
40+
------------------------
41+
42+
.. automodule:: fortls.langserver
43+
:members:
44+
:undoc-members:
45+
:show-inheritance:
46+
47+
fortls.objects module
48+
---------------------
49+
50+
.. automodule:: fortls.objects
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
fortls.parse\_fortran module
56+
----------------------------
57+
58+
.. automodule:: fortls.parse_fortran
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
fortls.regex\_patterns module
64+
-----------------------------
65+
66+
.. automodule:: fortls.regex_patterns
67+
:members:
68+
:undoc-members:
69+
:show-inheritance:
70+
71+
Module contents
72+
---------------
73+
74+
.. automodule:: fortls
75+
:members:
76+
:undoc-members:
77+
:show-inheritance:

docs/index.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. fortls documentation master file, created by
2+
sphinx-quickstart on Mon Jan 10 11:32:27 2022.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
fortls
7+
==================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
README.md
14+
modules.rst
15+
16+
..
17+
Include native markdown into native rst
18+
.. include:: README.md
19+
:parser: myst_parser.sphinx_
20+
21+
Indices and tables
22+
==================
23+
24+
* :ref:`genindex`
25+
* :ref:`modindex`
26+
* :ref:`search`

0 commit comments

Comments
 (0)