robin/laufey
tiny neovim fork for cozy coding
git clone https://git.robinwobin.dev/robin/laufey
3b00ddb601
master
Maintaining the Neovim project
Notes on maintaining the Neovim project.
General guidelines
- Decide by cost-benefit
- Write down what was decided
- Constraints are good
- Use automation to solve problems
- Never break the API... but sometimes break the UI
Issue triage
In practice we haven't found a way to forecast more precisely than "next" and "after next". So there are usually one or two (at most) planned milestones:
- Next bugfix-release (1.0.x)
- Next feature-release (1.x.0)
The forecasting problem might be solved with an explicit priority system (like Vim's todo.txt). Meanwhile the Neovim priority system is defined by:
- PRs nearing completion.
- Issue labels. E.g. the
has:planlabel increases the ticket's priority merely for having a plan written down: it is closer to completion than tickets without a plan. - Comment activity or new information.
Anything that isn't in the next milestone, and doesn't have a finished PR—is just not something you care very much about, by construction. Post-release you can review open issues, but chances are your next milestone is already getting full... :)
Release policy
Release "often", but not "early".
The (unreleased) master branch is the "early" channel; it should not be
released if it's not stable. High-risk changes may be merged to master if
the next release is not imminent.
For maintenance releases, create a release-x.y branch. If the current release
has a major bug:
- Fix the bug on
master. - Cherry-pick the fix to
release-x.y. - Cut a release from
release-x.y.- Run
./scripts/release.sh(requires git cliff) - The CI job will update the release assets and force-push to the "stable" tag.
- Run
Release automation
Neovim automation includes a backport bot.
Trigger the action by labeling a PR with ci:backport release-x.y. See .github/workflows/backport.yml.
Deprecating and removing features
Neovim inherits many features and design decisions from Vim, not all of which align with the goals of this project. It is sometimes desired or necessary to remove existing features, or refactor parts of the code that would change user's workflow. In these cases, a deprecation policy is needed to properly inform users of the change.
When a (non-experimental) feature is slated to be removed it should:
- Be soft deprecated in the next release
- Use of the deprecated feature will still work.
- This means deprecating via documentation and annotation (
@deprecated). - Include a note in
deprecated.txt. - For Lua features, use
vim.deprecate(). The specified version is the current minor version + 2. For example, if the current version isv0.10.0-dev-1957+gd676746c33then use0.12. - For Vimscript features, use
v:lua.vim.deprecate(). Use the same version as described for Lua features. vim.deprecate(…, 'x.y.z')where major versionxis greater than the current Nvim major version, is always treated as soft deprecation.
- Be hard deprecated in a release following the release in which it was soft deprecated.
- Use of the deprecated feature will still work but should issue a warning.
- Features implemented in C will need bespoke implementations to communicate to users that the feature is deprecated.
- Be removed in a release following the release in which it was hard deprecated
- Usually this will be the next release, but it may be a later release if a longer deprecation cycle is desired
- If possible, keep the feature as a stub (e.g. function API) and issue an error when it is accessed.
Example:
Deprecation Removal
┆ ┆ ┆
┆ Soft ┆ Hard ┆
┆ Deprecation ┆ Deprecation ┆
┆ Period ┆ Period ┆
────────────────────────────────────────────────────────────
Version: 0.10 0.11 0.12
────────────────────────────────────────────────────────────
Old code Old code Old code
+ +
New code New code New code
Feature removals which may benefit from community input or further discussion should also have a tracking issue (which should be linked to in the release notes).
Exceptions to this policy may be made (for experimental subsystems or when there is broad consensus among maintainers). The rationale for the exception should be stated explicitly and publicly.
Dependencies
Third-party dependencies
(Note: keep this in sync with the "external" section of LICENSE.txt).
(TODO: declare deps in sbom.json, CycloneDX SBOM format).
"Bundled" dependencies can be updated by bumping their versions in cmake.deps/deps.txt.
Some can be auto-bumped by scripts/bump_deps.lua.
- LuaJIT
- Lua
- libuv
- Requires a PR to update the Zig package first. If the script fails, run
zig fetch --save git+https://github.com/allyourcodebase/libuv.git#<refname>manually.
- Requires a PR to update the Zig package first. If the script fails, run
- Luv
- When bumping, also sync
- gettext
- libiconv
- Requires a PR to update the Zig package first.
- lua-compat
- tree-sitter
- treesitter parsers
- (Deprecated) unibilium
- The original project was abandoned, so the neovim/unibilium fork is considered "upstream" and is maintained on the
masterbranch. - Note: unibilium is NOT required. See BUILD.md to build Nvim without unibilium.
- The original project was abandoned, so the neovim/unibilium fork is considered "upstream" and is maintained on the
Vendored dependencies
"Vendored" (inlined) dependencies are part of the repo tree and we must update the sources manually:
src/mpack/: libmpack- send improvements upstream!
src/mpack/lmpack.c: libmpack-lua- send improvements upstream!
src/xdiff/: xdiffsrc/cjson/: lua-cjsonsrc/klib/: Klibsrc/lpeg/: Lpeg- Apply the patch from
src/lpeg/README.mdwhen syncing with upstream.
- Apply the patch from
runtime/lua/vim/inspect.lua: inspect.luasrc/nvim/tui/terminfo_defs.h: terminfo definitions- Run
scripts/update_terminfo.shto update these definitions.
- Run
runtime/lua/vim/lsp/_meta/protocol.lua: LSP specification- Run
src/gen/gen_lsp.luato update.
- Run
runtime/lua/vim/_meta/lpeg.lua: LPeg definitions.- Refer to
LuaCATS/lpegfor updates. - Update the git SHA revision from which the documentation was taken.
- Refer to
runtime/lua/vim/re.lua: LPeg regex module.- Vendored from LPeg. Needs to be updated when LPeg is updated.
runtime/lua/vim/_meta/re.lua: docs for LPeg regex module.- Needs to be updated when LPeg is updated.
src/bit.c: only for PUC lua: port ofrequire'bit'from luajit https://bitop.luajit.org/runtime/lua/coxpcall.lua: coxpcall (only needed for PUC lua, builtin to luajit)
Operational dependencies
- GitHub users:
- https://github.com/marvim
- https://github.com/nvim-winget
- Org secrets/tokens:
CODECOV_TOKENBACKPORT_KEY
- Org/repo variables:
BACKPORT_APP
- Domain names (held in https://namecheap.com):
- neovim.org
- neovim.io
- packspec.org
- pkgjson.org
- The above domains are registered and managed in https://cloudflare.com
Refactoring
Frozen legacy modules
Refactoring Vim structurally and aesthetically is an important goal of Neovim. But there are some modules that should not be changed significantly, because they are maintained by Vim, at present. Until someone takes "ownership" of these modules, the cost of any significant changes (including style or structural changes that re-arrange the code) to these modules outweighs the benefit. The modules are:
regexp.cindent_c.c
Automation (CI)
Backup
Discussions from issues and PRs are backed up here: https://github.com/neovim/neovim-backup
Development guidelines
- CI and automation jobs are primarily driven by GitHub Actions.
- Avoid macOS if an Ubuntu or a Windows runner can be used instead. This is because macOS runners have tighter restrictions on the number of concurrent jobs.
- Runner versions:
- For special-purpose jobs where the runner version doesn't really matter,
prefer
-latesttags so we don't need to manually bump the versions. An example of a special-purpose workflow islabeler_pr.yml. - For our testing job
test.yml, prefer to use the latest version explicitly. Avoid using the-latesttags here as it makes it difficult to determine from an unrelated PR if a failure is due to the PR itself or due to GitHub bumping the-latesttag without our knowledge. There's also a high risk that automatically bumping the CI versions will fail due to manual work being required from experience. - For our release job, which is
release.yml, prefer to use the oldest stable (i.e. non-deprecated) versions available. The reason is that we're trying to produce images that work in the broadest number of environments, and therefore want to use older releases.
- For special-purpose jobs where the runner version doesn't really matter,
prefer
Special labels
Some github labels are used to trigger certain jobs:
ci:backport release-x.y- backport to branchrelease-x.yci:s390x- enable s390x CIci:skip-news- skip news.yml workflowsci:windows-asan- test windows with ASAN enabledneeds:response- close PR after a certain amount of time if author doesn't respond
Vim patches
Multiple Vim versions are tracked in version.c, so that has('patch-x.y.z')
works even if v:version is "behind". Whenever we "complete" merging all
patches from a Vim v:version, the steps to bump v:version are:
- Remove the fully-merged version from
vim-patch.shby adjusting the regexp. For example, to remove version "8.1":diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh indexd64f6b6 ..1d3dcdf 100755--- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -577,7 +577,7 @@ list_vimpatch_tokens() { # Left-pad the patch number of "vim-patch:xxx" for stable sort + dedupe. # Filter reverted Vim tokens. list_vimpatch_numbers() {- local patch_pat='(8\.[12]|9\.[0-9])\.[0-9]{1,4}' + local patch_pat='(8\.[2]|9\.[0-9])\.[0-9]{1,4}' diff "${NVIM_SOURCE_DIR}/scripts/vimpatch_token_reverts.txt" <( git -C "${NVIM_SOURCE_DIR}" log --format="%s%n%b" -E --grep="^[* ]*vim-patch:${patch_pat}" | grep -oE "^[* ]*vim-patch:${patch_pat}" | - Run
nvim -l scripts/vimpatch.luato regenerateversion.c. Or wait for thevim_patches.ymlCI job to do it.
See also
- https://github.com/neovim/neovim/issues/862
- https://github.com/git/git/blob/master/Documentation/howto/maintain-git.adoc
1Maintaining the Neovim project 2============================== 3 4Notes on maintaining the Neovim project. 5 6General guidelines 7------------------ 8 9* Decide by cost-benefit 10* Write down what was decided 11* Constraints are good 12* Use automation to solve problems 13* Never break the API... but sometimes break the UI 14 15Issue triage 16------------ 17 18In practice we haven't found a way to forecast more precisely than "next" and 19"after next". So there are usually one or two (at most) planned milestones: 20 21* Next bugfix-release (1.0.x) 22* Next feature-release (1.x.0) 23 24The forecasting problem might be solved with an explicit priority system (like 25Vim's todo.txt). Meanwhile the Neovim priority system is defined by: 26 27* PRs nearing completion. 28* Issue labels. E.g. the `has:plan` label increases the ticket's priority merely 29for having a plan written down: it is _closer to completion_ than tickets 30without a plan. 31* Comment activity or new information. 32 33Anything that isn't in the next milestone, and doesn't have a finished PR—is 34just not something you care very much about, by construction. Post-release you 35can review open issues, but chances are your next milestone is already getting 36full... :) 37 38Release policy 39-------------- 40 41Release "often", but not "early". 42 43The (unreleased) `master` branch is the "early" channel; it should not be 44released if it's not stable. High-risk changes may be merged to `master` if 45the next release is not imminent. 46 47For maintenance releases, create a `release-x.y` branch. If the current release 48has a major bug: 49 501. Fix the bug on `master`. 512. Cherry-pick the fix to `release-x.y`. 523. Cut a release from `release-x.y`. 53* Run `./scripts/release.sh` (requires [git cliff](https://github.com/orhun/git-cliff)) 54* The [CI job](https://github.com/neovim/neovim/blob/3d45706478cd030c3ee05b4f336164bb96138095/.github/workflows/release.yml#L11-L13) 55will update the release assets and [force-push to the "stable" tag](https://github.com/neovim/neovim/blob/cdd87222c86c5b2274a13d36f23de0637462e317/.github/workflows/release.yml#L229). 56 57### Release automation 58 59Neovim automation includes a [backport bot](https://github.com/korthout/backport-action). 60Trigger the action by labeling a PR with `ci:backport release-x.y`. See `.github/workflows/backport.yml`. 61 62Deprecating and removing features 63--------------------------------- 64 65Neovim inherits many features and design decisions from Vim, not all of which 66align with the goals of this project. It is sometimes desired or necessary to 67remove existing features, or refactor parts of the code that would change 68user's workflow. In these cases, a deprecation policy is needed to properly 69inform users of the change. 70 71When a (non-experimental) feature is slated to be removed it should: 72 731. Be _soft_ deprecated in the _next_ release 74- Use of the deprecated feature will still work. 75- This means deprecating via documentation and annotation (`@deprecated`). 76- Include a note in `deprecated.txt`. 77- For Lua features, use `vim.deprecate()`. The specified version is the 78current minor version + 2. For example, if the current version is 79`v0.10.0-dev-1957+gd676746c33` then use `0.12`. 80- For Vimscript features, use `v:lua.vim.deprecate()`. Use the same version 81as described for Lua features. 82- `vim.deprecate(…, 'x.y.z')` where major version `x` is greater than the 83current Nvim major version, is always treated as _soft_ deprecation. 842. Be _hard_ deprecated in a release following the release in which it was soft deprecated. 85- Use of the deprecated feature will still work but should issue a warning. 86- Features implemented in C will need bespoke implementations to communicate 87to users that the feature is deprecated. 883. Be removed in a release following the release in which it was hard deprecated 89- Usually this will be the next release, but it may be a later release if 90a longer deprecation cycle is desired 91- If possible, keep the feature as a stub (e.g. function API) and issue an 92error when it is accessed. 93 94Example: 95 96Deprecation Removal 97┆ ┆ ┆ 98┆ Soft ┆ Hard ┆ 99┆ Deprecation ┆ Deprecation ┆ 100┆ Period ┆ Period ┆ 101──────────────────────────────────────────────────────────── 102Version: 0.10 0.11 0.12 103──────────────────────────────────────────────────────────── 104Old code Old code Old code 105+ + 106New code New code New code 107 108Feature removals which may benefit from community input or further discussion 109should also have a tracking issue (which should be linked to in the release 110notes). 111 112Exceptions to this policy may be made (for experimental subsystems or when 113there is broad consensus among maintainers). The rationale for the exception 114should be stated explicitly and publicly. 115 116Dependencies 117------------ 118 119### Third-party dependencies 120 121(Note: keep this in sync with the "external" section of `LICENSE.txt`). 122(TODO: declare deps in `sbom.json`, CycloneDX SBOM format). 123 124"Bundled" dependencies can be updated by bumping their versions in `cmake.deps/deps.txt`. 125Some can be auto-bumped by `scripts/bump_deps.lua`. 126 127* [LuaJIT](https://github.com/LuaJIT/LuaJIT) 128* [Lua](https://www.lua.org/download.html) 129* [libuv](https://github.com/libuv/libuv) 130* Requires a PR to update the [Zig package](https://github.com/allyourcodebase/libuv) first. If the script fails, run `zig fetch --save git+https://github.com/allyourcodebase/libuv.git#<refname>` manually. 131* [Luv](https://github.com/luvit/luv) 132* When bumping, also sync 133- [our bundled meta file](https://github.com/neovim/neovim/blob/master/runtime/lua/uv/_meta.lua) with [the upstream meta file](https://github.com/luvit/luv/blob/master/docs/meta.lua); 134- [our bundled documentation](https://github.com/neovim/neovim/blob/master/runtime/doc/luvref.txt) with [the upstream documentation](https://github.com/luvit/luv/blob/master/docs/docs.md). 135* [gettext](https://ftp.gnu.org/pub/gnu/gettext/) 136* [libiconv](https://ftp.gnu.org/pub/gnu/libiconv) 137* Requires a PR to update the [Zig package](https://github.com/allyourcodebase/libiconv) first. 138* [lua-compat](https://github.com/keplerproject/lua-compat-5.3) 139* [tree-sitter](https://github.com/tree-sitter/tree-sitter) 140* [treesitter parsers](https://github.com/neovim/neovim/blob/7e97c773e3ba78fcddbb2a0b9b0d572c8210c83e/cmake.deps/deps.txt#L47-L62) 141* (Deprecated) [unibilium](https://github.com/neovim/unibilium) 142* The original project [was abandoned](https://github.com/neovim/neovim/issues/10302), so the [neovim/unibilium](https://github.com/neovim/unibilium) fork is considered "upstream" and is maintained on the `master` branch. 143* **Note:** unibilium is NOT required. See [BUILD.md](./BUILD.md#build-without-unibilium) to build Nvim without unibilium. 144 145### Vendored dependencies 146 147"Vendored" (inlined) dependencies are part of the repo tree and we must update 148the sources manually: 149 150* `src/mpack/`: [libmpack](https://github.com/libmpack/libmpack) 151* send improvements upstream! 152* `src/mpack/lmpack.c`: [libmpack-lua](https://github.com/libmpack/libmpack-lua) 153* send improvements upstream! 154* `src/xdiff/`: [xdiff](https://github.com/git/git/tree/master/xdiff) 155* `src/cjson/`: [lua-cjson](https://github.com/openresty/lua-cjson) 156* `src/klib/`: [Klib](https://github.com/attractivechaos/klib) 157* `src/lpeg/`: [Lpeg](https://www.inf.puc-rio.br/~roberto/lpeg/) 158* Apply the patch from `src/lpeg/README.md` when syncing with upstream. 159* `runtime/lua/vim/inspect.lua`: [inspect.lua](https://github.com/kikito/inspect.lua) 160* `src/nvim/tui/terminfo_defs.h`: terminfo definitions 161* Run `scripts/update_terminfo.sh` to update these definitions. 162* `runtime/lua/vim/lsp/_meta/protocol.lua`: LSP specification 163* Run `src/gen/gen_lsp.lua` to update. 164* `runtime/lua/vim/_meta/lpeg.lua`: LPeg definitions. 165* Refer to [`LuaCATS/lpeg`](https://github.com/LuaCATS/lpeg) for updates. 166* Update the git SHA revision from which the documentation was taken. 167* `runtime/lua/vim/re.lua`: LPeg regex module. 168* Vendored from LPeg. Needs to be updated when LPeg is updated. 169* `runtime/lua/vim/_meta/re.lua`: docs for LPeg regex module. 170* Needs to be updated when LPeg is updated. 171* `src/bit.c`: only for PUC lua: port of `require'bit'` from luajit https://bitop.luajit.org/ 172* `runtime/lua/coxpcall.lua`: coxpcall (only needed for PUC lua, builtin to luajit) 173 174Operational dependencies 175-------------------------- 176 177* GitHub users: 178* https://github.com/marvim 179* https://github.com/nvim-winget 180* Org secrets/tokens: 181* `CODECOV_TOKEN` 182* `BACKPORT_KEY` 183* Org/repo variables: 184* `BACKPORT_APP` 185* Domain names (held in https://namecheap.com): 186* neovim.org 187* neovim.io 188* packspec.org 189* pkgjson.org 190* The above domains are registered and managed in https://cloudflare.com 191 192 193Refactoring 194----------- 195 196### Frozen legacy modules 197 198Refactoring Vim structurally and aesthetically is an important goal of Neovim. 199But there are some modules that should not be changed significantly, because 200they are maintained by Vim, at present. Until someone takes "ownership" of 201these modules, the cost of any significant changes (including style or 202structural changes that re-arrange the code) to these modules outweighs the 203benefit. The modules are: 204 205- `regexp.c` 206- `indent_c.c` 207 208Automation (CI) 209--------------- 210 211### Backup 212 213Discussions from issues and PRs are backed up here: 214https://github.com/neovim/neovim-backup 215 216### Development guidelines 217 218* CI and automation jobs are primarily driven by GitHub Actions. 219* Avoid macOS if an Ubuntu or a Windows runner can be used instead. This is 220because macOS runners have [tighter restrictions on the number of concurrent 221jobs](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits). 222* Runner versions: 223* For special-purpose jobs where the runner version doesn't really matter, 224prefer `-latest` tags so we don't need to manually bump the versions. An 225example of a special-purpose workflow is `labeler_pr.yml`. 226* For our testing job `test.yml`, prefer to use the latest version 227explicitly. Avoid using the `-latest` tags here as it makes it difficult 228to determine from an unrelated PR if a failure is due to the PR itself or 229due to GitHub bumping the `-latest` tag without our knowledge. There's 230also a high risk that automatically bumping the CI versions will fail due 231to manual work being required from experience. 232* For our release job, which is `release.yml`, prefer to use the oldest 233stable (i.e. non-deprecated) versions available. The reason is that we're 234trying to produce images that work in the broadest number of environments, 235and therefore want to use older releases. 236 237### Special labels 238 239Some github labels are used to trigger certain jobs: 240 241* `ci:backport release-x.y` - backport to branch `release-x.y` 242* `ci:s390x` - enable s390x CI 243* `ci:skip-news` - skip news.yml workflows 244* `ci:windows-asan` - test windows with ASAN enabled 245* `needs:response` - close PR after a certain amount of time if author doesn't 246respond 247 248Vim patches 249----------- 250 251Multiple Vim versions are tracked in `version.c`, so that `has('patch-x.y.z')` 252works even if `v:version` is "behind". Whenever we "complete" merging all 253patches from a Vim `v:version`, the steps to bump `v:version` are: 254 2551. Remove the fully-merged version from `vim-patch.sh` by adjusting the regexp. 256For example, to remove version "8.1": 257```diff 258diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh 259index d64f6b6..1d3dcdf 100755 260--- a/scripts/vim-patch.sh 261+++ b/scripts/vim-patch.sh 262@@ -577,7 +577,7 @@ list_vimpatch_tokens() { 263# Left-pad the patch number of "vim-patch:xxx" for stable sort + dedupe. 264# Filter reverted Vim tokens. 265list_vimpatch_numbers() { 266- local patch_pat='(8\.[12]|9\.[0-9])\.[0-9]{1,4}' 267+ local patch_pat='(8\.[2]|9\.[0-9])\.[0-9]{1,4}' 268diff "${NVIM_SOURCE_DIR}/scripts/vimpatch_token_reverts.txt" <( 269git -C "${NVIM_SOURCE_DIR}" log --format="%s%n%b" -E --grep="^[* ]*vim-patch:${patch_pat}" | 270grep -oE "^[* ]*vim-patch:${patch_pat}" | 271``` 2722. Run `nvim -l scripts/vimpatch.lua` to regenerate `version.c`. Or wait for the 273`vim_patches.yml` CI job to do it. 274 275 276See also 277-------- 278 279* https://github.com/neovim/neovim/issues/862 280* https://github.com/git/git/blob/master/Documentation/howto/maintain-git.adoc