emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree-sitter indentation for js-mode & cc-mode


From: Theodor Thornhill
Subject: Re: Tree-sitter indentation for js-mode & cc-mode
Date: Fri, 28 Oct 2022 21:49:14 +0200

>> 
>
> Ok, I’m fairly certain this is due to tree-sitter reparsing after we
> indenting each line: treesit-buffer-root-node asks for the root node
> of the parser, which triggers a reparse, because last indent modified
> the buffer. We are basically reparsing as many time as there are lines
> in the buffer.
>
> Indenting a similarly sized buffer where all indent are good is much
> faster, because there is no reparse due to change to the buffer.

Yeah, that's what I was seeing as well. I think this is correct.
>
> Tree-sitter indent should add an implementation for indent-for-region
> function which precomputes indent for each line and indent lines in
> batch. That ought to fix it. Added to TODO :-)

Hehe, sorry!

Theo





reply via email to

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