|
From: | Dmitry Gutov |
Subject: | bug#74386: Tree-sitter javascript indentation |
Date: | Thu, 12 Dec 2024 05:20:18 +0200 |
User-agent: | Mozilla Thunderbird |
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?
[Prev in Thread] | Current Thread | [Next in Thread] |