Open rechsteiner opened 3 months ago
Hi @rechsteiner, thanks for bringing this to my attention! You're right, the association of statement_constructor
nodes to data_constructor
, etc nodes does seem incorrect. Could you please open an issue for this on tree-sitter-gleam?
Comments are currently indented incorrectly. Here's an example from
treesit-check-indent
on wisp.gleam:I took a stab at fixing this, but I'm a bit unsure what the best way forward is here. The comment nodes seem to be quite inconsistent in which parents they have, so it's hard to find a solution that works for all cases (e.g. using
parent-bol
). For example,statement_comment
's inside a type definition are under thedata_constructors
node, except comments for the first constructor, which are undertype_definition
itself. Example from wisp.gleam usingtreesit-explore-mode
:It's possible to work around this by hardcoding the offset based on the parent's type like this:
But it feels a bit fragile. Maybe it would be better to improve the way comments are parsed inside the tree-sitter-grammar itself?