Skip to content

Commit 55a43d0

Browse files
committed
Adds sphinx documentation
1 parent ba6ecd4 commit 55a43d0

File tree

11 files changed

+278
-5
lines changed

11 files changed

+278
-5
lines changed

.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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Adds hover support for preprocessor variables
99
- Adds Go To Definition for `include` statements
1010
- Adds intrinsic support for `OpenACC` version 3.1
11+
- Adds sphinx autogenerated documentation
1112

1213
### Changes
1314

README.md

Lines changed: 4 additions & 4 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
@@ -60,14 +60,15 @@ potentially subject to change.
6060

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

6465
## Installation
6566

6667
```sh
6768
pip install fortls
6869
```
6970

70-
## fortls settings
71+
## Settings
7172

7273
The following global settings can be used when launching the language
7374
server.
@@ -185,6 +186,7 @@ By default all source directories under `root_dir` are recursively included.
185186
Source file directories can also be specified manually by specifying
186187
their paths in the `source_dirs` variable in the configuration options file.
187188
Paths can be absolute or relative to `root_dir`.
189+
`root_dir` does not need to be specified manually as it is always included.
188190

189191
When defining `source_dirs` in the configuration options filethe default behaviour (i.e. including
190192
all files in all subdirectories under `root_dir`) is overriden. To include them
@@ -196,8 +198,6 @@ back again one can do
196198
}
197199
```
198200

199-
> NOTE: `root_dir` does not need to be specified manually as it is always included.
200-
201201
### Preprocessing
202202

203203
**Note:** Preprocessor support is not "complete", see below. For

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`

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.https://www.sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/modules.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Developers' documentations
2+
==========================
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
fortls

0 commit comments

Comments
 (0)