Skip to content

An experimental Symex.el-like package using tree sitter

Notifications You must be signed in to change notification settings

polaris64/symex-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

Symex-TS

An experimental Symex.el-like package using Tree Sitter

This package defines a hydra which allows for Symex.el-like movement within a source code buffer using the buffer's Tree Sitter tree, as generated by the tree-sitter package.

The hydra also defines tree manipulation functions, however this is very much a work-in-progress (only delete node at present).

Requirements

This package requires elisp-tree-sitter as it operates directly on the tree generated by this package. There is talk of integrating Tree Sitter directly into Emacs, so if and when this work is completed then this dependency should no longer be required. However it will always depend upon a suitable Tree Sitter environment being available on the host machine.

Usage

After requiring symex-ts.el, simply bind symex-ts-launch to a key. For example: -

(global-set-key (kbd "<f2>") #'symex-ts-launch)

Visit a file containing source code that has a Tree Sitter parser available and ensure that the tree-sitter minor mode is enabled. Then use the keybinding (or M-x symex-ts-launch) to launch the hydra.

The available key-bindings should be visible within the minibuffer. Only simple movements (up, down, forward, backward) have been created so far as well as a key to delete the current node. Please refer to the Symex.el documentation for further instructions about how to use Symex.el.

While navigating, the region containing the current node will be highlighted. This is to help in identifying what the current node represents. There is also a debug (d) keybinding which prints the currently selected node as an s-expression (or should that be "as a Symex"...?) This is useful for identifying what is currently being highlighted.

Progress and next steps

This package is only experimental; it's more a proof-of-concept than a useful tool. The eventual goal would be to add Tree Sitter support directly to Symex.el rather than creating a separate package, so this project's lifespan will end if that happens.

The next step for this project is to provide tree-manipulation functionality in order to provide proper structural editing to any supported language. At that point, the purpose of this project will be complete: it will have proved that Symex.el can be extended to support Tree Sitter.

About

An experimental Symex.el-like package using tree sitter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published