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:
I can't use the shorthand async methods as rendering is done synchronously, and changing this is highly undesirable
I considered using the loadTheme/loadLanguage method, but if I do this, I could introduce an issue where highlighting works in a watch session, then breaks when that session is restarted, or run outside of watch mode. Not great!
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 aSymbol.dispose
method that I can call.Notes: