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
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ jobs:
runs-on: ubuntu-latest

concurrency:
group: ${{ github.workflow }}-${{ matrix.nvim_version }}-${{ matrix.luals_version }}-${{ github.head_ref || github.ref_name }}
group: ${{ github.workflow }}-${{ matrix.nvim_version }}-${{ matrix.luals_version }}-${{ matrix.emmyluacodestyle_version }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

strategy:
matrix:
nvim_version: [ stable, nightly ]
luals_version: [ 3.15.0 ]
emmyluacodestyle_version: [ 1.6.0 ]

env:
VIMRUNTIME: /home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime
Expand All @@ -71,12 +72,20 @@ jobs:
curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${{ matrix.luals_version }}/lua-language-server-${{ matrix.luals_version }}-linux-x64.tar.gz" | tar zx --directory luals
echo "luals/bin" >> "$GITHUB_PATH"

- name: install EmmyLuaCodeStyle ${{ matrix.emmyluacodestyle_version }}
run: |
mkdir -p EmmyLuaCodeStyle
curl -L "https://github.com/CppCXY/EmmyLuaCodeStyle/releases/download/${{ matrix.emmyluacodestyle_version }}/linux-x64.tar.gz" | tar zx --directory EmmyLuaCodeStyle
echo "EmmyLuaCodeStyle/linux-x64/bin" >> "$GITHUB_PATH"

- run: make check

- run: make style

- run: make style-doc

- run: make format-check

- name: build Nvim from source
run: |
mkdir -p "${DIR_NVIM_SRC}"
Expand Down
23 changes: 19 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ markdown-toc --maxdepth=2 -i CONTRIBUTING.md
- [Quality](#quality)
* [lint](#lint)
* [style](#style)
* [format-fix](#format-fix)
* [check](#check)
* [format-check](#format-check)
- [Diagnostics](#diagnostics)
- [Backwards Compatibility](#backwards-compatibility)
- [:help Documentation](#help-documentation)
Expand All @@ -36,10 +38,10 @@ Language server: [luals](https://luals.github.io)

Lint: [luacheck](https://github.com/lunarmodules/luacheck/)

Style Fixing: [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle): `CodeCheck`

nvim-tree.lua migrated from stylua to EmmyLuaCodeStyle ~2024/10. `vim.lsp.buf.format()` may be used as it is the default formatter for luals, using an embedded [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle)

Formatting: [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle): `CodeFormat` executable

You can install them via you OS package manager e.g. `pacman`, `brew` or other via other package managers such as `cargo` or `luarocks`

# Quality
Expand Down Expand Up @@ -67,10 +69,12 @@ make lint
make style
```

You can automatically fix style issues using `CodeCheck`:
## format-fix

You can automatically fix most style issues using `CodeFormat`:

```sh
make style-fix
make format-fix
```

## check
Expand All @@ -96,6 +100,17 @@ curl -L "https://github.com/LuaLS/lua-language-server/releases/download/3.15.0/l
PATH="luals/bin:${PATH}" make check
```

## format-check

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

```sh
make format-check
```

- Re-runs `make format-fix`
- Checks that `git diff` is empty, to ensure that all content has been generated. This is why a stage or commit is necessary.

# Diagnostics

Diagnostics issues may not be suppressed. See [luals](https://luals.github.io) documentation for details on how to structure the code and comments.
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ luals:
scripts/luals-check.sh

#
# fixes
# format
#
style-fix:
format-fix:
CodeFormat format --config .editorconfig --workspace lua

format-check:
CodeFormat format --config .editorconfig --workspace lua
git diff --exit-code lua

#
# utility
#
Expand All @@ -46,5 +50,5 @@ help-check: help-update
git diff --ignore-blank-lines --exit-code doc/nvim-tree-lua.txt


.PHONY: all lint style check luacheck style-check style-doc luals style-fix help-update help-check
.PHONY: all lint style check luacheck style-check style-doc luals format-fix format-check help-update help-check

2 changes: 1 addition & 1 deletion lua/nvim-tree/_meta/api/decorator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ local Class = require("nvim-tree.classic")
---
---@class nvim_tree.api.highlighted_string
---
---One or many glyphs/characters.
---One or many glyphs/characters.
---@field str string
---
---Highlight group names to apply in order. Empty table for no highlighting.
Expand Down
16 changes: 8 additions & 8 deletions lua/nvim-tree/_meta/api/decorator_example.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ error("Cannot require a meta file")
---```lua
---
--- local MyDecorator = require("my-decorator")
---
---
--- require("nvim-tree").setup({
--- renderer = {
--- decorators = {
Expand All @@ -40,25 +40,25 @@ error("Cannot require a meta file")
--- ---@field private my_icon_node nvim_tree.api.highlighted_string
--- ---@field private my_highlight_group string
--- local MyDecorator = require("nvim-tree.api").Decorator:extend()
---
---
--- ---Mandatory constructor :new() will be called once per tree render, with no arguments.
--- function MyDecorator:new()
--- self.enabled = true
--- self.highlight_range = "name"
--- self.icon_placement = "after"
---
---
--- -- create your icons and highlights once, applied to every node
--- self.my_icon1 = { str = "1", hl = { "DiffAdd" } }
--- self.my_icon2 = { str = "2", hl = { "DiffText" } }
--- self.my_icon_node = { str = "N", hl = { "Error" } }
--- self.my_highlight_group = "IncSearch"
---
---
--- -- Define the icon signs only once
--- -- Only needed if you are using icon_placement = "signcolumn"
--- -- self:define_sign(self.my_icon1)
--- -- self:define_sign(self.my_icon2)
--- end
---
---
--- ---Override node icon
--- ---@param node nvim_tree.api.Node
--- ---@return nvim_tree.api.highlighted_string? icon_node
Expand All @@ -69,7 +69,7 @@ error("Cannot require a meta file")
--- return nil
--- end
--- end
---
---
--- ---Return two icons for DecoratorIconPlacement "after"
--- ---@param node nvim_tree.api.Node
--- ---@return nvim_tree.api.highlighted_string[]? icons
Expand All @@ -80,7 +80,7 @@ error("Cannot require a meta file")
--- return nil
--- end
--- end
---
---
--- ---Exactly one highlight group for DecoratorHighlightRange "name"
--- ---@param node nvim_tree.api.Node
--- ---@return string? highlight_group
Expand All @@ -91,6 +91,6 @@ error("Cannot require a meta file")
--- return nil
--- end
--- end
---
---
--- return MyDecorator
---```
2 changes: 1 addition & 1 deletion lua/nvim-tree/_meta/config/renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ error("Cannot require a meta file")
--- for reason, count in pairs(hidden_stats) do
--- total_count = total_count + count
--- end
---
---
--- if total_count > 0 then
--- return "(" .. tostring(total_count) .. " hidden)"
--- end
Expand Down
Loading