Skip to content

Commit c0b18e4

Browse files
authored
docs(#3088): add nvim-tree.api* function and class meta, generate help API, lazy load API before setup, rename some API in a non-breaking manner (#3244)
* doc(#2934): POC to use gen_vimdoc.lua for decorator meta * doc(#2934): use injected gen_vimdoc.lua from nvim source, move decorators to main help * doc(#2934): tidy and harden scripts * doc(#2934): add nvim_tree.Config meta classes, add nvim_tree.api. meta classes * doc(#2934): add nvim_tree.Config to help * doc(#2934): add nvim_tree.api classes to help * doc(#2934): tidy and correct nvim_tree.Config.UI and nvim_tree.Config.Actions * doc(#2934): tidy and correct nvim_tree.Config.HijackDirectories, format and order nvim_tree.Config * doc(#2934): tidy and nvim_tree.Config top level * doc(#2934): tidy and format nvim_tree.Config.LiveFilter, Modified, Tab, Trash * doc(#2934): tidy and format nvim_tree.Config.FilesystemWatchers, Log * doc(#2934): split nvim_tree.Config into files, Sort and HijackDirectories populate others placeholder * doc(#2934): more generic gen_vimdoc_config module config * doc(#2934): tidy Config.HijackDirectories and Actions, move them into place * doc(#2934): tidy Config.Modified, move into place * doc(#2934): tidy Config.LiveFilter, move into place * doc(#2934): tidy Config.FilesystemWatchers, move into place * doc(#2934): tidy Config.Trash, move into place * doc(#2934): tidy Config.Tab, move into place * doc(#2934): tidy Config.UI, move into place * doc(#2934): tidy Config.Log, move into place * doc(#2934): tidy Config.Notify, move into place * doc(#2934): tidy Config.SystemOpen, move into place * doc(#2934): tidy Config.Help, move into place * doc(#2934): tidy Config.Help, move into place * doc(#2934): tidy Config.Help, move into place * doc(#2934): tidy Config.Diagnostics, move into place * doc(#2934): remove api/decorator as they are out of scope, revert api_decorator.lua changes, retain api opts classes but make them exact * doc(#2934): tidy Config.Filters, move into place * doc(#2934): tidy Config.FilesystemWatchers, move into place * doc(#2934): tidy Config.FilesystemWatchers, Git, move into place * doc(#2934): tidy Config.UpdateFocusedFile, move into place * doc(#2934): tidy Config.Sort, move into place * doc(#2934): tidy Config.View, move into place * doc(#2934): tidy Config.View, move into place * docs(#2934): type DEFAULT_OPTS, use bracketed references to keep luals happy * docs(#2934): tidy, inline some classes * docs(#2934): tidy Config.Renderer * docs(#2934): remove problematic glyphs, tidy other glyphs * docs(#2934): tidy Config.Renderer, ensure functions are parenthesised when necessary * docs(#2934): tidy Config.Renderer * docs(#2934): tidy Config.Renderer, move into place * docs(#2934): tidy Config.Renderer * docs(#2934): tidy Config.FilesystemWatchers * docs(#2934): fix broken links * docs(#2934): fix broken links * docs(#2934): fix broken links * docs(#2934): fix broken links * docs(#2934): refer to nvim in help, not neovim, as this trips the lintdoc spell checker * docs(#2934): fix broken links * docs(#2934): add lintdoc.sh, fix some branding spelling * docs(#2934): update old config links * docs(#2934): remove 5. Opts, 8.2 Highlight: Overhaul, 15.1 Index: Opts, update links as needed * docs(#2934): remove indices * docs(#2934): add bookmarks, put long descriptions into @brief * docs(#2934): move hidden display to verbatim new section * docs(#2934): add config lsp examples, link setup * docs(#2934): normalise heading formatting, remove TOC * docs(#2934): move all icon and highlight info into a table * docs(#2934): move all icon and highlight info into a new section * docs(#2934): normalise all icon and highlight * docs(#2934): extract nvim_tree.Config field descriptions to class overview * docs(#2934): consistent string formatting * docs(#2934): normalise all icon and highlight * docs(#2934): remove @Briefs as they are shown above the class tag * docs(#2934): don't <pre> filters * docs(#2934): add experimental example * docs(#2934): add gen_vimdoc.sh to CI * docs(#2934): add gen_vimdoc.sh to CI * docs(#2934): add gen_vimdoc.sh to CI * docs(#2934): temporarily --ignore-blank-lines during help check * docs(#2934): add lintdoc.sh to CI * docs(#2934): add lintdoc.sh to CI * docs(#2934): add lintdoc.sh to CI * docs(#2934): move Nvim build and help-check to the end for faster turnaround * docs(#2934): use make lintdoc target directly * docs(#2934): CONTRIBUTING.md updates for help generation and lint * docs(#2934): revert API opts classes changes * docs(#2934): harden gen and lint scripts, moving things out of nvim-tree source to prevent luals upset * docs(#2934): harden gen and lint scripts, moving things out of nvim-tree source to prevent luals upset * docs(#2934): fix lintdoc make target * docs(#3088): extract api/tree.lua * docs(#3088): extract api/tree.lua * docs(#2934): move help diff check after lint * docs(#3088): update api.tree references, remove old doc * docs(#3088): extract api/config/mappings.lua * docs(#3088): api.config.mappings -> api.map * docs(#3088): extract api/filter.lua * docs(#3088): move api.git into api.tree * docs(#3088): extract api/health.lua, tidy formatting * docs(#3088): extract api/health.lua, tidy formatting * docs(#3088): remove command descriptions, show lua, link to api * docs(#3088): extract api/marks.lua * docs(#3088): remove completed legacy api.lua members * docs(#3088): extract api/events.lua * docs(#3088): extract api/events.lua * docs(#3088): extract api/fs.lua * docs(#3088): extract api/commands.lua * docs(#3088): extract api/node.lua functions, doc TODO * docs(#3088): move all nvim-tree-api to generated doc * docs(#3088): old api is now impl, use new api * docs(#3088): extract api/node.lua functions, doc WIP * docs(#3088): extract api/node.lua functions, doc WIP * docs(#3088): extract api/node.lua functions, doc WIP * docs(#3088): extract api/node.lua functions * docs(#3088): move api into _meta * docs(#3088): move api-impl out of meta, restore it to its original state with a hyrdrate function * docs(#3088): remove old Api classes, rename impl Api -> api * docs(#3088): tidy migrated annotations * docs(#3088): format nvim_tree.api.commands * docs(#3088): separate api classes at the end * docs(#3088): polish vimdoc config * docs(#3088): format * docs(#2934): polish vimdoc config * docs(#2934): snake case config class names * docs(#2934): snake case config alias names * docs(#2934): note help tag prefixes * docs(#2934): snake case config sections * docs(#2934): move default config to end * docs(#2934): move setup doc from config to quickstart and setup * docs(#2934): index contributing * docs(#3088): cleanup following merge * docs(#3088): tidy section names * docs(#3088): split node.navigate and open, move all filters into api.filter * docs(#3088): hidden->custom toggle default desc * docs(#3088): add legacy filter api mappings * docs(#3088): tidy api meta * docs(#3088): always exclude meta from luacheck, it doesn't offer anything useful * docs(#3088): extract fs.copy, fix api node param optionality, move legacy api to legacy.lua * docs(#3088): correct optionality of nvim_tree.config.view.width fields * docs(#3088): hydrate API before setup with error functions, with some hydrated with their concrete function, wrap removal TODO * docs(#3088): remove api impl error wrap * docs(#3088): split api pre and post, add more comments * docs(#3088): split api pre and post, add more comments * docs(#3088): extract post impl functions, lazy some requires * docs(#3088): lazy api impl requires * Revert "docs(#3088): lazy api impl requires" This reverts commit c6ea6c5. * docs(#3088): minimise api pre following tests * docs(#3088): move node classes under api with logical order * docs(#3088): document node and git classes, namespace internal and external git classes, redact node subclasses * docs(#3088): fix merge issue * docs(#3088): tidy pre comments * docs(#3088): collapse node and fs submodules * docs(#3088): move api help and classes back into api.lua * docs(#3088): resize command calls api, not view * docs(#3088): tidy api map names * docs(#3088): revert api.git refactor, provide deprecated api meta * docs(#3088): add deprecated api @see * docs(#3088): class fixes following merge, disable luacheck on scripts * docs(#3088): Node:should_expand nops * docs(#3088): fix _git return * docs(#3088): add meta for legacy api * docs(#3088): mark deprecated api modules, use proper namespacing for deprecateds * docs(#3088): gen_vimdoc now uses full paths, requires a patch for a FIXME * docs(#3088): add vim_gendoc patches * Revert "docs(#3088): add vim_gendoc patches" This reverts commit ebb9909. * Revert "docs(#3088): gen_vimdoc now uses full paths, requires a patch for a FIXME" This reverts commit ff0184a. * docs(#3088): split gen_vimdoc_config into chunks to avoid filename clashes, as gen_vimdoc keys sections by filename * docs(#3088): move legacy api into api.impl.legacy, fixes following testing * docs(#3088): remove merge leftover * docs(#3088): tidy contrib * docs(#3088): clarify backwards compatibility * docs(#3088): clarify help generation in contributing * docs(#3088): contributing index * docs(#3088): help-update.sh -> help-defaults.sh now using a /tmp file to prevent runaway FS updates * docs(#3088): help-update.sh -> help-defaults.sh now using a /tmp file to prevent runaway FS updates * docs(#3088): CI runs make lintdoc to avoid muddying help-check with unnecessary build and possible Nvim lint failures * docs(#3088): unify help and readme, clarify some wording * docs(#3088): test a readme toc * docs(#3088): test a readme toc * docs(#3088): unify help generation and lint into vimdoc.sh, generation uses nvim source build to execute (#3260) * docs(#3241): unify help generation and lint into vimdoc.sh, generation uses nvim source build to execute * docs(#3241): unify help generation and lint into vimdoc.sh, generation uses nvim source build to execute * docs(#3241): unify help generation and lint into vimdoc.sh, generation uses nvim source build to execute * docs(#3241): unify help generation and lint into vimdoc.sh, generation uses nvim source build to execute
1 parent 037d89e commit c0b18e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4348
-3133
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ jobs:
8282
mkdir -p "${DIR_NVIM_SRC}"
8383
curl -L "https://github.com/neovim/neovim/archive/refs/tags/${{ matrix.nvim_version }}.tar.gz" | tar zx --directory "${DIR_NVIM_SRC}/.."
8484
cd "${DIR_NVIM_SRC}"
85-
make
85+
make doc
86+
make lintdoc
8687
8788
- run: make help-check

CONTRIBUTING.md

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ markdown-toc --maxdepth=2 -i CONTRIBUTING.md
1818
* [check](#check)
1919
- [Diagnostics](#diagnostics)
2020
- [Backwards Compatibility](#backwards-compatibility)
21-
- [Documentation](#documentation)
22-
* [Config And Mappings](#config-and-mappings)
23-
* [API](#api)
21+
- [:help Documentation](#help-documentation)
22+
* [Generated Content](#generated-content)
23+
* [Updating And Generating](#updating-and-generating)
24+
* [Checking And Linting](#checking-and-linting)
2425
- [Windows](#windows)
2526
- [Pull Request](#pull-request)
2627
* [Subject](#subject)
@@ -60,7 +61,7 @@ make lint
6061
## style
6162

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

6566
```sh
6667
make style
@@ -86,11 +87,11 @@ Assumes `$VIMRUNTIME` is `/usr/share/nvim/runtime`. Adjust as necessary e.g.
8687
VIMRUNTIME="/my/path/to/runtime" make check
8788
```
8889

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.
90+
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.
9091

9192
```sh
9293
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
94+
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
9495

9596
PATH="luals/bin:${PATH}" make check
9697
```
@@ -119,36 +120,62 @@ else
119120
end
120121
```
121122

122-
# Documentation
123+
# :help Documentation
123124

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

126-
When adding to or changing:
127-
1. Default config
128-
2. `config` classes
129-
3. `on_attach` default mappings
127+
## Generated Content
130128

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

133153
```sh
134154
make help-update
135155
```
136156

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

142-
Commit your changes then run:
143172
```sh
144173
make help-check
145174
```
146175

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

153180
# Windows
154181

Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ check: luals
1212
#
1313
# subtasks
1414
#
15-
# TODO #3241 ensure that decorator is checked - all meta should be valid
1615
luacheck:
17-
luacheck --codes --quiet lua --exclude-files "**/_meta/api_decorator.lua"
18-
luacheck --codes --quiet scripts
16+
luacheck --codes --quiet lua --exclude-files "**/_meta/**"
1917

2018
style-check:
2119
scripts/luals-check.sh codestyle-check
@@ -36,15 +34,15 @@ style-fix:
3634
# utility
3735
#
3836
help-update:
39-
scripts/gen_vimdoc.sh
40-
scripts/help-update.sh
37+
scripts/vimdoc.sh doc
38+
scripts/help-defaults.sh
4139

4240
#
4341
# CI
4442
# --ignore-blank-lines is used as nightly has removed unnecessary blank lines that stable (0.11.5) currently inserts
4543
#
4644
help-check: help-update
47-
scripts/lintdoc.sh
45+
scripts/vimdoc.sh lintdoc
4846
git diff --ignore-blank-lines --exit-code doc/nvim-tree-lua.txt
4947

5048

0 commit comments

Comments
 (0)