mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 19:30:02 -04:00
Add workflow for checking query files
This commit is contained in:
parent
7d8fc9c4cd
commit
c42c38a834
2 changed files with 55 additions and 0 deletions
30
.github/workflows/check_query_files.yml
vendored
Normal file
30
.github/workflows/check_query_files.yml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: Check loading of syntax files
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
luacheck:
|
||||||
|
name: Check Query Files
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo add-apt-repository universe
|
||||||
|
wget https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage
|
||||||
|
chmod u+x nvim.appimage
|
||||||
|
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start
|
||||||
|
ln -s $(pwd) ~/.local/share/nvim/site/pack/nvim-treesitter/start
|
||||||
|
|
||||||
|
- name: Compile parsers
|
||||||
|
run: ./nvim.appimage --headless -c "TSInstallSync all" -c "q"
|
||||||
|
|
||||||
|
- name: Check query files
|
||||||
|
run: ./nvim.appimage --headless -c "luafile ./scripts/check-queries.lua" -c "q"
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: parsers
|
||||||
|
path: parser/*
|
||||||
25
scripts/check-queries.lua
Executable file
25
scripts/check-queries.lua
Executable file
|
|
@ -0,0 +1,25 @@
|
||||||
|
-- Execute as `nvim --headless -c "luafile ./scripts/check-queries.lua"`
|
||||||
|
local function do_check()
|
||||||
|
local parsers = require 'nvim-treesitter.parsers'.available_parsers()
|
||||||
|
local queries = require 'nvim-treesitter.query'
|
||||||
|
local query_types = {'highlights', 'locals'}
|
||||||
|
|
||||||
|
for _, lang in pairs(parsers) do
|
||||||
|
for _, query_type in pairs(query_types) do
|
||||||
|
print('Checking '..lang..' '..query_type)
|
||||||
|
queries.get_query(lang, query_type)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local ok, err = pcall(do_check)
|
||||||
|
if ok then
|
||||||
|
print('Check successful!\n')
|
||||||
|
vim.cmd('q')
|
||||||
|
else
|
||||||
|
print('Check failed:')
|
||||||
|
print(err)
|
||||||
|
print('\n')
|
||||||
|
vim.cmd('cq')
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue