[Top][All Lists]

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

Re: Using incremental parsing in Emacs

From: Yuan Fu
Subject: Re: Using incremental parsing in Emacs
Date: Sat, 4 Jan 2020 15:26:01 -0500

> AFAIU, these capabilities could be used as an alternative to
> regexp- and syntax-pps-based font-lock, better code folding,
> completion, refactoring, and other similar features; in general, any
> feature which would benefit from having a parse tree for the source
> code in a buffer.

Another possibility is modular editing — syntax-aware word jumps (M-f/b/d), 
“free” expand-regions by parse tree, etc. I’m not sure about font-locking, but 
these types of operations needs only a parse tree. So I think it suffice to 
simply provide this parse tree and let packages use it like (syntax-ppss): 
provide functions that returns the syntax object at point (cl-struct?) and 
functions can extract informations from it, like position of beginning and end, 
type, previous/next object, nested level, etc.

I’m not sure how refactoring could work (accurately), tho. Maybe it’s better to 
leave refactoring to lsp servers. In general, I think we should leave tasks 
that requires a deeper understanding of the semantics of the language to lsp.


reply via email to

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