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).
- Setup tree-sitter development, either rust cli or nodejs cli work. https://tree-sitter.github.io/tree-sitter/creating-parsers.
- Make changes, run
tree-sitter generate
andtree-sitter test
to test. - Try the changes, run
tree-sitter parse a/fidl/file
to see the highlight. - 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. - For FIDL syntax, You can check the FIDL grammar in Fuchsia repo.
grammar.js
is the definition of parsers.corpus/
stores test cases.queries
stores syntax meanings for highlighting.
NeoVim
TODO: add to nvim-treesitter register.
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.
- setup github actions to pull fuchsia repo and verify sdk every half year
- add to nvim-treesitter
- add instructions for emacs usage
Disclaimer: This is not an officially supported Google product.