Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@alexr00
Copy link
Member

@alexr00 alexr00 commented Jan 5, 2026

@alexr00 alexr00 enabled auto-merge (squash) January 5, 2026 11:06
@alexr00 alexr00 self-assigned this Jan 5, 2026
@vs-code-engineering vs-code-engineering bot added this to the December / January 2026 milestone Jan 5, 2026
return false;
}

if (hasHardLineBreak(baseLine) || hasHardLineBreak(currentLine)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's a little inconsistent that some regex-es are tested as "variable.test(...)" and some are wrapped into local functions.

@alexr00 alexr00 merged commit 338ca18 into main Jan 5, 2026
6 checks passed
@alexr00 alexr00 deleted the alexr00/eligible-frog branch January 5, 2026 11:11
Copy link

@justingrant justingrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I was too late to review this before it was merged, but I think there are a few test cases that look wrong. I also provided a few additional test cases that may be helpful.

@@ -222,4 +222,12 @@
assert.strictEqual(result?.title, 'title');
assert.strictEqual(result?.body, 'Wrapped paragraph across lines.\n\n- Item 1\n - Nested item\n More nested content\n- Item 2\n\nAnother wrapped paragraph here.');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: I think the nested lines should be merged.

Suggested change
assert.strictEqual(result?.body, 'Wrapped paragraph across lines.\n\n- Item 1\n - Nested item\n More nested content\n- Item 2\n\nAnother wrapped paragraph here.');
assert.strictEqual(result?.body, 'Wrapped paragraph across lines.\n\n- Item 1\n - Nested item More nested content\n- Item 2\n\nAnother wrapped paragraph here.');


const result = await titleAndBodyFrom(message);
assert.strictEqual(result?.title, 'title');
assert.strictEqual(result?.body, 'This is wrapped text that should be joined.\n\n- List item with\n continuation\n- Another item');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something weird is happening with the display of this suggestion where the original code is shown as a blank line. But anyways the list continuation line should not have a line-break before it.

Suggested change
assert.strictEqual(result?.body, 'This is wrapped text that should be joined.\n\n- List item with continuation\n- Another item');

assert.strictEqual(result?.body, 'Wrapped paragraph across lines.\n\n- Item 1\n - Nested item\n More nested content\n- Item 2\n\nAnother wrapped paragraph here.');
});

it('handles nested lists', async function () {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexr00 Sorry, I wasn't quick enough to review this PR before merging, but I'd suggest adding a few more test cases, including some using numbered list items which are harder to implement than unordered lists because the numeric part can be variable-length. Also, the number of spaces is actually quite lenient in GitHub. Finally, code blocks and additional paragraphs are also supported in GH lists, so should probably have test cases for those.

I didn't review this PR code closely, but I did see a few 2's in the PR code, so wanted to make sure that you weren't assuming that the list indentation was always 2 spaces per level and/or that the list marker was always one character.

Here's some test cases, adapted from https://chatgpt.com/share/695c1f08-b928-8004-88c1-79417405b729. All the cases above should have their lines joined where there's a single \n. I apologize if some of these duplicate codepaths that were tested in other tests!

I suspect it'd be good to also make nested versions of these tests... I'll leave that as an exercise for copilot! :-)

  1. Basic numeric list
    continuation.
    Third line

  2. Additional spaces are
    OK for a continuation (unless it's 4 spaces which would be a code block).
    Third line

  • Additional spaces are
    OK for a continuation (unless it's 4 spaces which would be a code block).
    Third line
  1. Multi-digit numbers should also
    work for a continuation.
    Third line

  2. Multi-paragraph lists are also supported.

    Second paragraph in the same list item.
    Third line

  • Multi-paragraph lists are also supported.

    Second paragraph in the same list item.
    Third line

  1. Item with code:

    code line
    code line
    
  • Item with code:

    code line
    code line
    
  1. Fewer spaces are also OK
    for a list continuation (as long as there's at least one space)
  • Fewer spaces are also OK
    for a list continuation (as long as there's at least one space)
  1. Fewer spaces are also OK
    for a list continuation (as long as there's at least one space)
  • Fewer spaces are also OK
    for a list continuation (as long as there's at least one space)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the test cases!

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

Successfully merging this pull request may close these issues.

4 participants