emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-tree-sitter and Emacs


From: 조성빈
Subject: Re: emacs-tree-sitter and Emacs
Date: Fri, 3 Apr 2020 04:39:08 +0900

> 2020. 4. 3. 오전 4:04, Eli Zaretskii <address@hidden> 작성:
> 
> 
>> 
>> From: Michael Welsh Duggan <address@hidden>
>> Cc: <address@hidden>, <address@hidden>, <address@hidden>
>> Date: Thu, 02 Apr 2020 14:50:18 -0400
>> 
>> If this is correct, I also think we could avoid (1) as an optimization.
>> In this case we only send the text from (save-restriction (widen)
>> (point-min)) to (window-end) to the parser as soon as the buffer is
>> visible.  Then treat scrolling down as a change that adds text to the
>> buffer (from the parser's point of view).  This may not produce correct
>> semantic information in all cases, but it is probably a reasonable first
>> approximation in the event that we want to avoid (1).
> 
> Yes, with one correction: ideally, it should be unnecessary to start
> from point-min (which could be a long way away).  Most languages
> should do well enough with starting from the beginning of the
> outermost function or class that affects the displayed text.

AFAIU, determining that starting point is a non-trivial task, and if Emacs 
wants to present the user an exact representation, the text from point-min is 
still needed: just a hypothetical case would be having a file with all code 
commented out.

Trying to find out the starting point in lisp would be hard enough and possibly 
will be slower than just passing everything to tree-sitter. 

>  IOW,
> start from window-start, then go back until you find the top-level
> syntactic construct; then parse from there.
> 



reply via email to

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