shikijs / shiki

A beautiful yet powerful syntax highlighter
http://shiki.style/
MIT License
9.91k stars 361 forks source link

Properly disposing of highlighters #706

Closed Gerrit0 closed 3 months ago

Gerrit0 commented 3 months ago

I have an application which runs with a --watch mode, and allows users to control Shiki's configured languages/themes. https://github.com/shikijs/shiki/commit/412fe10ef185a329ca9d5e2f722751e3cd7389a5 added warnings about loading too many highlighters, but looking at that commit, there isn't an obvious way to unload a highlighter which will no longer be used. There also doesn't appear to be a Symbol.dispose method that I can call.

Notes:

Gerrit0 commented 3 months ago

Thanks @antfu!