[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#74386: Tree-sitter javascript indentation
From: |
Yuan Fu |
Subject: |
bug#74386: Tree-sitter javascript indentation |
Date: |
Tue, 10 Dec 2024 22:18:20 -0800 |
> On Dec 1, 2024, at 6:31 PM, Yuan Fu <casouri@gmail.com> wrote:
>
>
>
>> On Dec 1, 2024, at 2:33 PM, Dmitry Gutov <dmitry@gutov.dev> wrote:
>>
>> On 01/12/2024 21:10, Yuan Fu wrote:
>>> Ah, I see. That’s a good point, and I definitely prefer the indentation
>>> result of parent-bol here. The one produced by standalone-parent is just
>>> wrong. What we can do is make standalone-parent ignore “.” when checking
>>> for “standaloneness”. And perhaps make it configurable so it’s enabled only
>>> for modes that this waiver makes sense (C-like languages excluding C and
>>> C++).
>>
>> Maybe not by hardcoding this in inside the 'standalone-parent' matcher, but
>> writing this in the indentation rules? Different languages might have
>> differing ASTs for such construct.
>>
>> Or if you meant to do a text search, a period might start a method call, but
>> it could also continue a "range" literal in some other language, or some
>> struct initializer (I think?) in C/C++. Also, some languages allow (and
>> style guides suggest) to have the previous at the end of the line, then
>> followed by newline and then the method name.
>
> Not hard-coded, but customizable, like this:
>
> Yuan
>
> <standalone-predicate-poc.patch>
Circling back on this. WDYT? I think this would benefit all “modern” languages
with chaining method calls.
Yuan
- bug#74386: Tree-sitter javascript indentation, Yuan Fu, 2024/12/01
- bug#74386: Tree-sitter javascript indentation, Dmitry Gutov, 2024/12/01
- bug#74386: Tree-sitter javascript indentation, Yuan Fu, 2024/12/01
- bug#74386: Tree-sitter javascript indentation, Dmitry Gutov, 2024/12/01
- bug#74386: Tree-sitter javascript indentation, Yuan Fu, 2024/12/01
- bug#74386: Tree-sitter javascript indentation,
Yuan Fu <=
- bug#74386: Tree-sitter javascript indentation, Dmitry Gutov, 2024/12/11
- bug#74386: Tree-sitter javascript indentation, Yuan Fu, 2024/12/12
- bug#74386: Tree-sitter javascript indentation, Dmitry Gutov, 2024/12/12
- bug#74386: Tree-sitter javascript indentation, Yuan Fu, 2024/12/13