Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indent query #51

Open
name-snrl opened this issue Mar 10, 2024 · 0 comments
Open

indent query #51

name-snrl opened this issue Mar 10, 2024 · 0 comments

Comments

@name-snrl
Copy link

Hello, I have been trying to write my own indentation queries following RFC 166. But I ran into a number of problems. In my case it comes down to two problems, one of which I think can be easily solved.

; one day it will work, but not today.
; 
; - [x] attrs
; - [x] lists
; - [x] multiline(indented) string
; - [x] parenthesized
; - [ ] let in. unfortunately, there is no way to indent exclusively the let in
;   block. it would be cool to see a proper indentation for the first line in
;   (binding_set) in the future. then we could just add it and remove
;   (rec_attrset_expression) and (attrset_expression)
; - [ ] nested if else

[
  (formals)
  (ERROR (formals))
  (apply_expression)

  (rec_attrset_expression)
  (attrset_expression)
  ;(binding_set)
  (binding)

  (inherit)
  (inherit_from)

  (list_expression)
  (parenthesized_expression)
  (indented_string_expression)
] @indent.begin

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

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

[
  (comment)
  (string_fragment)
] @indent.auto

Basically my question is: is it that easy to change (binding_set) so that the block starts from the previous line instead of the new line?

The nested if else looks much more complicated, I've never been able to come close to a solution :с

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant