help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Setting up indent-on-type in a treesit based major-mode


From: Joel Reicher
Subject: Re: Setting up indent-on-type in a treesit based major-mode
Date: Mon, 30 Dec 2024 20:30:29 +1100
User-agent: Gnus/5.13 (Gnus v5.13)

Karan Ahlawat <ahlawatkaran12@gmail.com> writes:

Today I was using ruby-ts-mode and found out that it can indent some keywords as soon as they're typed out fully (example, when inside a case block). I'd love to implement such a feature in scala-ts-mode, so I looked at the source code, but could not see anything special it might be doing besides simple treesit indent setup.

So, how does it exactly achieve this indent-on-type behavior (I can see the matcher being called if I set treesit--indent-verbose to t), and how could I reproduce this in my own major-mode?

ruby-ts-mode is a derived mode, and the parent is ruby-base-mode which has some electric indent stuff. I think that's what you're after?

Regards,

       - Joel



reply via email to

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