Skip to content

Use yasnippet-snippets together with tree-sitter major modes

License

Notifications You must be signed in to change notification settings

fbrosda/yasnippet-treesitter-shim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Yasnippet-Snippets: Treesitter Modes Shim

Why

Emacs 29 provides native tree-sitter support. But currently the functionality is not integrated in the existing major modes, instead there exist new <major-mode>-ts-mode modes, which must explicitly be used to enjoy the new tree-sitter based syntax highlighting. The problem with this approach is, that if you use e.g. c-ts-mode, the yasnippet-snippets for c-mode are not loaded.

How

The goal is to create an easy to setup and at the same time easy to remove workaround, as long as it is required, which needs minimal configuration. Therefore the .yas-parents feature is used, to create a folder, for each -ts-mode and link it to the snippets for the original mode.

Setup

After cloning the repository, make sure to include this snippet repository via

(add-to-list 'yas-snippet-dirs "/path/to/yasnippet-treesitter-shim/snippets/")

If you are using the straight.el package manager with use-package, you can use the following to achieve the same:

(use-package yasnippet-treesitter-shim
  :straight (:host github :repo "fbrosda/yasnippet-treesitter-shim"
                   :files ("snippets/*"))
  :no-require t
  :config
  (add-to-list 'yas-snippet-dirs
               (straight--build-dir "yasnippet-treesitter-shim")))

About

Use yasnippet-snippets together with tree-sitter major modes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published