jasonwilliams / anki

Anki VSCode Plugin
MIT License
273 stars 31 forks source link

Extension mistakenly generates new CardIDs rather than reusing the existing ones #128

Closed ccammack closed 4 weeks ago

ccammack commented 4 weeks ago

If I enable anki.md.insertNewCardID and run Anki:SendToOwnDeck three times in a row on this deck:

# Test CardID Bug

## Front (2024-06-08 19:51:42)
%
Back (2024-06-08 19:51:42)

The extension generates a new CardID each time I call Anki:SendToOwnDeck:

# Test CardID Bug

## Front (2024-06-08 19:51:42)

<!-- notecardId: 1717892297556 -->

<!-- notecardId: null -->

<!-- notecardId: 1717892291264 -->
%
Back (2024-06-08 19:51:42)

This appears to happen because Transformer:insertNoteIDs() writes the IDs to the front, but CardParser:parseCardLines() attempts to read them from the back. When the CardID is not found each time, it adds another one.