unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Setting up indent-on-type in a treesit based major-mode
@ 2024-10-20 19:09 Karan Ahlawat
  2024-12-30  9:30 ` Joel Reicher
  0 siblings, 1 reply; 2+ messages in thread
From: Karan Ahlawat @ 2024-10-20 19:09 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

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?

Thanks,

Karan


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Setting up indent-on-type in a treesit based major-mode
  2024-10-20 19:09 Setting up indent-on-type in a treesit based major-mode Karan Ahlawat
@ 2024-12-30  9:30 ` Joel Reicher
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Reicher @ 2024-12-30  9:30 UTC (permalink / raw)
  To: Karan Ahlawat; +Cc: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-30  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-20 19:09 Setting up indent-on-type in a treesit based major-mode Karan Ahlawat
2024-12-30  9:30 ` Joel Reicher

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).