ankitects / anki

Anki's shared backend and web components, and the Qt frontend
https://apps.ankiweb.net
Other
18.82k stars 2.13k forks source link

What support is missing from VS Code for writing Anki add-ons? #2791

Closed brettcannon closed 11 months ago

brettcannon commented 1 year ago

(Since this is specific to your docs, I figured this didn't belong in your forum, but if that's wrong than I apologize.)

https://addon-docs.ankiweb.net/editor-setup.html#pycharm-setup says, "You can also use other editors like Visual Studio Code, but we find PyCharm gives the best results." As the developer manager for the Python extension in VS Code, I was wondering if you could elaborate as to what VS Code is missing that causes you to recommend PyCharm explicitly over us?

dae commented 1 year ago

It's nice that you're actively trying to improve!

I can't remember an exact list of the issues I ran into, but I'll try to list a few as I encounter them, as I still will use VSCode when IntelliJ is not open and I need to make a quick edit. If relevant, our default config is in .vscode.dist.

brettcannon commented 12 months ago

Thanks for the input! I'll pass it along to the appropriate folks since that seems to all be Pylance-specific (you can also try using Jedi as your auto-complete provider in case it gives you a better experience).

dae commented 12 months ago

Jedi seems worse unfortunately - no warnings in the first case, but doesn't recognize the types either, and in the second case, it doesn't even know sync_media() exists.

raine commented 7 months ago

In case this helps someone else, I figured out that In neovim, with pyright as LSP, you can get anki imports working by adding a pyproject.toml with:

[tool.pyright]
extraPaths = [
  "/path/to/anki/pylib",
  "/path/to/anki/qt"
]

where /path/to/anki is a checkout of https://github.com/ankitects/anki