Skip to main content

Hygen Template grammar for tree-sitter

Project description

tree-sitter-hygen-template

CI crates npm pypi

Tree-sitter grammar for Hygen templates.

Usage in Editors

Neovim

Required parsers

Optional parsers

  • bash: highlight of metadata.value when metadata.key is sh
  • javascript: highlight of code nodes

Installation

  1. Add the following to your init.lua or respective config file:

    local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
    
    -- NOTE: add the parser to `parser_config` before calling `setup()`
    parser_config.hygen_template = {
      install_info = {
        url = "https://github.com/Hdoc1509/tree-sitter-hygen-template",
        files = { "src/parser.c" },
        generate_requires_npm = true,
        revision = 'release',
      },
      filetype = "hygen",
    }
    
    require('nvim-treesitter.configs').setup({
      ensure_installed = {
        --- other parsers
        'hygen_template',
      },
      -- other options
    })
    
  2. Copy the queries from queries directory to queries/hygen_template directory in your neovim configuration directory:

    With Path
    Unix ~/.config/nvim
    Windows ~/AppData/Local/nvim
    XDG_CONFIG_HOME set $XDG_CONFIG_HOME/nvim
  3. Copy the filetype.vim file to your neovim configuration directory ftdetect subdirectory as hygen.vim.

    [!NOTE] hygen filetype will match all files with name.ext.hygen pattern, where ext will be used to extract the parser to be injected.

  4. Copy the directive.lua file to your neovim configuration directory and add the following to your init.lua or respective config file:

    local hygen_directive = require('path-to.hygen-directive')
    
    local directives = { hygen_directive }
    
    for _, directive in ipairs(directives) do
      vim.treesitter.query.add_directive(
        directive.name,
        directive.callback,
        directive.options
      )
    end
    

References

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_hygen_template-0.2.2.tar.gz (10.8 kB view hashes)

Uploaded Source

Built Distributions

tree_sitter_hygen_template-0.2.2-cp39-abi3-win_arm64.whl (12.5 kB view hashes)

Uploaded CPython 3.9+ Windows ARM64

tree_sitter_hygen_template-0.2.2-cp39-abi3-win_amd64.whl (13.9 kB view hashes)

Uploaded CPython 3.9+ Windows x86-64

tree_sitter_hygen_template-0.2.2-cp39-abi3-musllinux_1_2_x86_64.whl (18.5 kB view hashes)

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

tree_sitter_hygen_template-0.2.2-cp39-abi3-musllinux_1_2_aarch64.whl (18.8 kB view hashes)

Uploaded CPython 3.9+ musllinux: musl 1.2+ ARM64

tree_sitter_hygen_template-0.2.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (19.8 kB view hashes)

Uploaded CPython 3.9+ manylinux: glibc 2.17+ ARM64

tree_sitter_hygen_template-0.2.2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.5 kB view hashes)

Uploaded CPython 3.9+ manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

tree_sitter_hygen_template-0.2.2-cp39-abi3-macosx_11_0_arm64.whl (11.3 kB view hashes)

Uploaded CPython 3.9+ macOS 11.0+ ARM64

tree_sitter_hygen_template-0.2.2-cp39-abi3-macosx_10_9_x86_64.whl (10.8 kB view hashes)

Uploaded CPython 3.9+ macOS 10.9+ x86-64

Supported by

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