unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joel Reicher <joel.reicher@gmail.com>
To: Karan Ahlawat <ahlawatkaran12@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Setting up indent-on-type in a treesit based major-mode
Date: Mon, 30 Dec 2024 20:30:29 +1100	[thread overview]
Message-ID: <86zfkd8qmi.fsf@gmail.com> (raw)
In-Reply-To: <a5bbe997-798c-4040-822c-f87fbc8402dd@gmail.com> (Karan Ahlawat's message of "Mon, 21 Oct 2024 00:39:41 +0530")

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	other threads:[~2024-12-30  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=86zfkd8qmi.fsf@gmail.com \
    --to=joel.reicher@gmail.com \
    --cc=ahlawatkaran12@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).