-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: format most commented elements #161
feat: format most commented elements #161
Conversation
ec0c60a
to
cf5b2af
Compare
cf5b2af
to
2de8a57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. The idea of flow is fantastic.
Could you please also edit the changelog and the limitation doc to reflect latest changes? For example, https://enter-tainer.github.io/typstyle/limitations/#when-there-are-block-comment-child-gives-up-formatting-the-whole-node is no longer valid
2de8a57
to
373aba9
Compare
3612dc0
to
6a2fadc
Compare
Thanks! |
This PR makes the most elements formattable. The only untouched expressions are
Parenthesized
,FieldAccess
, andFuncCall
, which have special treatment. Other elements are all marked formattable if not in math. No style change.Fixes a bug with destructuring introduced in #154. Destruct and params with line comments should not fold into one line.
We treat elements focused on in this PR as flow of items. They are joined by spaces (can be optional) or blocks, and no line break is allowed within.
We use a trick. When formatting these elements, we need not care about the syntax, but simply consider their types and make corresponding countermeasures. In some cases where Expr and Pattern coexist, we need to record the order.
The implementations are subject to change for simplicity and expressiveness.