From a229977b7789a6889ae8e9d18f74b1e18f0c3cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Tue, 12 May 2026 13:29:37 +0000 Subject: [PATCH] ci(keymaps): pin Neovim 0.11 from upstream release tarball MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI log for the keymaps job showed Lua crashing with `attempt to call field 'get_clients' (a nil value)` plus a flood of `W18: Invalid character in group name` on the `@vimwiki*` highlight links. Both signal that apt's `neovim` package is too old (Ubuntu LTS ships 0.6/0.7) — `vim.lsp.get_clients` only landed in 0.10, and Tree-sitter-style `@group.modifier` highlight names only became valid sometime in the 0.8-ish era. Switched the installer to pull the official static tarball (`neovim/neovim/releases/v0.11.3/nvim-linux-x86_64.tar.gz`) and symlink it into `/usr/local/bin/nvim`. Vim from apt is kept — it only runs the pure-VimL harness so its age doesn't matter. Also added a defensive fallback in the harness: `get_lsp_clients = vim.lsp.get_clients or vim.lsp.get_active_clients`, plus a `server_capabilities` nil guard. Won't matter on the pinned 0.11 runner, but means a future regression that drops the deps will fail with a clear `lsp.attached` FAIL message instead of a Lua stack trace. Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitea/workflows/ci.yaml | 16 +++++++++++++--- scripts/test-keymaps.lua | 11 +++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 62466b7..e9f9964 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -76,11 +76,21 @@ jobs: key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} restore-keys: | ${{ runner.os }}-cargo-test- - - name: install neovim + vim + - name: install Neovim 0.11 + Vim run: | - sudo apt-get update -qq - sudo apt-get install -y --no-install-recommends neovim vim + set -euo pipefail + # Apt's neovim is too old (Ubuntu LTS ships 0.6/0.7), missing + # `vim.lsp.get_clients` and rejecting `@group.modifier` + # highlight names. Pull the official static tarball instead. + NVIM_VER=v0.11.3 + curl -fsSL -o /tmp/nvim.tar.gz \ + "https://github.com/neovim/neovim/releases/download/${NVIM_VER}/nvim-linux-x86_64.tar.gz" + sudo tar -xzf /tmp/nvim.tar.gz -C /opt + sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/nvim nvim --version | head -1 + # Vim from apt is fine — only the pure-VimL keymaps run there. + sudo apt-get update -qq + sudo apt-get install -y --no-install-recommends vim vim --version | head -1 - name: run Neovim keymap harness run: ./scripts/test-keymaps.sh diff --git a/scripts/test-keymaps.lua b/scripts/test-keymaps.lua index 40caa38..3c64c80 100644 --- a/scripts/test-keymaps.lua +++ b/scripts/test-keymaps.lua @@ -82,11 +82,18 @@ local function run(name, opts) record(ok, name, ok and '' or tostring(err)) end +local function get_lsp_clients(opts) + local fn = vim.lsp.get_clients or vim.lsp.get_active_clients + if not fn then return {} end + return fn(opts) +end + local function wait_for_lsp(timeout_ms) local deadline = vim.loop.now() + (timeout_ms or 5000) while vim.loop.now() < deadline do - local clients = vim.lsp.get_clients({ name = 'nuwiki', bufnr = 0 }) - if #clients > 0 and clients[1].server_capabilities.executeCommandProvider then + local clients = get_lsp_clients({ name = 'nuwiki', bufnr = 0 }) + if #clients > 0 and clients[1].server_capabilities + and clients[1].server_capabilities.executeCommandProvider then return clients[1] end sleep(100)