Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,5 @@ jobs:
curl -L "https://github.com/neovim/neovim/archive/refs/tags/${{ matrix.nvim_version }}.tar.gz" | tar zx --directory "${DIR_NVIM_SRC}/.."
cd "${DIR_NVIM_SRC}"
make doc
make lintdoc

- run: make help-check
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ make help-update
- Generate config classes `*nvim-tree-config*`
- Generate API `*nvim-tree-api*`

## Checking And Linting
## Checking

This is run in CI. Commit or stage your changes and run:

Expand All @@ -194,7 +194,6 @@ make help-check

- Re-runs `make help-update`
- Checks that `git diff` is empty, to ensure that all content has been generated. This is why a stage or commit is necessary.
- Lints `doc/nvim-tree-lua.txt` using `scripts/vimdoc.sh lintdoc` to check for no broken links etc.

# Windows

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ help-update:
# CI
#
help-check: help-update
scripts/vimdoc.sh lintdoc
git diff --exit-code doc/nvim-tree-lua.txt


Expand Down
33 changes: 16 additions & 17 deletions scripts/vimdoc.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
#!/usr/bin/env sh

# Wrapper around Nvim make targets:
# Wrapper around Nvim make doc target:
#
# make doc - gen_vimdoc.lua
# Generates doc/nvim-tree-lua.txt
# Uses nvim-tree sources defined in scripts/vimdoc_config.lua
# Shims above into src/gen/gen_vimdoc.lua, replacing Nvim's config.
#
# make lintdoc - lintdoc.lua
# Validates doc/nvim-tree-lua.txt
# Desired:
# - tags valid
# - links valid
# Also:
# - brand spelling, notably Nvim and Lua
# Generates doc/nvim-tree-lua.txt
# Uses nvim-tree sources defined in scripts/vimdoc_config.lua
# Shims above into src/gen/gen_vimdoc.lua, replacing Nvim's config.
#
# There are some hardcoded expectations which we work around as commented.

set -e

if [ $# -ne 1 ] || [ "${1}" != "doc" ] && [ "${1}" != "lintdoc" ]; then
echo "usage: ${0} <doc|lintdoc>" 1>&2
if [ $# -ne 1 ] || [ "${1}" != "doc" ]; then
echo "usage: ${0} <doc>" 1>&2
exit 1
fi

Expand All @@ -38,7 +29,7 @@ fi
if [ ! -d "${DIR_NVIM_SRC}" ]; then
cat << EOM

Nvim source v0.11+ is required to run ${0}
Nvim stable source is required to run ${0}

Unavailable: ${DIR_NVIM_SRC_DEF} or \$DIR_NVIM_SRC=${DIR_NVIM_SRC}

Expand Down Expand Up @@ -84,7 +75,15 @@ if [ "${1}" = "doc" ]; then

# modify gen_vimdoc.lua to use our config, backing up original
cp "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua" "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua.org"
sed -i -E 's/spairs\(config\)/spairs\(require("gen.vimdoc_config")\)/g' "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua"
sed -i -E '

# use our config
s/spairs\(config\)/spairs\(require("gen.vimdoc_config") --[[injected by nvim-tree]]\)/g ;

# remove the name linter
s/(^run\(\)$)/\n--injected by nvim-tree\nlint.lint_names = function\(\)\nend\n\n\1 --/g

' "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua"

# leave a generic placeholder to bridge between nvim.gen_vimdoc.Config
echo "---@brief placeholder" > "${DIR_NVIM_SRC}/runtime/lua/placeholder.lua"
Expand Down
Loading