jbms / sphinx-immaterial

Adaptation of the popular mkdocs-material material design theme to the sphinx documentation system
https://jbms.github.io/sphinx-immaterial/
Other
177 stars 28 forks source link

Fix interoperability with Esbonio language server (#163) #258

Closed tim-nordell-nimbelink closed 1 year ago

tim-nordell-nimbelink commented 1 year ago

The Esbonio language server runs its own asyncio loop context when it invokes the Sphinx code. This causes the asyncio.run() call to complain since it's already being run in the same thread.

Since we're already running a set of threads here using PoolExecutor, we can run one more thread which runs the asyncio.run() context in a separate thread. This mitigates the interoperability issue with the Esbonio language server at the cost of an additional thread, and at the cost of blocking the coroutine loop within the Esbonio language server for the closing of the download set.

(See also swyddfa/esbonio#451)

jbms commented 1 year ago

Thanks!

2bndy5 commented 1 year ago

Does this mean we can close out #163? My dev env doesn't seem to like the esbonio extension in VSCode (hit some other non-related issues with the esbonio settings), so my local attempt failed.

UPDATE: I got it working with esbonio default settings! Thanks @tim-nordell-nimbelink

tim-nordell-nimbelink commented 1 year ago

Probably can be closed? I'm using Esbonio within NeoVIM, but did test these changes within VSCode, too. Maybe @twodrops could test it since he opened the original issue in this project?

2bndy5 commented 1 year ago

I got it to work, so I closed the issue. It would be good to get a ~second~ third opinion, but @twodrops noted using a dev container and this fix hasn't been deployed to pypi yet (can be installed with the nightly https://test.pypi.org/project/sphinx-immaterial/0.11.3.post1.dev23/).

twodrops commented 1 year ago

Works like a charm from within DevContainer! Thanks a lot @tim-nordell-nimbelink @2bndy5