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.
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
Add ListMessageSplitter and apply to rules command #376
base: main
Are you sure you want to change the base?
Add ListMessageSplitter and apply to rules command #376
Changes from 2 commits
8acbb5d
59a720d
c56eb42
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
How is the caller going to handle a first item that is too big to split?
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.
The idea here is that the listings are split to be fit into a single message, if the first item is too big, it has to go into the next message.
So, "sized" (what goes into the current message still) is "null" for this, "you cannot put more of this in the currently composing message"
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.
Ok, sorry, my message assumed that a listing item could be over the limit here so i was confused about how this method would handle that situation
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.
tentatively? Wouldn't it be safer/clearer to guard the push with
sized.size() + current_item.size()
?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.
no, because there might be things about a listing's size that are optimised or changed as result of an item being added.
For example, if
sized
has no items in it, it will not emit a<ul></ul>
, reducing 8 bytes of the final size. If it does have an item, it'll add that and the item.So it is safer to try, and then back off to the last version of the listing if it becomes too big.
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.
Ohh, I see what you mean. That is quite unfortunate .
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 also don't want to duplicate logic to calculate it, as that's prone to desync if the original logic is updated.