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

add basic indents

Open aspeddro opened this issue 3 years ago • 0 comments

This PR add basic support to indents.

Some cases that have not been implemented:

Variant

type user = 
  | Id
  | Name

https://user-images.githubusercontent.com/16160544/153487870-596bf149-8c67-4cac-baeb-50668d369932.mp4

How to set the node/rule where indentation ends?

Labeled Variant Payloads (Inline Record)

| is the cursor

type user =
  | Id
  | Name({|})

Press enter:

type user =
  | Id
  | Name({
  |
  })

Here the indentation not work because Name({}) is a ERROR. record_type rule require a field

ERROR [0, 0] - [2, 12]
  type_identifier [0, 5] - [0, 9]
  variant_declaration [1, 4] - [1, 6]
    variant_identifier [1, 4] - [1, 6]
  variant_identifier [2, 4] - [2, 8]

Could record_type be an optional rule to not generate an ERROR node in the parser?

aspeddro avatar Feb 09 '22 07:02 aspeddro