I used the custom text editor example from
https://github.com/microsoft/vscode-extension-samples/tree/main/custom-editor-sample and got that running first. It has two parts: the extension and the editor itself. In the example the extension is coded in typescript and the editor in vanilla-js. The extension together with some settings in package.json registers commands and event listeners.. and from within the extension you create a webview. This webview is basically an iframe which loads the editor javascript. You also provide html for the webview from within the extension. The communication between webview and extension is done using window.postMessage, but nothing complex.
In my case the editor is build with typescript as well.. so I have a separate build and bundling proces using vite (I use react with my own set of visual editor components). A thing to watch out for is that you will have 2 sets of tsconfigs which need to cancel each other out (one for the extension and one for the editor).. using a monorepo might be better (tldraw does that).
Another thing is that the webview has content security policies, depending on the assets that you use, you might need some extra configuration.