Skip to content

jorgenbele/tree-sitter-bond

Repository files navigation

Tree-sitter grammar for Bond schemas

CI

A Tree-sitter grammar for the Microsoft Bond schema file format.

Contains highlights and indent queries for use in editors in queries/. Tested on Neovim.

Features

The grammar supports the following more advanced Bond features:

  • Structs (with Base class)
  • Struct views
  • Enums
  • Using statements
  • Builtin types (int, string, bool, vector, list, map, set, ..)
  • Generics

How to use in Neovim

Add the following to your init.lua:

local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.bond = {
  install_info = {
    url = "https://github.com/jorgenbele/tree-sitter-bond", -- local path or git repo
    files = {"src/parser.c"}, -- note that some parsers also require src/scanner.c or src/scanner.cc
    -- optional entries:
    branch = "master", -- default branch in case of git repo if different from master
    generate_requires_npm = false, -- if stand-alone parser without npm dependencies
    requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
  },
  filetype = "bond", -- if filetype does not match the parser name
}

vim.treesitter.language.register('bond', 'bond')

vim.filetype.add({
  -- Detect and assign filetype based on the extension of the filename
  extension = {
    bond = "bond",
  },
})

Install Tree-sitter parser for Bond using: :TSInstall bond

For highlighting neovim needs access to the highlighting queries. Until this is merged in nvim-treesitter it can be done manually by running the following from this root directory.

mkdir -p ~/.config/nvim/after/queries/bond
cp queries/* ~/.config/nvim/after/queries/bond/

About

Tree-sitter grammar for Bond schema files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published