-
Notifications
You must be signed in to change notification settings - Fork 19
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
Rework multiline comments #164
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FPtje
commented
Jul 23, 2023
FPtje
commented
Jul 25, 2023
self.StartPos - norm, -- Start | ||
self.EndPos, -- End | ||
64 * (1 - self.Life), -- Width | ||
texcoord, -- Start tex coord |
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.
I'm really happy with this change. The comments used to all be collected and printed at the end. Now they're printed along with the argument. Besides that, having comments in function calls causes the function to be considered multiline.
Comment printing used to depend on whether the code was multiline. Now this dependency is turned around: whether something will be rendered on multiple lines depends on whether there are comments. This makes for a much more natural way of formatting code. This also adds support for comments next to function arguments.
FPtje
force-pushed
the
fp/rework-multiline-comments
branch
from
July 26, 2023 09:25
1a0a29c
to
b9f15a7
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was working on #163, and found myself in a bit of a rabbit hole: I tried to implement the following suggestion:
source
I found glualint to go in an infinite loop. The reason was because of how comment rendering logic depended on whether something is rendered multiline. But then the decision on whether to render something multiline depended on whether there were comments.
The solution is to remove the dependency "Comment rendering -> Multiline", and to only have it the other way around. This has quite some drastic consequences. Some attributes can be removed, others have to be reworked.
This PR keeps track of progress and TODOs.
TODO
{"a", "b", --[[comment]], "c"}
are printed as multiline until the comment. After that it is printed single lineinh field list forceMultiline, set to @hd.multiline or not null $ comments
foo(a, b --[[comment]], c)