emacs-devel
[Top][All Lists]
Advanced

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

Re: More Tree Sitter Questions / Problems.


From: Yuri Khan
Subject: Re: More Tree Sitter Questions / Problems.
Date: Thu, 15 Dec 2022 13:05:34 +0700

On Thu, 15 Dec 2022 at 03:44, Perry Smith <pedz@easesoftware.com> wrote:

> All three of ruby-mode, java-mode, and c-mode indent a simple arithmetic 
> expression broken into lines like this:
>
> foodog = 12 + 4 *
>     18 * 99 + 8

My opinion is that this is the wrong problem to solve. Assuming the
example is simplified and there is in fact reason to break lines, it
should be

    variable = 12 +
        4 * 18 * 99 +
        8

or

    variable = 12
        + 4 * 18 * 99
        + 8

or maybe

    variable =
        12 + 4 * 18 * 99 + 8

i.e. prefer breaking lines higher in the AST.

> All three of ruby-ts-mode, java-ts-mode, and c-ts-mode indent it like this:
>
> variable = 12 + 4 *
>                 18 * 99 + 8

Also, this style only makes sense if tab characters are not used.
Otherwise, the alignment will break for users whose tab width differs.
(Emacs’s source code suffers from this a lot.)



reply via email to

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