emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a paradigm for leveraging Tree Sitter's power


From: Perry Smith
Subject: Re: Creating a paradigm for leveraging Tree Sitter's power
Date: Sat, 24 Dec 2022 08:32:38 -0600

> 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: signature.asc
Description: Message signed with OpenPGP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]