Perhaps using WASM via something like https://extism.org/. That would also open it up to building plugins in multiple languages.
Tangential to this I've wondered if it's possible or advisable to have a utility to port VS Code plugins to a plugin that's compatible with the JetBrains IDEs.