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)