From: Dmitry Gutov <dmitry@gutov.dev>
To: Yuan Fu <casouri@gmail.com>
Cc: 74386@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
Theodor Thornhill <theo@thornhill.no>,
marius.kjeldahl@gmail.com
Subject: bug#74386: Tree-sitter javascript indentation
Date: Thu, 12 Dec 2024 05:20:18 +0200 [thread overview]
Message-ID: <bf499bbc-4937-4f92-886b-3fb384514c33@gutov.dev> (raw)
In-Reply-To: <C8322A63-40E0-4BE1-B799-5B8D0FF9E261@gmail.com>
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?
next prev parent reply other threads:[~2024-12-12 3:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-16 23:26 bug#74386: Tree-sitter javascript indentation Marius Kjeldahl
2024-11-17 19:18 ` Dmitry Gutov
2024-11-17 19:21 ` Marius Kjeldahl
2024-11-17 22:12 ` Dmitry Gutov
2024-11-17 22:21 ` Marius Kjeldahl
2024-11-17 22:41 ` Dmitry Gutov
2024-11-18 8:35 ` Marius Kjeldahl
2024-11-18 15:29 ` Dmitry Gutov
2024-11-30 10:01 ` Eli Zaretskii
2024-12-01 5:23 ` Yuan Fu
2024-12-01 13:11 ` Dmitry Gutov
2024-12-01 19:10 ` Yuan Fu
2024-12-01 22:33 ` Dmitry Gutov
2024-12-02 2:31 ` Yuan Fu
2024-12-11 6:18 ` Yuan Fu
2024-12-12 3:20 ` Dmitry Gutov [this message]
2024-12-12 5:28 ` Yuan Fu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bf499bbc-4937-4f92-886b-3fb384514c33@gutov.dev \
--to=dmitry@gutov.dev \
--cc=74386@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=marius.kjeldahl@gmail.com \
--cc=theo@thornhill.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).