From: Perry Smith <pedz@easesoftware.com>
To: Yuan Fu <casouri@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Creating a paradigm for leveraging Tree Sitter's power
Date: Sat, 24 Dec 2022 08:32:38 -0600 [thread overview]
Message-ID: <5F05BACE-A31A-48EF-94FF-7F9B0DF663AE@easesoftware.com> (raw)
In-Reply-To: <A2D10DA6-5AF0-41D9-9C17-6CC9B052245B@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]
> On Dec 24, 2022, at 03:09, Yuan Fu <casouri@gmail.com> wrote:
>
>> On Dec 23, 2022, at 5:32 PM, Perry Smith <pedz@easesoftware.com> wrote:
>
>>
>> I'll call this the "primitive routine". The routine would be
>> responsible for returning a beginning and end (in a cons cell) and it
>> would be the routine's responsibility to make sure that the beginning
>> and end lie after (in the forward case) or before (in the backward
>> case) the point that is passed in.
>
> You mean beginning and end of (symbol | string | statement | …)?
Yes. A “simple” routine for each concept that the language has that would
Return the beg / end of that construct. e.g. foo-bar-statement would
return the beg / end of a statement.
> From my experience implementing defun navigation for tree-sitter, it might be more helpful to return three ranges: the thing before point, the thing at point, and the thing after point, and either one could be nil if there doesn’t exist one. For nested things it can be prev-sibling, parent, next-sibling instead. The point is that the user can move back and forward and make decisions easily with this “field of view”.
Hmm… interesting idea. As I work on things I’ll keep this idea in mind. It
might indeed lead to simpler routines.
Perry
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-12-24 14:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-24 1:32 Creating a paradigm for leveraging Tree Sitter's power Perry Smith
2022-12-24 9:09 ` Yuan Fu
2022-12-24 10:07 ` Theodor Thornhill
2022-12-24 14:57 ` Perry Smith
2022-12-24 15:13 ` Theodor Thornhill
2022-12-24 14:32 ` Perry Smith [this message]
2022-12-24 16:52 ` [External] : " Drew Adams
2022-12-24 17:29 ` Perry Smith
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=5F05BACE-A31A-48EF-94FF-7F9B0DF663AE@easesoftware.com \
--to=pedz@easesoftware.com \
--cc=casouri@gmail.com \
--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.