tree-sitter-tools Made for Pulsar!

Tools for writing tree-sitter grammars in Pulsar

savetheclocktower

108

0

0.0.16

MIT

GitHub

tree-sitter-tools

Tools for writing Tree-sitter grammars in Pulsar, including a grammar for Tree-sitter query files.

IMPORTANT: Currently works on Pulsar v1.106 and newer. Versions 1.106 through 1.112.1 need the core.useExperimentalModernTreeSitter setting enabled; versions 1.113 and newer enable modern Tree-sitter grammars by default.

tree-sitter-tools screenshot

Inspector

The Tree-sitter inspector pane is an enhanced version of the Tree-sitter playground.

When inside of a buffer using a modern Tree-sitter grammar, run the Tree Sitter Tools: Open Inspector For Editor command. A pane will open on the right side showing a representation of the editor’s Tree-sitter tree.

Here’s what you can do:

Running queries

The query field is shown below the node inspector and accepts any valid Tree-sitter query syntax.

When a query runs, each capture name in the query will be annotated with a colored decoration, and any matches for that capture in the editor will have the same decoration.

The decorations will persist through editor changes, and will update when the editor updates. When the active layer is changed, the query editor will clear.

Keep in mind that some predicates are not implemented in the web-tree-sitter bindings, even if they’re present in the documentation and in sample query files in Tree-sitter parser repositories.

The built-in predicates #match? and #eq? are supported, as are certain custom predicates supported by Pulsar via #is?, #is-not? and #set!:

Grammar

A grammar for Tree-sitter query files is included.

Planned enhancements