-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: integration with tree-sitter #38
Comments
So what do you think about this, is my understanding correct on this, i.e. by making |
Great idea ;) I'll install Emacs 29 and have a try in a few days. |
I installed https://aur.archlinux.org/packages/emacs-pgtk-native-comp-git and although Do I need some special build flags to enable tree-sitter support? |
I think it's best I install emacs 29 also... right, you may be right, I found this post when installing on my mac: d12frosted/homebrew-emacs-plus#527. Quote:
Ok in the same post, this comment d12frosted/homebrew-emacs-plus#527 (comment) suggest the configuration script would pick |
I have gotten things setup on my end, but it's complaining (for python mode)
Maybe need to wait a bit before things mature enough to be usable. |
I've got tree-sitter compiled but encountered a similar problem in
I agree. Let's wait for a while. |
The idea behind tree-sitter support, as far as I understand, is that Emacs knows how to talk to tree-sitter using the tree-siitter library, but parsers for specific languages have to be installed separately, via the tree-sitter CLI. |
Also, I wonder if since puni already uses |
Oh, that would be very good indeed (haven't thought about that). However, upon inspecting the |
Oh, that would be very good indeed (haven't thought about that). However, upon inspecting the `forward-sexp` definition in my emacs 29, its not using tree-sitter in `lisp.el`.
Right now there are only a few modes that support treesitter, all of them have -ts- in the name, e.g. c-ts-mode, typescript-ts-mode, and there's no such mode for lisp, at least yet. But it should be easy to add modes for tree-sitter-supported languages now, so I expect more third-party modes to appear soon
…--
Andrey Listopadov
|
I've tried this for a bit, and as it seems in the current state there's no way to navigate trees in a general way with So I guess we need to make our own version of Maybe the https://github.com/emacs-tree-sitter/elisp-tree-sitter project has something like that implemented |
A recent thread on the emacs dev. mailing list: https://lists.gnu.org/archive/html/emacs-devel/2022-12/msg00439.html |
it's gonna be in Emacs 30: https://git.savannah.gnu.org/cgit/emacs.git/commit/etc/NEWS?id=207901457c018d94b1ce9e13a897d8241b1f3af2
|
why not making treesit work with smie enigne |
Hi. I'd like to ask everyone if you are using puni and treesit: How's your experience? I've been using treesit-auto to map every supported |
Doesn't seem to work properly in elixir-ts-mode. |
@andreyorst Yes, I can confirm that. I don't know elixir so I just played with some example from the internet. From what I see, Emacs master now provides |
@andreyorst[https://github.com/andreyorst] Yes, I can confirm that. I
don't know elixir so I just played with some example from the internet.
From what I see, *forward-sexp* in *elixir-ts-mode* is doing very werid
things, and I can't see how to fix that (or fix Puni for that).
Same for lua-ts-mode. Puni-convolute, puni-splice-killing-backward and
others don't work properly.
Emacs master now provides *treesit-forward-sexp*, which requires the
major mode to set *treesit-sexp-type-regexp*. If *elixir-ts-mode* could
get this done, maybe *treesit-forward-sexp* can be a more reliable
*forward-sexp*.
Yeah, I've mentioned this in this thread some time ago.
However, simply setting forward-sexp-function to treesit-forward-sexp
doesn't fix puni in these modes.
|
I've noticed some issues with (defun +puni-kill ()
"Kill until end of a sexp."
(interactive)
(puni-delete-region
(point)
(cdr (puni-bounds-of-list-around-point))
'kill)) and when normally that command kills until end of parentheses, then in |
With emacs 29,
treesitter
will be built-in. It may be a good idea to take advantage of that.Here is the comment on a reddit post that inspired this request.
The idea is to add a variable (
defcustom
) perhaps namedpuni-forward-sexp-function
, this variable will befuncall
ed in place of the currentforward-sexp
.In treesitter's case a customized function that wraps
treesit-node-next-sibling
(See https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/treesit.el#n71) may work.The benefits of this could introduce some more flexibilities. For example, support for issues such as this (#14) can be added by uses setting
puni-forward-sexp-function
in theirorg-mode-hook
.The text was updated successfully, but these errors were encountered: