Closed eloyrobillard closed 9 months ago
I wrote a PR in https://github.com/cav71/syntax-highlighting-ng/pull/2 that should fix it.
Can you please try to use the artifact built in https://github.com/cav71/syntax-highlighting-ng/actions/runs/7662328847 ? If this works, I'll upload a new addon version. Thanks
Thank you for your reply! š I got the following error when running the artifact:
Anki 23.12.1 (1a1d4d54) (ao)
Python 3.9.15 Qt 6.5.3 PyQt 6.5.3
Platform: macOS-14.0-arm64-arm-64bit
When loading Syntax Highlighting (NG):
Traceback (most recent call last):
File "aqt.addons", line 245, in loadAddons
File "/Users/eloy/Library/Application Support/Anki2/addons21/syntax_highlighting_ng/__init__.py", line 24, in <module>
from . import main # noqa: F401
File "/Users/eloy/Library/Application Support/Anki2/addons21/syntax_highlighting_ng/main.py", line 54, in <module>
LANGUAGES_MAP = {lex[0]: lex[1][0] for lex in get_all_lexers() if len(lex) > 1}
File "/Users/eloy/Library/Application Support/Anki2/addons21/syntax_highlighting_ng/main.py", line 54, in <dictcomp>
LANGUAGES_MAP = {lex[0]: lex[1][0] for lex in get_all_lexers() if len(lex) > 1}
IndexError: tuple index out of range
While experimenting, the following worked for me:
{lex[0]: lex[1][0] for lex in get_all_lexers() if len(lex[1])}
So it looks like only the length of lex[1]
(aliases
) was a problem in my case.
But keeping len(lex) > 1
too is probably safer.
Thanks! I'm making changes latest addon build
š the latest build works
Just published the latest fix https://ankiweb.net/shared/info/566351439
Problem description
Please describe the issue concisely in here. In case of an error: Walk us through the steps you took to get there. What happened? What did you expect to happen?
Extension fails to start when launching Anki.
This is linked to a PR on the original extension: https://github.com/glutanimate/syntax-highlighting/pull/42
To add some context: checking pygments' Available Lexers we can see that lexers like
JsonBareObjectLexer
do not have a "Short names" field (calledaliases
in the code).Because of this we get the error shown below.
Checklist
Please replace the space inside the brackets with an x if the following items apply:
Information about your Anki set-up
Anki 23.12.1
Error message (if any)