unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Can this indentation be achieved with treesit-simple-indent-rules?
@ 2023-06-19 19:11 Nicolás Ojeda Bär
  2023-06-20  6:12 ` Yuan Fu
  2023-06-20 15:34 ` Dmitry Gutov
  0 siblings, 2 replies; 8+ messages in thread
From: Nicolás Ojeda Bär @ 2023-06-19 19:11 UTC (permalink / raw)
  To: emacs-devel

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



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

end of thread, other threads:[~2023-06-20 21:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-19 19:11 Can this indentation be achieved with treesit-simple-indent-rules? Nicolás Ojeda Bär
2023-06-20  6:12 ` Yuan Fu
2023-06-20 10:16   ` Nicolás Ojeda Bär
2023-06-20 15:34 ` Dmitry Gutov
2023-06-20 16:16   ` Nicolás Ojeda Bär
2023-06-20 16:59     ` Dmitry Gutov
2023-06-20 18:45       ` Nicolás Ojeda Bär
2023-06-20 21:53     ` Yuan Fu

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