swyddfa / esbonio

A language server for working with Sphinx projects.
https://docs.esbon.io/
131 stars 21 forks source link

Esbonio crashes when Sphinx Immaterial Theme is used #451

Closed twodrops closed 1 year ago

twodrops commented 1 year ago

Immaterial theme looks like a good replacement for the not so good maintained RTD Theme.

Esbonio however has a problem with it.

On first startup the theme downloads and caches Google fonts. https://github.com/jbms/sphinx-immaterial/blob/8c94664fd56baa87abf023a7b3aa7748c3c15828/sphinx_immaterial/external_resource_cache.py#L129

It works fine with a local sphinx-build. Esbonio does not seem to like this async download step during its build and just hangs.

/usr/local/lib/python3.10/site-packages/esbonio/lsp/sphinx/init.py:164: RuntimeWarning: coroutine 'add_google_fonts..do_fetch' was never awaited

I have raised an issue at Immaterial theme as well https://github.com/jbms/sphinx-immaterial/issues/163

jbms commented 1 year ago

I suspect the issue has to do with nesting of asyncio stuff.

In principle the code in sphinx-immaterial for downloading resources could be changed to not use asyncio. But it would be better if that were not necessary.

I wonder if using nest-asyncio would fix the issue: https://pypi.org/project/nest-asyncio/

Still it is odd that it would hang rather than raise an exception.

Perhaps you can do some additional debugging and try to figure out the cause a bit more?

twodrops commented 1 year ago

This issue has been fixed now by immaterial theme and can therefore be closed. https://github.com/jbms/sphinx-immaterial/issues/163