jasonwilliams / anki

Anki VSCode Plugin
MIT License
275 stars 31 forks source link

Use the current directory structure as deck name #71

Closed duguosheng closed 2 years ago

duguosheng commented 2 years ago

When I write a shell or Python comment in a code block, it is incorrectly resolved to a deck name. So I just think about that could you please add a new option that use the current directory structure as deck name? If the user enables this option

  1. Configure the anki root directory, such as D:/Anki
  2. The program reads the relative path from the current file to the root directory, such as D:/Anki/Deck1/SubDeck1/note.md
  3. Generate anki deck name, Deck1::SubDeck1

Thanks a lot!

jasonwilliams commented 2 years ago
duguosheng commented 2 years ago
  • Would you be happy with the workspace being the root directory? That would make things easier.
  • Is this set as an additional command? Or a default save strategy that can be changed. (I think to begin with we may need to do a command)
jasonwilliams commented 2 years ago

@duguosheng wluld you be happy working on this feature? I don’t think I’ll have time to look at it anytime soon

duguosheng commented 2 years ago

OK, I'll try, but I don't know when it can be finished.

jasonwilliams commented 2 years ago

@duguosheng if you’re stuck at any point feel free to ask here.

https://github.com/jasonwilliams/anki/blob/master/src/commands.ts#L65 Is a starting point.

jasonwilliams commented 2 years ago

@duguosheng this has now been released https://github.com/jasonwilliams/anki/releases/tag/v1.2.6 please let me know if that version is working ok

duguosheng commented 2 years ago

It works, but I don't know why the option save strategy is at the bottom of the setting.

jasonwilliams commented 2 years ago

It works, but I don't know why the option save strategy is at the bottom of the setting.

How/where do you mean?

duguosheng commented 2 years ago

I write option save strategy between schema and defaultDeck in package.json

"anki.api.schema": {
  // ...
},
"anki.saveStrategy": {
  // ...
},
"anki.defaultDeck": {
  // ...
},

But in plug-in settings, it is at the end

image

jasonwilliams commented 2 years ago

I think its in alphabetical order