yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.91k stars 324 forks source link

Incorrect second-level list renumbering on line delete #1155

Closed minimusubi closed 1 year ago

minimusubi commented 2 years ago

Problem

An issue occurs with the automatic renumbering feature of ordered lists. When removing an entire line containing a top level list item, the automatic renumbering does not restart numbering between second level lists, and incorrectly "continues" the numbering instead.

At first glance, #668 appears as a related issue; however, I believe this is a separate issue.

How to reproduce

Start with this markdown:

1. Item to be deleted
2. First level 1
    1. Second level 1
    2. Second level 2
3. First level 2
    1. Second level 1
    2. Second level 2
3. First level 3
    1. Second level 1
    2. Second level 2

Then, delete the entire line containing Item to be deleted. Observe that the items within First level 2 and First level 3 are incorrectly numbered. Expected output:

1. First level 1
    1. Second level 1
    2. Second level 2
2. First level 2
    1. Second level 1
    2. Second level 2
3. First level 3
    1. Second level 1
    2. Second level 2

Actual output:

1. First level 1
    1. Second level 1
    2. Second level 2
2. First level 2
    3. Second level 1
    4. Second level 2
3. First level 3
    5. Second level 1
    6. Second level 2

GIF Demonstration

Export

Configuration

Default. (Tested on fresh install of VS Code with only this extension installed)

Environment

Diagnostic data

No relevant messages in the developer console log.

yzhang-gh commented 2 years ago

You are right. That is a bug.

yzhang-gh commented 2 years ago

Please try out the dev build.

Naitreey commented 1 year ago

Hi @yzhang-gh , it looks like with the latest release (3.5.0) the bug is partially fixed. While the second-level numbered list renumbering works fine by now, the more deeply nested ones still break.

CleanShot 2023-03-05 at 17 56 56

yzhang-gh commented 1 year ago

Thanks. Please try out the latest dev build.