nverno / snippet-ts-mode

Emacs major mode for Yasnippet snippets using tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snippet major mode using tree-sitter

License: GPL v3

This package provides a major-mode for yasnippet snippets using the tree-sitter grammar from tree-sitter-yasnippet.

Features:

  • font-locking
  • basic indentation inside elisp code regions
  • some interactive commands to move between fields and increment field indices.
  • completion-at-point: for elisp in code regions and for snippet headers
  • elisp xref in code regions

WIP: Use elisp parser in elisp code regions.

example

Installing

Emacs 29.1 or above with tree-sitter support is required.

Tree-sitter starter guide: https://git.savannah.gnu.org/cgit/emacs.git/tree/admin/notes/tree-sitter/starter-guide?h=emacs-29

Install tree-sitter parser for yasnippet

Add the source to treesit-language-source-alist.

(add-to-list
 'treesit-language-source-alist
 '(yasnippet "https://github.com/nverno/tree-sitter-yasnippet"))

Optionally, install grammar for elisp.

Then run M-x treesit-install-language-grammar and select yasnippet to install.

Install snippet-ts-mode.el from source

  • Clone this repository
  • Add the following to your emacs config
(require "[cloned nverno/snippet-ts-mode]/snippet-ts-mode.el")

About

Emacs major mode for Yasnippet snippets using tree-sitter

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 98.3%Language:YASnippet 1.7%