aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-08-25 09:06:37 +0200
committerGitHub <noreply@github.com>2022-08-25 09:06:37 +0200
commit5c9baa6f35262f75b73a82e4b2eba8f7cdf9db0a (patch)
treea1c1485a490a57af4ffe468e21b9308e6c0ca718
parent170617c7a2183f9d5df84bfc89317be44ec9ac2e (diff)
downloadrneovim-5c9baa6f35262f75b73a82e4b2eba8f7cdf9db0a.tar.gz
rneovim-5c9baa6f35262f75b73a82e4b2eba8f7cdf9db0a.tar.bz2
rneovim-5c9baa6f35262f75b73a82e4b2eba8f7cdf9db0a.zip
docs(contributing): add documenting guidelines from wiki (#19924)
Co-authored-by: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
-rw-r--r--CONTRIBUTING.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 95f26d4722..582d5fbdd4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -266,6 +266,41 @@ For managing includes in C files, use [include-what-you-use].
See [#549][549] for more details.
+Documenting
+-----------
+
+Many parts of the `:help` documentation are autogenerated from C or Lua docstrings using the `./scripts/gen_vimdoc.py` script.
+You can filter the regeneration based on the target (api, lua, or lsp), or the file you changed, that need a doc refresh using `./scripts/gen_vimdoc.py -t <target>`.
+
+## Lua docstrings
+
+Lua documentation uses a subset of [EmmyLua] annotations. A rough outline of a function documentation is
+
+```lua
+--- {Brief}
+---
+--- {Long explanation}
+---
+---@param arg1 type {description}
+---@param arg2 type {description}
+{...}
+---
+---@return type {description}
+```
+
+If possible, always add type information (`table`, `string`, `number`, ...). Multiple valid types are separated by a bar (`string|table`). Indicate optional parameters via `type|nil`.
+
+If a function in your Lua module should not be documented (e.g. internal function or local function), you should set the doc comment to:
+
+```
+---@private
+```
+
+Mark functions that are deprecated as
+```
+---@deprecated
+```
+
Reviewing
---------
@@ -292,6 +327,7 @@ as context, use the `-W` argument as well.
[Merge a Vim patch]: https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow
[conventional_commits]: https://www.conventionalcommits.org
+[EmmyLua]: https://github.com/sumneko/lua-language-server/wiki/Annotations
[gcc-warnings]: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
[gh]: https://cli.github.com/
[git-bisect]: http://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git