PKief / vscode-markdown-checkbox

Get it from the marketplace:
https://marketplace.visualstudio.com/items?itemName=PKief.markdown-checkbox
MIT License
34 stars 11 forks source link

Date string regex matches to-do item description in certain scenarios #25

Closed Simon-Claudius closed 3 years ago

Simon-Claudius commented 3 years ago

Hey Philipp, Thanks for making this lovely extension :).

I found a little issue. When unchecking a to-do item whose description contains open brackets (such as in a Markdown link) with leading whitespace, that part is matched and therefore removed. Here's a GIF showing this:

checkbox toggle

I think this is the line leading to this behaviour: https://github.com/PKief/vscode-markdown-checkbox/blob/518bc444899acfb46c824059d51f94d316da5ef6/src/toggleCheckbox.ts#L97

The set matching the date string could be modified to include any characters except an open bracket. I'm not sure the match should also be lazy, but I added it just in case. It seemed safer to me: \s+\[[^[]+?\]$

Take care of yourself and stay safe, Simon-Claudius

PKief commented 3 years ago

Oups, yeah that shouldn't be the default behavior ;) I'll check that and fix it.