GNU bug report logs -
#74386
Tree-sitter javascript indentation
Previous Next
Full log
Message #50 received at 74386 <at> debbugs.gnu.org (full text, mbox):
On 11/12/2024 08:18, Yuan Fu wrote:
>>> 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.
It's an interesting suggestion - and the docstring is very readable.
I'd be great to see how it works with some existing modes' indentation
code - e.g. to try to rewrite any of the rules in ruby-ts-mode (do we
have any other ts mode with as many options affecting indentation?).
OT2H the use of 'standalone-parent' is optional, and it's combined with
a matcher anyway, so it's good even if it covers like 80% of the cases.
What would be our next step in this? Replacing all 'parent-bol' anchors
with 'standalone-parent' across most ts modes?
This bug report was last modified 183 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.