Skip to content

ccqpein/tree-sitter-fidl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tree Sitter FIDL

This is tree-sitter parser for FIDL files (Fuchsia Interface Definition Language).

It provides fast syntax tree based code highlighting and code folding for Fuchsia developers using tree-sitter supported editors (NeoVim / Emacs).

Developement

  1. Setup tree-sitter development, either rust cli or nodejs cli work. https://tree-sitter.github.io/tree-sitter/creating-parsers.
  2. Make changes, run tree-sitter generate and tree-sitter test to test.
  3. Try the changes, run tree-sitter parse a/fidl/file to see the highlight.
  4. Test all FIDL files in fuchsia repo /sdk/fidl, tree-sitter parse path/to/fuchsia/sdk/fidl/**.fidl | grep ERROR | grep fidl ensure no error.
  5. For FIDL syntax, You can check the FIDL grammar in Fuchsia repo.

File sturcture

  • grammar.js is the definition of parsers.
  • corpus/ stores test cases.
  • queries stores syntax meanings for highlighting.

Installation

NeoVim

NeoVim Treesitter

TODO: add to nvim-treesitter register.

local installation

add following to the place you config nvim-treesitter:

local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.fidl = {
  install_info = {
    url = "path/to/tree-sitter-fidl",
    files = { "src/parser.c" },
    -- generate from grammar is required because we did not upload generated
    -- files.
    requires_generate_from_grammar = true,
  },
  filetype = "fidl",
}

and copy queries/* to nvim-runtime-dir/queries/fidl/, check :h rtp for how to locate the dir, usually $XDG_CONFIG_HOME/nvim is one of the runtime-dir.

:TSInstall fidl to install, and :TSUpdate for update the parser.

TODOs

  • setup github actions to pull fuchsia repo and verify sdk every half year
  • add to nvim-treesitter
  • add instructions for emacs usage

License

Apache-2.0

Disclaimer: This is not an officially supported Google product.

About

FIDL grammar for tree-sitter

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 94.7%
  • Scheme 5.3%