sphinx-lua-ls 1.1.0__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sphinx_lua_ls-2.0.0/CHANGELOG.md +46 -0
- {sphinx_lua_ls-1.1.0/sphinx_lua_ls.egg-info → sphinx_lua_ls-2.0.0}/PKG-INFO +2 -2
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/docs/example/logging.lua +2 -1
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/docs/source/conf.py +4 -16
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/docs/source/index.rst +185 -29
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/pyproject.toml +2 -2
- sphinx_lua_ls-2.0.0/sphinx_lua_ls/__init__.py +321 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/sphinx_lua_ls/_version.py +2 -2
- sphinx_lua_ls-2.0.0/sphinx_lua_ls/apidoc.py +151 -0
- sphinx_lua_ls-2.0.0/sphinx_lua_ls/autodoc.py +686 -0
- sphinx_lua_ls-2.0.0/sphinx_lua_ls/autoindex.py +137 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/sphinx_lua_ls/domain.py +222 -186
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/sphinx_lua_ls/intersphinx.py +1 -1
- sphinx_lua_ls-1.1.0/sphinx_lua_ls/doctree.py → sphinx_lua_ls-2.0.0/sphinx_lua_ls/objtree.py +143 -47
- sphinx_lua_ls-2.0.0/sphinx_lua_ls/static/lua.css +7 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0/sphinx_lua_ls.egg-info}/PKG-INFO +2 -2
- sphinx_lua_ls-2.0.0/sphinx_lua_ls.egg-info/SOURCES.txt +101 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/sphinx_lua_ls.egg-info/requires.txt +1 -1
- sphinx_lua_ls-2.0.0/test/conftest.py +63 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/Makefile +20 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/conf.py +5 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/index.rst +14 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/lua/annotations.lua +44 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/lua/member_ordering.lua +24 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/lua/module_title.lua +9 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/lua/nested_modules.lua +14 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/lua/nesting.lua +57 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/lua/object_types.lua +139 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/lua/relative_resolve.lua +20 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/make.bat +35 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/src/annotations.rst +26 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/src/autoindex.rst +12 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/src/member_ordering.rst +40 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/src/module_title.rst +28 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/src/nested_modules.rst +8 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/src/nesting.rst +77 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/src/nesting_recursive.rst +78 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/src/object_types.rst +8 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc/src/relative_resolve.rst +6 -0
- {sphinx_lua_ls-1.1.0/test/roots/test-doc → sphinx_lua_ls-2.0.0/test/roots/test-autodoc-roots}/Makefile +1 -1
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc-roots/conf.py +5 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc-roots/index.rst +7 -0
- {sphinx_lua_ls-1.1.0/test/roots/test-doc → sphinx_lua_ls-2.0.0/test/roots/test-autodoc-roots}/make.bat +1 -1
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc-roots/root_1/autodoc.lua +7 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc-roots/root_2/autodoc.lua +7 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc-settings/Makefile +20 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc-settings/conf.py +5 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc-settings/index.rst +6 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc-settings/lua/autodoc.lua +11 -0
- sphinx_lua_ls-2.0.0/test/roots/test-autodoc-settings/make.bat +35 -0
- sphinx_lua_ls-2.0.0/test/roots/test-doc/Makefile +20 -0
- sphinx_lua_ls-2.0.0/test/roots/test-doc/conf.py +6 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/test/roots/test-doc/index.rst +2 -3
- sphinx_lua_ls-2.0.0/test/roots/test-doc/make.bat +35 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/test/roots/test-doc/mod.lua +5 -2
- sphinx_lua_ls-2.0.0/test/roots/test-doc/src/annotations.rst +18 -0
- sphinx_lua_ls-2.0.0/test/roots/test-doc/src/autoindex.rst +37 -0
- sphinx_lua_ls-2.0.0/test/roots/test-doc/src/directives.rst +178 -0
- sphinx_lua_ls-2.0.0/test/roots/test-doc/src/intersphinx.rst +6 -0
- sphinx_lua_ls-2.0.0/test/roots/test-doc/src/modules.rst +28 -0
- sphinx_lua_ls-2.0.0/test/roots/test-doc/src/refs.rst +78 -0
- sphinx_lua_ls-2.0.0/test/roots/test-intersphinx/Makefile +20 -0
- sphinx_lua_ls-2.0.0/test/roots/test-intersphinx/conf.py +6 -0
- sphinx_lua_ls-2.0.0/test/roots/test-intersphinx/index.rst +6 -0
- sphinx_lua_ls-2.0.0/test/roots/test-intersphinx/make.bat +35 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-annotations.html +381 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-autoindex.html +960 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-member_ordering.html +614 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-module_title.html +105 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-nested_modules.html +66 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-nesting.html +474 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-nesting_recursive.html +958 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-object_types.html +1918 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-relative_resolve.html +65 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-roots-default.html.html +65 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-roots-no-roots.html.html +2 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-roots-single-root.html.html +35 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-settings-annotation.html.html +84 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-settings-no-recursion.html.html +36 -0
- sphinx_lua_ls-2.0.0/test/test_regression/autodoc-settings-simple.html.html +70 -0
- sphinx_lua_ls-2.0.0/test/test_regression/doc-annotations.html +96 -0
- sphinx_lua_ls-2.0.0/test/test_regression/doc-autoindex.html +178 -0
- sphinx_lua_ls-2.0.0/test/test_regression/doc-directives.html +2117 -0
- sphinx_lua_ls-2.0.0/test/test_regression/doc-modules.html +120 -0
- sphinx_lua_ls-2.0.0/test/test_regression/doc-refs.html +375 -0
- sphinx_lua_ls-2.0.0/test/test_regression.py +153 -0
- sphinx_lua_ls-1.1.0/CHANGELOG.md +0 -18
- sphinx_lua_ls-1.1.0/sphinx_lua_ls/__init__.py +0 -166
- sphinx_lua_ls-1.1.0/sphinx_lua_ls/autodoc.py +0 -643
- sphinx_lua_ls-1.1.0/sphinx_lua_ls.egg-info/SOURCES.txt +0 -47
- sphinx_lua_ls-1.1.0/test/conftest.py +0 -18
- sphinx_lua_ls-1.1.0/test/roots/test-doc/conf.py +0 -5
- sphinx_lua_ls-1.1.0/test/roots/test-doc/src/annotations.rst +0 -16
- sphinx_lua_ls-1.1.0/test/roots/test-doc/src/autodoc.rst +0 -7
- sphinx_lua_ls-1.1.0/test/roots/test-doc/src/directives.rst +0 -132
- sphinx_lua_ls-1.1.0/test/roots/test-doc/src/modules.rst +0 -22
- sphinx_lua_ls-1.1.0/test/roots/test-doc/src/refs.rst +0 -70
- sphinx_lua_ls-1.1.0/test/test_regression/annotations.html +0 -106
- sphinx_lua_ls-1.1.0/test/test_regression/autodoc.html +0 -893
- sphinx_lua_ls-1.1.0/test/test_regression/directives.html +0 -1519
- sphinx_lua_ls-1.1.0/test/test_regression/modules.html +0 -111
- sphinx_lua_ls-1.1.0/test/test_regression/refs.html +0 -514
- sphinx_lua_ls-1.1.0/test/test_regression.py +0 -30
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/.github/workflows/ci.yaml +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/.gitignore +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/.pre-commit-config.yaml +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/.vscode/settings.json +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/CONTRIBUTING.md +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/LICENSE +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/README.md +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/conftest.py +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/docs/Makefile +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/docs/make.bat +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/docs/source/_extra/robots.txt +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/setup.cfg +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/sphinx_lua_ls/lua_ls.py +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/sphinx_lua_ls/py.typed +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/sphinx_lua_ls.egg-info/dependency_links.txt +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/sphinx_lua_ls.egg-info/top_level.txt +0 -0
- {sphinx_lua_ls-1.1.0 → sphinx_lua_ls-2.0.0}/test/test_parse.py +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v2.0.0
|
|
4
|
+
|
|
5
|
+
- Breaking change: don't implicitly convert classes that're derived from `table`
|
|
6
|
+
to modules. Users should use a `!doctype` comment instead.
|
|
7
|
+
- Breaking change: disallow nesting modules inside classes.
|
|
8
|
+
- Added `autoindex` directive.
|
|
9
|
+
- Added `apidoc` functionality.
|
|
10
|
+
- Improved test coverage and fixed found bugs.
|
|
11
|
+
|
|
12
|
+
**Migrating to 2.0.0:**
|
|
13
|
+
|
|
14
|
+
In your Lua code base, perform global replace by regexp:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
^(\s*)---\s*@class\s*(.+): table$
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
to
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
$1--- !doctype module
|
|
24
|
+
$1--- @class $2
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Make sure that you only use `!doctype module` on the top-level
|
|
28
|
+
tables that can be imported via `require`. On other objects,
|
|
29
|
+
use `!doctype table` instead, otherwise you'll get errors that modules are not allowed within other objects.
|
|
30
|
+
|
|
31
|
+
## v1.1.0
|
|
32
|
+
|
|
33
|
+
- Added support for `!doc` and `!doctype` comments.
|
|
34
|
+
- Added `:include-protected:` and `:include-package:` options for `lua:autoobject`.
|
|
35
|
+
- Allowed referring `lua:const` objects from `lua:attr` role.
|
|
36
|
+
- Fixed a bug when default options would not properly propagate
|
|
37
|
+
when using `lua:autoobject` with `:recurse:`.
|
|
38
|
+
- Fixed a bug when `lua:autoobject` would deduce incorrect module paths
|
|
39
|
+
when applied to non-toplevel modules.
|
|
40
|
+
- Fixed a bug when docstring for a class would be used for undocumented function
|
|
41
|
+
parameters that have this class as their type.
|
|
42
|
+
- Fixed types when `lua:autoobject` would infer incorrect types for `data`.
|
|
43
|
+
|
|
44
|
+
## v1.0.0
|
|
45
|
+
|
|
46
|
+
Initial release.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: sphinx-lua-ls
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Automatic documentation generation via LuaLS
|
|
5
5
|
Author-email: Tamika Nomara <taminomara@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -64,7 +64,7 @@ Requires-Dist: pytest-regressions~=2.7; extra == "test"
|
|
|
64
64
|
Requires-Dist: beautifulsoup4~=4.13; extra == "test"
|
|
65
65
|
Provides-Extra: doc
|
|
66
66
|
Requires-Dist: sybil~=6.1; extra == "doc"
|
|
67
|
-
Requires-Dist:
|
|
67
|
+
Requires-Dist: furo>=2024; extra == "doc"
|
|
68
68
|
Requires-Dist: sphinx_design>=0.6; extra == "doc"
|
|
69
69
|
|
|
70
70
|
# Sphinx plugin for Lua and Lua Language Server
|
|
@@ -27,22 +27,10 @@ lua_ls_project_root = "../example"
|
|
|
27
27
|
# -- Options for HTML output -------------------------------------------------
|
|
28
28
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
29
29
|
|
|
30
|
-
html_theme = "
|
|
30
|
+
html_theme = "furo"
|
|
31
31
|
html_extra_path = ["_extra/robots.txt"]
|
|
32
32
|
html_theme_options = {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
"name": "GitHub",
|
|
37
|
-
"url": "https://github.com/taminomara/sphinx-lua-ls",
|
|
38
|
-
"icon": "fa-brands fa-square-github",
|
|
39
|
-
"type": "fontawesome",
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
html_context = {
|
|
44
|
-
"github_user": "taminomara",
|
|
45
|
-
"github_repo": "sphinx-lua-ls",
|
|
46
|
-
"github_version": "main",
|
|
47
|
-
"doc_path": "docs/source",
|
|
33
|
+
"source_repository": "https://github.com/taminomara/sphinx-lua-ls",
|
|
34
|
+
"source_branch": "main",
|
|
35
|
+
"source_directory": "docs/source",
|
|
48
36
|
}
|
|
@@ -224,6 +224,11 @@ Declaring objects
|
|
|
224
224
|
|
|
225
225
|
Person's name.
|
|
226
226
|
|
|
227
|
+
.. rst:directive:: .. lua:table:: name
|
|
228
|
+
|
|
229
|
+
Directive for documenting tables that serve as namespaces.
|
|
230
|
+
It works like :rst:dir:`data`, but can contain nested members.
|
|
231
|
+
|
|
227
232
|
.. rst:directive:: .. lua:function:: name(param: type) -> type
|
|
228
233
|
.. lua:method:: name(param: type) -> type
|
|
229
234
|
.. lua:classmethod:: name(param: type) -> type
|
|
@@ -287,6 +292,9 @@ Declaring objects
|
|
|
287
292
|
|
|
288
293
|
This directive doesn't accept any content, it just creates an anchor.
|
|
289
294
|
|
|
295
|
+
Modules are something you can `require`. If you need to document a namespace
|
|
296
|
+
inside of a module, use a :rst:dir:`lua:table` instead.
|
|
297
|
+
|
|
290
298
|
.. rst:directive:: .. lua:currentmodule:: name
|
|
291
299
|
|
|
292
300
|
Switches current module without making an index entry or an anchor.
|
|
@@ -369,6 +377,11 @@ All directives that document Lua objects accept the standard parameters:
|
|
|
369
377
|
|
|
370
378
|
Use ``name`` and ``surname`` instead.
|
|
371
379
|
|
|
380
|
+
.. rst:directive:option:: synopsis
|
|
381
|
+
|
|
382
|
+
Allows adding a small description that's reflected
|
|
383
|
+
in the :rst:dir:`lua:autoindex` output.
|
|
384
|
+
|
|
372
385
|
.. rst:directive:option:: module
|
|
373
386
|
|
|
374
387
|
Allows overriding current module for a single object. This is useful
|
|
@@ -443,8 +456,8 @@ Cross-referencing objects
|
|
|
443
456
|
|
|
444
457
|
Reference to a `logging.Logger.info`.
|
|
445
458
|
|
|
446
|
-
Autodoc
|
|
447
|
-
|
|
459
|
+
Autodoc directives
|
|
460
|
+
------------------
|
|
448
461
|
|
|
449
462
|
.. rst:directive:: .. lua:autoobject:: name
|
|
450
463
|
|
|
@@ -454,26 +467,32 @@ Autodoc directive
|
|
|
454
467
|
Tables are exported as :rst:dir:`data` by default, meaning that their contents
|
|
455
468
|
are not documented.
|
|
456
469
|
|
|
457
|
-
To enable documentation within a table,
|
|
458
|
-
|
|
470
|
+
To enable documentation within a table, annotate is as a class.
|
|
471
|
+
You can change how autodoc infers its type by adding a ``!doctype`` comment.
|
|
472
|
+
|
|
459
473
|
Thus, a typical Lua module will look like this:
|
|
460
474
|
|
|
461
475
|
.. code-block:: lua
|
|
462
476
|
|
|
463
477
|
--- This is a module. Notice that we've declared it as a class
|
|
464
|
-
---
|
|
478
|
+
--- and added a `doctype`.
|
|
465
479
|
---
|
|
466
|
-
---
|
|
480
|
+
--- !doctype module
|
|
481
|
+
--- @class library
|
|
467
482
|
local library = {}
|
|
468
483
|
|
|
469
|
-
---
|
|
484
|
+
--- Nested namespaces should also be declared as classes.
|
|
470
485
|
---
|
|
471
|
-
---
|
|
472
|
-
library.
|
|
486
|
+
--- !doctype table
|
|
487
|
+
--- @class library.namespace
|
|
488
|
+
library.namespace = {}
|
|
473
489
|
|
|
474
490
|
--- Other objects are documented as usual.
|
|
475
491
|
function library.foo() end
|
|
476
492
|
|
|
493
|
+
--- And so on...
|
|
494
|
+
function library.namespace.bar() end
|
|
495
|
+
|
|
477
496
|
return library
|
|
478
497
|
|
|
479
498
|
.. note::
|
|
@@ -483,7 +502,7 @@ Autodoc directive
|
|
|
483
502
|
install the `MySt`_ plugin for Sphinx and invoke include
|
|
484
503
|
:rst:dir:`lua:autoobject` from a markdown file.
|
|
485
504
|
|
|
486
|
-
Make sure
|
|
505
|
+
Make sure to separate comment markers from documentation with a space.
|
|
487
506
|
Otherwise, autodoc will not be able to tell your comments apart from content
|
|
488
507
|
automatically generated by Lua Language Server:
|
|
489
508
|
|
|
@@ -504,7 +523,7 @@ Autodoc directive
|
|
|
504
523
|
|
|
505
524
|
2. ``@deprecated`` markers do not add any note to the documentation.
|
|
506
525
|
We recommend providing an explicit message
|
|
507
|
-
with the
|
|
526
|
+
with the ``deprecated`` directive.
|
|
508
527
|
|
|
509
528
|
3. ``@nodiscard`` and ``@operator`` markers are not exported.
|
|
510
529
|
|
|
@@ -515,13 +534,17 @@ Autodoc directive
|
|
|
515
534
|
|
|
516
535
|
--- Instead of enums, we use aliases.
|
|
517
536
|
---
|
|
518
|
-
---
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
---
|
|
522
|
-
LogLevel.Debug = 1
|
|
523
|
-
|
|
537
|
+
--- .. lua:data:: Debug
|
|
538
|
+
---
|
|
539
|
+
--- Document alias members in its body.
|
|
540
|
+
---
|
|
524
541
|
--- And so on...
|
|
542
|
+
---
|
|
543
|
+
--- @alias LogLevel integer
|
|
544
|
+
LogLevel = {
|
|
545
|
+
Debug = 1,
|
|
546
|
+
-- ...
|
|
547
|
+
}
|
|
525
548
|
|
|
526
549
|
:rst:dir:`lua:autoobject` supports same settings as other lua directives,
|
|
527
550
|
as well as some additional ones:
|
|
@@ -529,7 +552,7 @@ Autodoc directive
|
|
|
529
552
|
.. rst:directive:option:: members
|
|
530
553
|
|
|
531
554
|
If enabled, autodoc will also document object's members. You can pass a list
|
|
532
|
-
of
|
|
555
|
+
of comma-separated names to specify which members should be documented.
|
|
533
556
|
Otherwise, this option will document all public non-special members
|
|
534
557
|
which have a description.
|
|
535
558
|
|
|
@@ -538,24 +561,36 @@ Autodoc directive
|
|
|
538
561
|
Include undocumented members to the object's description. By default,
|
|
539
562
|
they are skipped even if :rst:dir:`members` is passed.
|
|
540
563
|
|
|
564
|
+
Accepts a comma-separated list of names; if list is empty,
|
|
565
|
+
adds all undoc members.
|
|
566
|
+
|
|
541
567
|
.. rst:directive:option:: private-members
|
|
542
568
|
protected-members
|
|
543
569
|
package-members
|
|
544
570
|
|
|
545
571
|
Include non-public members to the object's description.
|
|
546
572
|
|
|
573
|
+
Accepts a comma-separated list of names; if list is empty,
|
|
574
|
+
adds all non-public members.
|
|
575
|
+
|
|
547
576
|
.. rst:directive:option:: special-members
|
|
548
577
|
|
|
549
578
|
Include special members to the object's description. That is, generate
|
|
550
579
|
documentation for members whose names start with double underscore.
|
|
551
580
|
|
|
581
|
+
Accepts a comma-separated list of names; if list is empty,
|
|
582
|
+
adds all special members.
|
|
583
|
+
|
|
552
584
|
.. rst:directive:option:: inherited-members
|
|
553
585
|
|
|
554
586
|
For classes, includes members inherited from base classes.
|
|
555
587
|
|
|
588
|
+
Accepts a comma-separated list of names; if list is empty,
|
|
589
|
+
adds all inherited members.
|
|
590
|
+
|
|
556
591
|
.. rst:directive:option:: exclude-members
|
|
557
592
|
|
|
558
|
-
A
|
|
593
|
+
A comma-separated list of members that should not be documented.
|
|
559
594
|
|
|
560
595
|
.. rst:directive:option:: recursive
|
|
561
596
|
|
|
@@ -563,13 +598,20 @@ Autodoc directive
|
|
|
563
598
|
for all objects nested within the root. That is, object's members,
|
|
564
599
|
their members, and so on.
|
|
565
600
|
|
|
566
|
-
|
|
567
|
-
:rst:dir:
|
|
568
|
-
|
|
601
|
+
If :rst:dir:`lua:autoobject:undoc-members`,
|
|
602
|
+
:rst:dir:`lua:autoobject:private-members`,
|
|
603
|
+
:rst:dir:`lua:autoobject:special-members`,
|
|
604
|
+
or :rst:dir:`lua:autoobject:inherited-members`
|
|
605
|
+
are given as flags, they are propagated to all documented objects.
|
|
606
|
+
|
|
607
|
+
If they're given as list, they are not propagated.
|
|
608
|
+
|
|
609
|
+
Options from :py:data:`lua_ls_default_options` are applied to all recursively
|
|
610
|
+
documented objects.
|
|
569
611
|
|
|
570
612
|
.. rst:directive:option:: member-order
|
|
571
613
|
|
|
572
|
-
Controls how
|
|
614
|
+
Controls how members are sorted. There are three options available:
|
|
573
615
|
|
|
574
616
|
- ``alphabetical``: members are sorted in lexicographical order of their names;
|
|
575
617
|
|
|
@@ -585,6 +627,30 @@ Autodoc directive
|
|
|
585
627
|
for enums (``@enum``). If ordering by source, enums will be placed
|
|
586
628
|
at the end of the documentation.
|
|
587
629
|
|
|
630
|
+
.. rst:directive:option:: module-member-order
|
|
631
|
+
|
|
632
|
+
Overrides :rst:dir:`lua:autoobject:member-order` for modules.
|
|
633
|
+
|
|
634
|
+
.. rst:directive:option:: title
|
|
635
|
+
|
|
636
|
+
For modules, controls whether a title is inserted between module description
|
|
637
|
+
and documentation of its members.
|
|
638
|
+
|
|
639
|
+
.. rst:directive:option:: index-table
|
|
640
|
+
|
|
641
|
+
Adds :rst:dir:`lua:autoindex` to the toplevel module.
|
|
642
|
+
|
|
643
|
+
.. rst:directive:option:: index-title
|
|
644
|
+
|
|
645
|
+
Allows overriding title of the :rst:dir:`lua:autoindex` section.
|
|
646
|
+
|
|
647
|
+
.. rst:directive:: .. lua:autoindex:: name
|
|
648
|
+
|
|
649
|
+
Creates a table that references all documented objects in the module ``name``.
|
|
650
|
+
This is useful for creating module's table of contents.
|
|
651
|
+
|
|
652
|
+
Module name must be absolute, even if this directive appears after
|
|
653
|
+
:rst:dir:`lua:module`.
|
|
588
654
|
|
|
589
655
|
Controlling generation from code comments
|
|
590
656
|
-----------------------------------------
|
|
@@ -617,6 +683,41 @@ that a certain variable should be documented as :rst:dir:`lua:const`:
|
|
|
617
683
|
--- @type string
|
|
618
684
|
foo = "bar!"
|
|
619
685
|
|
|
686
|
+
.. _apidoc:
|
|
687
|
+
|
|
688
|
+
Automatic API reference generation
|
|
689
|
+
----------------------------------
|
|
690
|
+
|
|
691
|
+
:rst:dir:`lua:autoobject` allows recursively generating documentation,
|
|
692
|
+
however it all ends up on a single page. If you want to give a separate page
|
|
693
|
+
for every module, you'll need to create multiple ``.rst`` files.
|
|
694
|
+
Fortunately, Lua autodoc can do this for you.
|
|
695
|
+
|
|
696
|
+
Add :py:data:`lua_ls_apidoc_roots` option to the ``conf.py``, and provide a mapping
|
|
697
|
+
from module names to directories (relative to the location of ``conf.py``)
|
|
698
|
+
where generated ``.rst`` files should be placed.
|
|
699
|
+
|
|
700
|
+
For example, to generate API reference for module ``moduleName``
|
|
701
|
+
in directory ``moduleDirectory``, add the following:
|
|
702
|
+
|
|
703
|
+
.. code-block:: python
|
|
704
|
+
|
|
705
|
+
lua_ls_apidoc_roots = {
|
|
706
|
+
"moduleName": "moduleDirectory",
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
Upon start, autodoc will recursively create ``.rst`` files in ``moduleDirectory``.
|
|
710
|
+
``moduleDirectory/index.rst`` will contain reference for ``moduleName``.
|
|
711
|
+
Then, for every submodule of ``moduleName``, there will be another ``.rst`` generated.
|
|
712
|
+
|
|
713
|
+
.. warning::
|
|
714
|
+
|
|
715
|
+
Do not add any other files to ``moduleDirectory``, otherwise they will be deleted.
|
|
716
|
+
|
|
717
|
+
It is best to add ``moduleDirectory`` to your ``.gitignore`` file.
|
|
718
|
+
|
|
719
|
+
Don't forget to include ``moduleDirectory/index.rst`` into a table of contents
|
|
720
|
+
in your main ``index.rst``.
|
|
620
721
|
|
|
621
722
|
Settings
|
|
622
723
|
--------
|
|
@@ -658,12 +759,12 @@ Settings
|
|
|
658
759
|
.. code-block:: python
|
|
659
760
|
|
|
660
761
|
lua_ls_default_options = {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
762
|
+
# Enable documentation for object's members.
|
|
763
|
+
# Empty string means documenting all members with non-empty description.
|
|
764
|
+
"members": "",
|
|
765
|
+
# Set ordering of automatically generated content to alphabetical.
|
|
766
|
+
"member-order": "alphabetical",
|
|
767
|
+
# And so on...
|
|
667
768
|
}
|
|
668
769
|
|
|
669
770
|
.. py:data:: lua_ls_lua_version: str
|
|
@@ -671,6 +772,61 @@ Settings
|
|
|
671
772
|
Controls which documentation version is used when linking
|
|
672
773
|
to standard library functions. Does not otherwise affect parsing or generation.
|
|
673
774
|
|
|
775
|
+
.. py:data:: lua_ls_apidoc_roots: dict[str, str | dict[str, Any]]
|
|
776
|
+
|
|
777
|
+
Roots for `apidoc <automatic generation of API files>`_. Keys are full module names
|
|
778
|
+
that should be generated, and values are directories (relative to the location
|
|
779
|
+
of ``conf.py``) where ``.rst`` files are placed.
|
|
780
|
+
|
|
781
|
+
Additionally, you can override other apidoc settings for each root. For this,
|
|
782
|
+
make root's value a dictionary with keys ``path``,
|
|
783
|
+
:py:data:`max_depth <lua_ls_apidoc_max_depth>`,
|
|
784
|
+
:py:data:`options <lua_ls_apidoc_default_options>`,
|
|
785
|
+
and :py:data:`ignored_modules <lua_ls_apidoc_ignored_modules>`:
|
|
786
|
+
|
|
787
|
+
.. code-block:: python
|
|
788
|
+
|
|
789
|
+
lua_ls_apidoc_roots = {
|
|
790
|
+
"moduleName": {
|
|
791
|
+
"path": "moduleDirectory",
|
|
792
|
+
"max_depth": 2,
|
|
793
|
+
"options": {
|
|
794
|
+
"undoc-members": "",
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
.. py:data:: lua_ls_apidoc_default_options: dict[str, str]
|
|
800
|
+
|
|
801
|
+
Default options for objects documented via apidoc. Override
|
|
802
|
+
:py:data:`lua_ls_default_options`.
|
|
803
|
+
|
|
804
|
+
.. py:data:: lua_ls_apidoc_max_depth: int
|
|
805
|
+
|
|
806
|
+
Maximum nesting level for files. Submodules that are deeper than this level
|
|
807
|
+
will not get their own file, and instead will be generated inline.
|
|
808
|
+
|
|
809
|
+
Default value is ``4``.
|
|
810
|
+
|
|
811
|
+
.. py:data:: lua_ls_apidoc_ignored_modules: list[str]
|
|
812
|
+
|
|
813
|
+
List of full submodule names that should be ignored while generating APIs.
|
|
814
|
+
Submodules can contain :py:mod:`fnmatch` style globs.
|
|
815
|
+
|
|
816
|
+
For example, the following setting
|
|
817
|
+
|
|
818
|
+
.. code-block:: python
|
|
819
|
+
|
|
820
|
+
lua_ls_apidoc_roots = {
|
|
821
|
+
"moduleName": "moduleDirectory",
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
lua_ls_apidoc_ignored_modules = [
|
|
825
|
+
"moduleName.submoduleName"
|
|
826
|
+
]
|
|
827
|
+
|
|
828
|
+
will generate API for module ``moduleName``, but will not include
|
|
829
|
+
``moduleName.submoduleName``.
|
|
674
830
|
|
|
675
831
|
Example output
|
|
676
832
|
--------------
|
|
@@ -47,7 +47,7 @@ test = [
|
|
|
47
47
|
]
|
|
48
48
|
doc = [
|
|
49
49
|
"sybil~=6.1",
|
|
50
|
-
"
|
|
50
|
+
"furo>=2024",
|
|
51
51
|
"sphinx_design>=0.6"
|
|
52
52
|
]
|
|
53
53
|
|
|
@@ -58,7 +58,7 @@ Source = "https://github.com/taminomara/sphinx-lua-ls/"
|
|
|
58
58
|
Changelog = "https://github.com/taminomara/sphinx-lua-ls/blob/main/CHANGELOG.md"
|
|
59
59
|
|
|
60
60
|
[build-system]
|
|
61
|
-
requires = ["setuptools>=
|
|
61
|
+
requires = ["setuptools>=60", "setuptools_scm[toml]>=8", "wheel>=0.40"]
|
|
62
62
|
|
|
63
63
|
[tool.setuptools_scm]
|
|
64
64
|
write_to = "sphinx_lua_ls/_version.py"
|