tree-sitter-c3 icon indicating copy to clipboard operation
tree-sitter-c3 copied to clipboard

Indentation support

Open tomaskallup opened this issue 11 months ago • 3 comments

I've been playing a bit with indentation queries for neovim, I've landed on this so far:

[
  (compound_stmt)
  (while_stmt)
  (enum_body)
  (switch_body)
  (initializer_list)
  (struct_body)
  (case_stmt)
  (default_stmt)
  (call_invocation)
] @indent.begin

[
  ")"
  "}"
] @indent.branch @indent.end

[
  (block_comment)
  (doc_comment)
] @indent.auto

And it seems to work fine, posting this here mainly for people to find/try/give feedback, I'll PR it after some time of usage, if it doesn't break too much.

tomaskallup avatar Jan 14 '25 12:01 tomaskallup

Using this worked for me when I removed (expr_block). But if (...) {} else {} seems broken (it is indenting twice in the else block)

Mia75owo avatar May 20 '25 16:05 Mia75owo

I finally added an indents.scm with some additions, please give it a try.

cbuttner avatar May 25 '25 12:05 cbuttner

I've tried it, reindented a couple of files and seems fine from a quick glance. I'll see if I run into any issues while editting.

tomaskallup avatar May 26 '25 07:05 tomaskallup