Skip to content

Commit

Permalink
workflow: Create workflow for capturing neovim capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Oct 18, 2023
1 parent 411b962 commit d2e45f3
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/capabilities-nvim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Neovim Capabilities
on:
workflow_dispatch:
inputs:
version:
description: 'Version to capture capabilities for'
required: true
type: string

jobs:
capture:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- run: |
gh release download ${{ inputs.version }} -p '*.appimage' -R neovim/neovim
ls -l
chmod +x nvim.appimage
./nvim.appimage -l scripts/nvim-capabilities.lua
mv neovim_v*.json lib/pytest-lsp/pytest_lsp/clients/
ls -l
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git checkout -b neovim-${{ inputs.version }}-capabilities
git add lib/pytest-lsp/pytest_lsp/clients/
git commit -m "Add client capabilities for Neovim ${{ inputs.version }}"
git push -u origin neovim-${{ inputs.version }}-capabilities
gh pr create --base develop --fill
name: Capture Neovim Capailities
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions scripts/nvim-capabilities.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- Dump the client capabilities for this version of neovim.
local version_info = vim.version()
local version = string.format('%d.%d.%d', version_info.major, version_info.minor, version_info.patch)

local params = {
clientInfo = {
name = 'Neovim',
version = version,
},
capabilities = vim.lsp.protocol.make_client_capabilities(),
}

local json = vim.json.encode(params)
local bufnr = vim.api.nvim_create_buf(true, false)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { json })

vim.api.nvim_buf_call(bufnr, function()
vim.cmd(string.format(':w neovim_v%s.json', version))
vim.cmd('.!python -m json.tool %')
vim.cmd(':w')
end)

0 comments on commit d2e45f3

Please sign in to comment.