emacs-devel
[Top][All Lists]
Advanced

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

Can this indentation be achieved with treesit-simple-indent-rules?


From: Nicolás Ojeda Bär
Subject: Can this indentation be achieved with treesit-simple-indent-rules?
Date: Mon, 19 Jun 2023 21:11:20 +0200

Hello,

I am trying my hand at writing a tree-sitter major mode. I am using
"treesit-simple-indent-rules" for indentation, but have not managed to
get the indentation style that I am looking for.

Suppose that the AST that you are trying to indent is (a (b c)) and
that you have
the indentation rules

    ((parent-is "a") parent-bol 2)
    ((parent-is "b") parent-bol 0)

Then the following is well-indented:

a
  b
  c

However, if "b" is in the same line as "a", then the result of indentation is:

a b
c

But I would like to have instead

a b
  c

That is, I would like "c" to be indented _as if_ "b" was on a separate
line. Is there a way to achieve this?

Thanks!

Cheers,
Nicolas



reply via email to

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