[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter integration on feature/tree-sitter
From: |
Yuan Fu |
Subject: |
Re: Tree-sitter integration on feature/tree-sitter |
Date: |
Sat, 7 May 2022 11:33:21 -0700 |
I forgot to mention the changes I made prior to pushing:
- Changed prefix to treesit-
- Now language definitions are referred to as 'c and 'python, rather than
'tree-sitter-c and 'tree-sitter-python (because we changed the prefix)
- New variable treesit-extra-load-path that lets the user use different
load-paths for language definitions
These are the changes we agreed on in the old thread. I also added a new
indentation preset parent-bol, as suggested by Theodor.
> The easiest way to play with it is to use some provided major mode that
> implements it. I've made one here for golang, for reference:
> https://git.sr.ht/~theo/dotfiles/tree/master/item/emacs/.emacs.d/lisp/go-mode.el.
>
> This can easily be modified to use 'tree-sitter-c instead
So now 'tree-sitter-c should be 'c.
>
> To make this work you need the definition compiled and put on some path
> that emacs can see. The suggested one is LD_LIBRARY_PATH, and I start
> emacs using something like this:
>
> ```
> LD_LIBRARY_PATH=/home/theo/src/tree-sitter-module/dist
> /path/to/tree-sitter-enabled-emacs/src/emacs
> ```
Now you can use tree-sitter-extra-load-path
>
> This is using the scripts provided by Yuan Fu in the tree-sitter-modules
> repo. When the major mode is enabled, you can start querying the
> document by using the provided functions, such as:
>
> ```elisp
> (tree-sitter-node-start
> (tree-sitter-node-at (point) (point) 'tree-sitter-go))
> ```
>
> `M-x tree-sitter-inspect-mode` shows what node you are on in the mode
> line. It helps with debugging.
>
> By 'play with it', I guess we can implement folding, highlighting,
> navigation, simple rename functionality, Imenu etc etc.
Now you should use treesit- prefix.
Thanks,
Yuan
- Tree-sitter integration on feature/tree-sitter, Yuan Fu, 2022/05/07
- Re: Tree-sitter integration on feature/tree-sitter, Yuan Fu, 2022/05/07
- Re: Tree-sitter integration on feature/tree-sitter, Theodor Thornhill, 2022/05/07
- Re: Tree-sitter integration on feature/tree-sitter, Eli Zaretskii, 2022/05/07
- Re: Tree-sitter integration on feature/tree-sitter, Yuan Fu, 2022/05/07
- Re: Tree-sitter integration on feature/tree-sitter, Yuan Fu, 2022/05/07
- Re: Tree-sitter integration on feature/tree-sitter, Eli Zaretskii, 2022/05/07
- Re: Tree-sitter integration on feature/tree-sitter, Yuan Fu, 2022/05/07
- Re: Tree-sitter integration on feature/tree-sitter, Theodor Thornhill, 2022/05/07
- Re: Tree-sitter integration on feature/tree-sitter, Stefan Monnier, 2022/05/07