Closed benjamin-weller closed 1 year ago
@benjamin-weller could you explain where these noteIDs come from? Why are they added and what is generating them, the markdown would be hand written most of the time. I may be missing some context here
These note IDs are uniquely generated by Anki.
See the note/card ID section of the browser search documentation here.
IIUC these IDs uniquely identify the note in question; as such you could eventually update a specific note given its parsed note ID.
How I intend to eventually allow for updating of already created notes:
noteId
out of the comments (this change)Now that there's a way for us to update notes, I would like to have a way for us to automatically insert the note IDs into the markdown during the deck/note creation command.
How I intend to get/insert the note ID into markdown:
Anki: Send To Deck
(or other creation command) in VS CodeHey @benjamin-weller great work on making a start on this, I wasn't ignoring, it was just the holidays and I didn't have time to look over this. Hopefully I should have a bit more time now.
Thinking about the workflow here... Someone will create a note in VS Code, when they send it to Anki, AnkiConnect gives us an ID back in the response I believe. Are you planning to take the ID and insert it back into the markdown once sent? (I understand this PR doesn't deal with that right now)
Do you have an idea how this comment will look like?
100% no worries, you've been very responsive before and honestly I have no expectations around super prompt responses, this is OSS; not much money changing hands here.
Someone will create a note in VS Code, when they send it to Anki, AnkiConnect gives us an ID back in the response I believe. Are you planning to take the ID and insert it back into the markdown once sent? (I understand this PR doesn't deal with that right now)
Yes, that's the ultimate goal
Do you have an idea how this comment will look like?
Yes the comment should look like <!-- notecardId: ###### -->
or <!-- notecardId = ###### -->
. I've generally tried to be tolerant of spaces in my regex.
Hey @benjamin-weller, maybe im doing something wrong here but could you explain why noteId isn't coming through when I test it?
I've also realised this repo doesn't support proper linting on CI so im going to sort that out. I will PR it, you may need to rebase apologies in advance
Sounds good I'll rebase here.
The unit tests pass and that's what I tested against, can you give me a direction as to how to set up your testing environment?
Is it like building a trial/test version of the extension and installing that?
Sure
https://github.com/jasonwilliams/anki/blob/main/CONTRIBUTING.md#debugging I clicked "Run & Debug" icon on the left, then clicked the play button next to "Run Extension".
This should launch another instance of VSCode, I used that to test. In the original instance you should be able to set breakpoints and inspect the code
Preliminary investigation is leading me to confusing places:
I'll continue to debug.
I don't know why the regex wasn't working with my previous setup, but I manually tested, and ran the unit tests; both now pass.
Here's what I get during manual debugging:
Awesome work thanks, I’ll take another look. Also it seems there’s a conflict with package.json, you may need to try and rebase
Your lockfile causes conflicts, like its trying to set it back to version 1, what version of nodejs/npm are you using? Everything else seems ok
Ok, I'm relatively new to the git flow, please let me know if my changes here match up and can be merged.
LGTM
Hey @benjamin-weller now this is merged what are your next steps?
I've outlined what I intend to do next here.
This change allows for a parsing of note IDs. This is the first step in allowing (eventually) the automatic storing of the created note ID in the markdown file.