frenya / vscode-recall

MIT License
24 stars 7 forks source link

Flashcards test of current file does not work #16

Closed j-hap closed 1 year ago

j-hap commented 1 year ago

Hi,

when I click on the "brain" icon in the top right toolbar, Recalls uses all md-files in the Folder for the test. The tooltip instructs to press Alt when clicking on the icon to test only with the current file. But that does not work, I only see "No more cards to review. Well done!" although there are flashcards defined in the current file.

Is this a bug or am I doing something wrong? And thanks for the extension :)!

frenya commented 1 year ago

Hi,

the only reason I can think of is that all of the cards in the current file have been reviewed and are not due for next review until some day in the future. Hence the "no more cards to review".

You can easily check that by hovering your mouse over the card badge (NEW, GOOD, HARD, etc.) in the source file. You should see the date of the next review in the tooltip.

Let me know if the problem persists.

And you're welcome :)

j-hap commented 1 year ago

I'm afraid that isn't the reason, because I even deleted the .recall directory and the extension gives me the same message.

frenya commented 1 year ago

Hi. This is really strange. I checked the code again and there is no apparent reason why the cards wouldn't show. That is if they are really due and do show in the full review. Sorry.

If you can, please reload the window to be on the safe side and try the file review again.

If it still doesn't work, could you send me the full path of the file you are trying to review? Right click on the tab and "Copy path". Thank you.

j-hap commented 1 year ago

I just tested it with a new install of vs codium just in case some extensions in vs code don't play well with each other. But there is the same issue. I put this simple file

---
recall: header
---

# This is a question

This is the answer

into C:\Users\j-hap\TEST\questions.md and ran the Recall: Flashcards Test of current file command, but to no avail. The Recall: Flashcards Test works fine.

I think it's worth mentioning that I also don't see the card badges next to the header in the editor, but I do get a popup when hovering over the question with the mouse, but that might be a separate issue:

grafik

frenya commented 1 year ago

Ok. Thanks for providing the additional details. I will look into the issue, but cannot make any promises since I currently have no clue what might be causing it ... :/

j-hap commented 1 year ago

So after my first hacky debugging-a-ts-vs-code-extension-experience I think I found the issue: in startFileReview you call openWebview(doc.uri.fsPath); and on windows the file path is build with escaped backslashes, but in getFilesData the paths of the available files is given with unix-like forward slashes. The filter function then filters out all available files, because with the / separator nothing matches the expected file path separated by \\, which in turn returns an empty dataset, which seems as if there are no cards left to train on. I hope that was understandable...

edit: you're putting all available file paths through the pathNormalizer. If you do that for the given file path as well, everything works as expected.

j-hap commented 1 year ago

regarding the missing badge next to the question: I see an error message in the devtools about a forbidden local resource load: workbench.desktop.main.js:660 Not allowed to load local resource: file:///C:/Usersj-hap.vscode-oss%0Extensions%0Frenya.vscode-recall-0.11.5resourcesicons%E0%AE%ADge_NEW_13.svg

frenya commented 1 year ago

Hi. Thanks for the extensive diagnosis. Being on Mac myself, I was afraid that the issue has to do with specifics of Windows :/

Anyway. I have set up a windows environment now and was able to recreate the issue. I'll will let you know as soon as I manage to resolve it.

frenya commented 1 year ago

Fix for both issues was published in version v0.13.0

j-hap commented 1 year ago

Thanks! I got the update and it works as expected now. Small mistake in the changelog, you probably meant to write 2022-09-09

Will you push the updated code to Github?

frenya commented 1 year ago

Great. Thanks for catching the changelog typo.

Yes, I will push the update to GitHub soon.