Title
#devlog-together
j

Jason Morris

10/03/2022, 2:07 AM
how difficult was that process? I've been considering attempting something similar to allow me to edit sample code in VS Code without having to run the Blawx server.
m

Maikel

10/03/2022, 6:00 AM
Not that difficult but there are some things to be aware of. I'll post some info here later this morning. And we can always jump on a call if needed (I am in the Netherlands, timezone wise)
6:15 AM
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.
j

Jason Morris

10/03/2022, 2:31 PM
Thanks. We have different perspectives on "not that difficult", I guess, but that's very helpful!
m

Maikel

10/03/2022, 4:41 PM
You can do it!😀 and if you need some help then don't be hesitant to contact me and perhaps I can help😊. Good luck!
j

Jason Morris

10/03/2022, 4:55 PM
I will take you up on that. Probably not soon, though. Thanks again!
m

Maikel

10/03/2022, 6:42 PM
Just curious : do you have a typescript codebase and what bundler do you currently use?
j

Jason Morris

10/03/2022, 8:28 PM
I don't, no. I do a little JavaScript (badly), and I use the blockly library that is in the process of being upgraded to typescript by Google.