HiPhish / rainbow-delimiters.nvim

Rainbow delimiters for Neovim with Tree-sitter
https://gitlab.com/HiPhish/rainbow-delimiters.nvim
Apache License 2.0
470 stars 35 forks source link

Kotlin #63

Closed bomgar closed 7 months ago

bomgar commented 7 months ago

add kotlin support

HiPhish commented 7 months ago

Thank you. I noticed that the curly brace around the when body are not included. However, they are in the hierarchy above the when_subject, so the when_subject would be highlighted one level below the body, even though optically they are on the same level and the subject comes before the body. That's just weird.

How about this pattern instead?

(when_expression
  subject: (when_subject
    "(" @delimiter
    ")" @delimiter)
  "{" @delimiter
  "}" @delimiter @sentinel) @container

This would highlight both sets of delimiters at the same level. Does this make sense in Kotlin, or are there other cases where this would look wrong?

bomgar commented 7 months ago

I think that makes sense. You want me to open another PR?

bomgar commented 7 months ago

I totally forgot about that one:

when {
    1 == 1 -> print("1")
    else -> print("not")
}
HiPhish commented 7 months ago

It's OK, I have done it myself. I just needed confirmation from someone who knows Kotlin better.