Skip to main content

Github Actions expressions grammar for tree-sitter

Project description

tree-sitter-gh-actions-expressions

CI discord matrix crates npm pypi

Tree-sitter grammar for Github Actions expressions

Parser requirements

  • gitignore (optional): for hashFiles() function
  • json (optional): for fromJSON() function
  • yaml: injection to its block_mapping_pair node

Usage in Editors

Neovim

Requirements

Installation

  1. Add the following to your nvim-treesitter configuration:

    local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
    
    -- NOTE: add the parser to `parser_config` before calling `setup()`
    parser_config.gh_actions_expressions = {
      install_info = {
        url = 'https://github.com/Hdoc1509/tree-sitter-gh-actions-expressions',
        files = { "src/parser.c" },
        branch = 'release',
        -- if ABI version from neovim doesn't match the one from this grammar
        -- requires Node.js and tree-sitter cli to be installed
        requires_generate_from_grammar = true,
      },
    }
    
    require('nvim-treesitter.configs').setup({
      ensure_installed = {
        -- other parsers
        'gh_actions_expressions',
      },
      -- other options
    })
    
  2. Copy the queries from queries directory to queries/gh_actions_expression directory in your neovim configuration directory:

    With Path
    Unix ~/.config/nvim
    Windows ~/AppData/Local/nvim
    XDG_CONFIG_HOME set $XDG_CONFIG_HOME/nvim
  3. Add the following queries to after/queries/yaml/injections.scm in your neovim configuration directory:

    ; extends
    ; don't forget to include `extends` modeline!
    ((block_mapping_pair
      key: (flow_node) @_key
      value: [
        (block_node
          (block_scalar) @_value)
        (flow_node
          [
            (plain_scalar
              (string_scalar) @_value)
            (double_quote_scalar) @_value
          ])
      ]
      (#lua-match? @_value "${{")) @injection.content
      ; NOTE: to avoid weird behaviours with `bash` injections
      (#not-eq? @_key "run")
      (#set! injection.language "gh_actions_expressions")
      (#set! injection.include-children))
    
    ((block_mapping_pair
      key: (flow_node) @_key
      (#eq? @_key "if")
      value: (flow_node
        (plain_scalar
          (string_scalar) @_value)
        (#not-lua-match? @_value "${{"))) @injection.content
      (#set! injection.language "gh_actions_expressions")
      (#set! injection.include-children))
    

Helix

WIP

Emacs

WIP

In General

You can get the built files from the release branch. If you have specific instructions for your editor, PR's are welcome.

Implementations

WIP

References

Thanks

Thanks to @disrupted for creating tree-sitter-github-actions grammar, which is the base I used to create this grammar.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_gh_actions_expressions-0.3.2.tar.gz (21.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-win_arm64.whl (16.5 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-win_amd64.whl (17.5 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-musllinux_1_2_x86_64.whl (26.5 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-musllinux_1_2_aarch64.whl (27.9 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (28.9 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (26.7 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-macosx_11_0_arm64.whl (15.8 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-macosx_10_9_x86_64.whl (15.4 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_gh_actions_expressions-0.3.2.tar.gz.

File metadata

File hashes

Hashes for tree_sitter_gh_actions_expressions-0.3.2.tar.gz
Algorithm Hash digest
SHA256 560ed74282e66b5eb43d39df7c0a646133a803e031db98b448cda50f7ce57591
MD5 6cb8a94510e0b472824f7951a623d64b
BLAKE2b-256 e1119ff26a2c3ad832eb469a47fec0bd3d337333c45a95a3980aff35dc3c9957

See more details on using hashes here.

File details

Details for the file tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 2a52ed3570114db79987d434ac9b6093e2ea18a6a16cf4e204361d0f15a9e9bc
MD5 c93184df4a7451a205cd91fdb1a5caff
BLAKE2b-256 90f6e8ae9e0cc410b739f294c02f3446047c8a38a448f866084af57b62ae2155

See more details on using hashes here.

File details

Details for the file tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3ad0c2ac77ebbf89acec8446f188066f2adeb676fcd1596037503cbdda8b2227
MD5 002c771bb98af81d3f13c6de4203be55
BLAKE2b-256 fff38a99d9c72d49182516d39bc01a17267f84b01fe5b1a49818d74bfbe7f94f

See more details on using hashes here.

File details

Details for the file tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d590e881a55f659f32a718e2eace5099298c183fdd64f56f5c9b1061eb88a4f8
MD5 caa23ec5a00237e0d5787ed6ce102c48
BLAKE2b-256 4f3b88ad12333750953a51626b5de59fd3210e30b9d9297b8453293ab2897873

See more details on using hashes here.

File details

Details for the file tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 750a8621149ed6487f0fa4d4f6156e5f81dd3bb0e95f78469638781b6f2792ad
MD5 534c31f76bba4f8ab30cfe23020ee0f4
BLAKE2b-256 f2ae881c5e529ea5d17da26599994e2e60a5615b4a0321c2b462c164baf8bf1f

See more details on using hashes here.

File details

Details for the file tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f38c3847d301300ccec616d87237ae854cab9fe2237442ab0365c5ed43fae282
MD5 3d350cf1d1f122ec66674922327f5923
BLAKE2b-256 4c6b57d35bf7f1a9a9e44df5ea3b6d61d7bcb0564dc7f15c9fafb84159ed280e

See more details on using hashes here.

File details

Details for the file tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 efbabbd66e1a11d388f1516ab0199c63b175c93265d2b693a035d461793b2c7f
MD5 9a14767e2d3e8b0debef92d4b9f157ff
BLAKE2b-256 fd5c78216c3c263c9485fcc8ad0ebaff4b92464de1a51daa0a18adef895a9fa5

See more details on using hashes here.

File details

Details for the file tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7febc6ba147fba0ff0b855a189d51461652571b6e019075909a993698a779364
MD5 9ba225eb6492f765c03371ffef25150a
BLAKE2b-256 e009b9a4c9221cd1b82e74fd76b11bcaa19759e9e396e2c4e862c4222551312c

See more details on using hashes here.

File details

Details for the file tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_gh_actions_expressions-0.3.2-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 712db3fae3c0c261b765546fabe345a4eeee22dd9a629776575ace3dcdfe8726
MD5 114346173514412082d581d4c6373731
BLAKE2b-256 a5c5646e66f20b727f66f0820bd34047f6e34dabe62917d08cda1adc91e65af4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page