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

gleam-ts-mode: Auto-indentation when pressing RET in the presence of incomplete Nodes #34

Open
frou opened this issue Aug 27, 2024 · 4 comments

Comments

@frou
Copy link
Contributor

frou commented Aug 27, 2024

e.g. when typing a function signature and pressing RET after the opening {, should the new line be automatically indented by an additional 2 spaces?

I see that the gleam-ts-mode.el file has a good amount of stuff related to indentation, but I'm not sure if such auto-indentation on RET is supposed to work yet. It doesn't for me.

@J3RN
Copy link
Member

J3RN commented Aug 27, 2024

I'd say that ideally it should work. The rules get a bit odd because when starting e.g. a new function, there's not an concrete syntax tree (CST) node there that we can attach indentation rules to. I thought we had worked around this with a rule like "anything after the braces is indented" but I'll need to check again.

@frou
Copy link
Contributor Author

frou commented Aug 27, 2024

Thank you, that explanation makes a lot of sense.

@frou frou changed the title gleam-ts-mode: Is auto-indentation when pressing RET at the end of a line supposed to work? gleam-ts-mode: Auto-indentation when pressing RET in the presence of incomplete Nodes Aug 27, 2024
@abueide
Copy link

abueide commented Oct 21, 2024

@J3RN should indentation work when creating a newline inside of a pub type Blah {} brace? Seems to not work in those, only in functions

@J3RN
Copy link
Member

J3RN commented Oct 27, 2024

Obviously I'm a bit strapped for time lately, but if someone wants to investigate these issues, you can play with the indentations rules. Happily they're quite declarative, though the selectors (e.g. parent-bol) are a bit arbitrarily defined.

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

3 participants