Module difft::parse::tree_sitter_parser
source · [−]Expand description
Load and configure parsers written with tree-sitter.
Structs
Configuration for a tree-sitter parser.
A language may contain certain nodes that are in other languages
and should be parsed as such (e.g. HTML
<script>
nodes containing
JavaScript). This contains how to identify such nodes, and what
languages we should parse them as.Constants
Functions
Convert all the tree-sitter nodes at this level to difftastic
syntax nodes.
Convert the tree-sitter node at
cursor
to a difftastic atom.Are any of the children of the node at
cursor
delimiters? Return
their indexes if so.Convert the tree-sitter node at
cursor
to a difftastic list
node.parse 🔒
Parse
src
with tree-sitter and convert to difftastic Syntax.Find any nodes that can be parsed as other languages (e.g. JavaScript embedded in HTML),
and return a map of their node IDs mapped to parsed trees. Every time we see such a node,
we will ignore it and recurse into the root node of the given tree instead.
Convert the tree-sitter node at
cursor
to a difftastic syntax
node.to_tree 🔒
Parse
src
with tree-sitter.Calculate which tree-sitter node IDs should have which syntax
highlighting.
tree_sitter_ada 🔒 ⚠
tree_sitter_apex 🔒 ⚠
tree_sitter_bash 🔒 ⚠
tree_sitter_c 🔒 ⚠
tree_sitter_cpp 🔒 ⚠
tree_sitter_css 🔒 ⚠
tree_sitter_dart 🔒 ⚠
tree_sitter_elm 🔒 ⚠
tree_sitter_go 🔒 ⚠
tree_sitter_hack 🔒 ⚠
tree_sitter_hare 🔒 ⚠
tree_sitter_hcl 🔒 ⚠
tree_sitter_html 🔒 ⚠
tree_sitter_java 🔒 ⚠
tree_sitter_json 🔒 ⚠
tree_sitter_lua 🔒 ⚠
tree_sitter_make 🔒 ⚠
tree_sitter_nix 🔒 ⚠
tree_sitter_objc 🔒 ⚠
tree_sitter_perl 🔒 ⚠
tree_sitter_php 🔒 ⚠
tree_sitter_r 🔒 ⚠
tree_sitter_ruby 🔒 ⚠
tree_sitter_rust 🔒 ⚠
tree_sitter_scss 🔒 ⚠
tree_sitter_sql 🔒 ⚠
tree_sitter_toml 🔒 ⚠
tree_sitter_tsx 🔒 ⚠
tree_sitter_vhdl 🔒 ⚠
tree_sitter_xml 🔒 ⚠
tree_sitter_yaml 🔒 ⚠
tree_sitter_zig 🔒 ⚠