Skip to content

Commit 000ca6b

Browse files
authored
docs: CONTRIBUTING.md: add diagnostics and backward compatibility
1 parent 1b876db commit 000ca6b

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

CONTRIBUTING.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ Thank you for contributing.
44

55
See [wiki: Development](https://github.com/nvim-tree/nvim-tree.lua/wiki/Development) for environment setup, tips and tools.
66

7+
<!--
8+
https://github.com/jonschlinkert/markdown-toc
9+
markdown-toc --maxdepth=2 -i CONTRIBUTING.md
10+
-->
11+
12+
<!-- toc -->
13+
14+
- [Tools](#tools)
15+
- [Quality](#quality)
16+
* [lint](#lint)
17+
* [style](#style)
18+
* [check](#check)
19+
- [Diagnostics](#diagnostics)
20+
- [Backwards Compatibility](#backwards-compatibility)
21+
- [Adding New Actions](#adding-new-actions)
22+
- [Documentation](#documentation)
23+
* [Opts](#opts)
24+
* [API](#api)
25+
- [Windows](#windows)
26+
- [Pull Request](#pull-request)
27+
* [Subject](#subject)
28+
29+
<!-- tocstop -->
30+
731
# Tools
832

933
Following are used during CI and strongly recommended during local development.
@@ -72,6 +96,30 @@ curl -L "https://github.com/LuaLS/lua-language-server/releases/download/3.9.1/lu
7296
PATH="luals/bin:${PATH}" make check
7397
```
7498

99+
# Diagnostics
100+
101+
Diagnostics issues may not be suppressed. See [luals](https://luals.github.io) documentation for details on how to structure the code and comments.
102+
103+
Suppressions are permitted only in the following cases:
104+
105+
- Backwards compatibility shims
106+
- neovim API metadata incorrect, awaiting upstream fix
107+
- classic class framework
108+
109+
# Backwards Compatibility
110+
111+
Whenever new neovim API is introduced, please ensure that it is available in older versions. See `:help deprecated.txt` and `$VIMRUNTIME/lua/vim/_meta/api.lua`
112+
113+
See `nvim-tree.setup` for the oldest supported version of neovim. If the API is not availble in that version, a backwards compatibility shim must be used e.g.
114+
115+
```lua
116+
if vim.fn.has("nvim-0.10") == 1 then
117+
modified = vim.api.nvim_get_option_value("modified", { buf = target_bufid })
118+
else
119+
modified = vim.api.nvim_buf_get_option(target_bufid, "modified") ---@diagnostic disable-line: deprecated
120+
end
121+
```
122+
75123
# Adding New Actions
76124

77125
To add a new action, add a file in `actions/name-of-the-action.lua`. You should export a `setup` function if some configuration is needed.

0 commit comments

Comments
 (0)