diffs.nvim/.github/workflows/test.yaml
Barrett Ruth a25f1e9d84 feat: treesitter highlighting for diff headers
Apply treesitter highlighting to diff metadata lines (diff --git, index,
---, +++) using the diff language parser. Header info is attached only
to the first hunk of each file to avoid duplicate highlighting.

Based on PR #52 by @phanen with fixes:
- header_lines now only contains diff metadata, not hunk content
- header info attached only to first hunk per file
- removed arbitrary hunk count restriction
2026-02-04 15:11:35 -05:00

30 lines
987 B
YAML

name: test
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
nvim: [stable, nightly]
name: Test (Neovim ${{ matrix.nvim }})
steps:
- uses: actions/checkout@v4
- uses: nvim-neorocks/nvim-busted-action@v1
with:
nvim_version: ${{ matrix.nvim }}
before: |
git clone --depth 1 https://github.com/the-mikedavis/tree-sitter-diff /tmp/tree-sitter-diff
cd /tmp/tree-sitter-diff && cc -shared -fPIC -o diff.so -I./src src/parser.c
PARSER_DIR=$(nvim --headless -c 'lua print(vim.fn.stdpath("data") .. "/site/parser")' -c 'q' 2>&1 | tail -1)
echo "Installing parser to: $PARSER_DIR"
mkdir -p "$PARSER_DIR"
cp diff.so "$PARSER_DIR/"
nvim --headless -c 'lua print("diff parser available:", pcall(vim.treesitter.language.inspect, "diff"))' -c 'q'