Github Actions expressions grammar for tree-sitter
- Parses Github Action's expressions:
${{ ... }} - Plays well with
bashinjections in YAML documents - Passes parsing tests from actionlint
- Install nvim-treesitter
It is recommended to install at least yaml, bash, and comment parsers to support github actions files.
Optional parsers used for additional highlights: json, nim, nim_format_string
- Configure autocmd for a custom parser:
-- custom parsers
vim.api.nvim_create_autocmd('User', {
pattern = 'TSUpdate',
callback = function()
require('nvim-treesitter.parsers').ghactions = {
install_info = {
url = 'https://github.com/rmuir/tree-sitter-ghactions',
queries = 'queries',
},
}
end,
})- Configure yaml injection in
~/.config/nvim/queries/yaml/injections.scm:
; extends
; github actions
([
(string_scalar)
(block_scalar)
(double_quote_scalar)
(single_quote_scalar)
(ERROR)
] @injection.content
(#lua-match? @injection.content "[$]{{")
(#set! injection.language "ghactions"))- Run
:TSUpdateand:TSInstall ghactionsfrom neovim.
NOTE: these instructions are based upon the main branch of nvim-treesitter.
Bindings are published to pypi, npm, and crates.io as tree-sitter-ghactions.
Wasm and source code artifacts are published to GitHub releases
