Skip to content

Commit 984378f

Browse files
committed
docs(#3088): clarify help generation in contributing
1 parent 1853d32 commit 984378f

3 files changed

Lines changed: 51 additions & 24 deletions

File tree

CONTRIBUTING.md

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ make lint
6060
## style
6161

6262
1. Runs lua language server `codestyle-check` only, using `.luarc.json` settings
63-
1. Runs `scripts/doc-comments.sh` to validate annotated documentation
63+
1. Runs `scripts/doc-comments.sh` to normalise annotated documentation
6464

6565
```sh
6666
make style
@@ -86,11 +86,11 @@ Assumes `$VIMRUNTIME` is `/usr/share/nvim/runtime`. Adjust as necessary e.g.
8686
VIMRUNTIME="/my/path/to/runtime" make check
8787
```
8888

89-
If `lua-language-server` is not available or `--check` doesn't function (e.g. Arch Linux 3.9.1-1) you can manually install it as per `ci.yml` e.g.
89+
If `lua-language-server` is not available or `--check` doesn't function (e.g. Arch Linux 3.9.1-1) you can manually install it as per `ci.yml` using its current `luals_version` e.g.
9090

9191
```sh
9292
mkdir luals
93-
curl -L "https://github.com/LuaLS/lua-language-server/releases/download/3.9.1/lua-language-server-3.9.1-linux-x64.tar.gz" | tar zx --directory luals
93+
curl -L "https://github.com/LuaLS/lua-language-server/releases/download/3.15.0/lua-language-server-3.15.0-linux-x64.tar.gz" | tar zx --directory luals
9494

9595
PATH="luals/bin:${PATH}" make check
9696
```
@@ -119,39 +119,62 @@ else
119119
end
120120
```
121121

122-
# Documentation
122+
# :help Documentation
123123

124-
## Config And Mappings
124+
Please update or add to `doc/nvim-tree-lua.txt` as needed.
125125

126-
When adding to or changing:
127-
1. Default config
128-
2. `Config` classes
129-
3. `keymap.on_attach_default`
130-
4. Any API
126+
## Generated Content
131127

132-
You must generate help documentation. This requires neovim stable sources. You will be promted with instructions on fetching and referencing the source.
128+
`doc/nvim-tree-lua.txt` content starting at `*nvim-tree-config*` will be replaced with generated content. Do not manually edit that content.
129+
130+
### API and Config
131+
132+
Help is generated for:
133+
- `nvim_tree.config` classes from `lua/nvim-tree/_meta/config/`
134+
- `nvim_tree.api` functions from `lua/nvim-tree/_meta/api/`
135+
136+
Please add or update documentation when you make changes, see `:help dev-lua-doc` for docstring format.
137+
138+
`scripts/gen_vimdoc_config.lua` contains the manifest of help sources.
139+
140+
### Config And Mappings
141+
142+
Help is updated for:
143+
- Default keymap at `keymap.on_attach_default`
144+
- Default config at `--- default-config-start`
145+
146+
## Updating And Generating
147+
148+
Nvim sources are required. You will be prompted with instructions on fetching and using the sources.
149+
150+
See comments at the start of each script for complete details.
133151

134152
```sh
135153
make help-update
136154
```
137155

138-
This will:
139-
1. Update config defaults in `*nvim-tree-setup*`
140-
2. Update default mappings in `*nvim-tree-mappings-default*` and `*nvim-tree-quickstart-help*`
141-
3. Regenerate from `*nvim-tree-config*` to the end of the file, see `gen_vimdoc.sh`
142-
- Config classes
143-
- API classes and functions
156+
- `scripts/help-update.sh`
157+
- Update config defaults `*nvim-tree-setup*`
158+
- Update default mappings:
159+
- `*nvim-tree-mappings-default*`
160+
- `*nvim-tree-quickstart-help*`
161+
162+
- `scripts/gen_vimdoc.sh`
163+
- Remove content starting at `*nvim-tree-config*`
164+
- Generate config classes `*nvim-tree-config*`
165+
- Generate API `*nvim-tree-api*`
166+
167+
## Checking And Linting
168+
169+
This is run in CI. Commit or stage your changes and run:
144170

145-
Commit or stage your changes then run:
146171
```sh
147172
make help-check
148173
```
149174

150-
This will re-run `help-update` and check that there are no diffs. It will also lint the documentation, see `lintdoc.sh`
151-
152-
## API
153-
154-
When adding or changing API please update :help nvim-tree-api
175+
- Re-runs `make help-update`
176+
- Checks that `git diff` is empty, to ensure that all content has been generated. This is why a stage or commit is necessary.
177+
- Lints `doc/nvim-tree-lua.txt` using `scripts/lintdoc.sh` to check for no broken links etc.
155178

156179
# Windows
157180

doc/nvim-tree-lua.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Help tag prefixes:
77
|nvim-tree-mappings|
88
|nvim-tree-config|
99
`nvim_tree.` API and classes e.g.
10+
|nvim_tree.api.node.navigate.parent()|
1011
|nvim_tree.config.filesystem_watchers|
1112

1213
==============================================================================

scripts/gen_vimdoc.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#
55
# Doesn't require Nvim to have been built.
66
#
7-
# Shims our moudules into gen_vimdoc_config.lua, replacing Nvim's.
7+
# Generated from nvim-tree sources defined in scripts/gen_vimdoc_config.lua
8+
#
9+
# Shims our sources into src/gen/gen_vimdoc.lua replacing Nvim's.
810
#
911
# There are some hardcoded expectations which we work around as commented.
1012

@@ -39,6 +41,7 @@ Please:
3941
mkdir -p ${DIR_NVIM_SRC_DEF}
4042
curl -L 'https://github.com/neovim/neovim/archive/refs/tags/stable.tar.gz' | tar zx --directory $(dirname "${DIR_NVIM_SRC_DEF}")
4143
export DIR_NVIM_SRC=/tmp/src/neovim-stable
44+
4245
EOM
4346
exit 1
4447
fi

0 commit comments

Comments
 (0)