|
From: | Daniel Colascione |
Subject: | Re: treesit indentation "blinking" |
Date: | Thu, 23 Mar 2023 00:51:08 -0400 |
User-agent: | AquaMail/1.43.0 (build: 104300275) |
On Mar 22, 2023, at 5:07 PM, Daniel Colascione <dancol@dancol.org> wrote:On March 22, 2023 20:00:23 Yuan Fu <casouri@gmail.com> wrote:On Mar 22, 2023, at 1:49 PM, Daniel Colascione <dancol@dancol.org> wrote:Is there a general-purpose through which we can avoid line indentationoscillating as the user types when the AST is temporarily invalid,e.g. after '(' or '{'? I'm checking out the C++ tree-sitter mode, andone of the more disconcerting things is the current line's indentationchanging rapidly as I type. Is it feasible to create ERROR recoveryindentation rules for every conceivable situation?Yes, but in reality, I think all we need is a couple special case for the unmatched ( and {’s. Can you think of other cases of blinking indentations?YuanBut TS reacts to missing closing brackets by clarifying the whole nearby _expression_ as ERROR. It's not, as would be more useful, saying "here's a stray (, and everything else is normal and parsed as if that ( were absent”We can just look at the buffer text directly: if there’s an ERROR and the previous char (after skipping whitespace chars) is ( or {, we know what to do
[Prev in Thread] | Current Thread | [Next in Thread] |