all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Simon Pugnet <simon@polaris64.net>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Tree sitter: allowing access to `ts_tree_get_changed_ranges()' from elisp
Date: Sat, 26 Nov 2022 15:57:33 +0100	[thread overview]
Message-ID: <87mt8dep1e.fsf@polaris64.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1856 bytes --]

Dear Emacs developers,

I'm a contributor to Symex.el 
(<https://github.com/drym-org/symex.el>), a structural editing package 
based on Evil. The core package was originally designed to be used 
with Lisp languages but I have been working on it to add support for 
other languages via Tree Sitter.

This work has been going on for quite a while so I am currently using 
Tuấn-Anh Nguyễn's `elisp-tree-sitter' package 
(<https://github.com/emacs-tree-sitter/elisp-tree-sitter>). As Yuan 
Fu's tree-sitter branch has just been merged I decided this was a good 
time to look into updating Symex.el so that it can use the built-in 
version instead when it's available.

Progress so far has been good and I have a large portion of the 
functionality working with both implementations. However I've just 
found a feature that I'm using in `elisp-tree-sitter' that does not 
seem to be available in the built-in version.

Part of the functionality I use is fetching a list of ranges that have 
been changed between the previous and current parser trees (after an 
editing operation). This is exposed by `elisp-tree-sitter' via the 
`tsc-changed-ranges' function. From the docstring, "…This function 
returns a sequence of ranges whose syntactic structure has changed." I 
can't find an equivalent function exposed by the built-in tree sitter 
library however.

I've checked src/treesit.c and I can see that there is a 
`ts_tree_get_changed_ranges()' function, presumably from the 
underlying tree sitter library. However I don't think this is being 
exposed to elisp. Would it be possible to allow this information to be 
provided to elisp somehow?

Thanks in advance for your help, and apologies if this is already 
available and I have simply missed it.

Kind regards,

-- 
Simon Pugnet
https://www.polaris64.net/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

             reply	other threads:[~2022-11-26 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-26 14:57 Simon Pugnet [this message]
2022-11-26 15:32 ` Tree sitter: allowing access to `ts_tree_get_changed_ranges()' from elisp Eli Zaretskii
2022-11-26 15:53   ` Simon Pugnet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mt8dep1e.fsf@polaris64.net \
    --to=simon@polaris64.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.