Thanks for this great question Thomas! (I'll list a few ways, some of which you already know, but I'll list them all for other people to read about in case they didn't know)
First of all, like for the original Leo, a good way to customize the behavior is to write Leo Scripts in the body text of a node (or an outline of many nodes, as scripts can span many nodes and are affected by @others and sections references just like @files.) and use such scripts either in @button, or @command nodes. (Those can even be placed in your leoSettings.leo to be available in all other opened Leo documents.) See this repository for sample Leo Scripts that address many use cases of UI interaction in VSCode from LeoJS: https://github.com/boltex/scripting-samples-leojs Another way would be to write a VSCode extension that uses the LeoJS API which exposes the 'g' object. (*so that the extension would be a 'LeoJS plugin'*) With which you can access to all of LeoJS. See this repository for a basic 'hello world' VSCode extension that interacts with the LeoJS extension through it's exposed API: https://github.com/boltex/extension-sample-leojs (See also this easy & short tutorial at https://code.visualstudio.com/api/get-started/your-first-extension on how to build and run an extension from source if you've never built a VSCode extension before.) Lastly, *for modifying LeoJS itself *(instead of running scripts from custom @commands or @buttons, or building an extension and accessing the LeoJS global 'g' object) you would just need to clone the LeoJS repository. To then build and run it would be the same process as any of the VSCode sample extensions, such as this hello-world extension <https://github.com/microsoft/vscode-extension-samples/tree/main/helloworld-sample>. (That is to say, running the 'npm install' in the repository folder command to get all dependencies, and pressing F5 to start the 'run and debug' command in VSCode.) Hope this helps, and please don't hesitate to ask more questions or propose suggestions :) Félix On Thursday, May 2, 2024 at 12:30:22 PM UTC-4 Edward K. Ream wrote: > On Tuesday, April 30, 2024 at 10:52:57 AM UTC-5 Thomas wrote: > > Using Leo, we can edit LeoPyRef, save the edits, restart Leo, and test our > changes. With LeoJS, how can we do the equivalent: editing the code of > LeoJS and testing it? > > > Interesting question. I am using a hybrid approach: > > Develop with either Leo or LeoJS. Test using either the pytest plugin for > vs-code or with Leo itself. > > Edward > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/495e6dab-a3fc-4bde-b9bd-9d4105b13a4an%40googlegroups.com.
