Re: When scripting with Leo, how to call a command by name?

2023-09-03 Thread jkn
FWIW the current options for doing this have always seemed a bit sub-optimal to me, due to the reasons you suggest. c.executeMinibufferCommand('name-of-command') seem like the wrong level to me, I should be able to call something 'lower down' than this... On Monday, September 4, 2023 at 4:34:0

Re: Quick Survey: When running script in leojs, where should the 'vscode' object be accessible?

2023-09-03 Thread Félix
The script local namespace is destroyed after it's finished. On Sunday, September 3, 2023 at 11:16:44 PM UTC-4 tbp1...@gmail.com wrote: > That's very nice! What is the scope of variable defined in a script like > this? For example, you wrote const userInput = await vscode where I > would

Re: When scripting with Leo, how to call a command by name?

2023-09-03 Thread Félix
I agree, respecting existing parameter orders and signatures in general is very important. But making it optional does not interfere with normal usage. On Sunday, September 3, 2023 at 11:06:54 PM UTC-4 tbp1...@gmail.com wrote: > I've never encountered or used that method. But it's another cas

Re: Quick Survey: When running script in leojs, where should the 'vscode' object be accessible?

2023-09-03 Thread Thomas Passin
That's very nice! What is the scope of variable defined in a script like this? For example, you wrote const userInput = await vscode where I would have expected let userInput = If the script were to be run again, then *userInput* might want to take on a different value which would be

Re: When scripting with Leo, how to call a command by name?

2023-09-03 Thread Thomas Passin
I've never encountered or used that method. But it's another case where I would resist changing the signature of an existing command. If it's only a matter of making and argument optional, that would be more palatable. The "events" in question here are not Python things but Leo objects. They

Re: Quick Survey: When running script in leojs, where should the 'vscode' object be accessible?

2023-09-03 Thread Félix
I thought I'd share this :) Just a small example script that is possible to run in leojs, (with also having the vscode API available in g.app.vscode) Incredibly, when executing the script, the global objects you'd expect to see in javascript ,(console, fetch, ect...) are available, as shown bel

Re: When scripting with Leo, how to call a command by name?

2023-09-03 Thread Félix
Having in mind a fresh new user's perspective, I wonder if *doCommandByName*, *the method with the most intuitive name to use for such a task to perform*, could not be relatively easily modified to support not having an 'event' passed to it? ...I'm not familiar with those 'events' concepts in

Re: When scripting with Leo, how to call a command by name?

2023-09-03 Thread Thomas Passin
There's also c.k.simulateCommand('name-of-command'). I'm not sure why there are both, since they seem to do the same thing. With either one, you don't need to supply a fake event. The method takes care of that. I use whichever one I remember first. On Sunday, September 3, 2023 at 9:08:31 PM

Re: When scripting with Leo, how to call a command by name?

2023-09-03 Thread Jacob Peck
I tend to use c.executeMinibufferCommand('name-of-command') -- doesn't need any extra parameters, and Just Works TM. Jake On Sun, Sep 3, 2023 at 8:41 PM Félix wrote: > Making script in Leo is great, with the globally defined vars g, c and p > anything is possible. > > But what is the recommende

When scripting with Leo, how to call a command by name?

2023-09-03 Thread Félix
Making script in Leo is great, with the globally defined vars g, c and p anything is possible. But what is the recommended way of doing a simple command by name in a script? The *c.doCommandByName* method exists, but it insists on having an event as a second parameter. I discovered that I c

Re: Quick Survey: When running script in leojs, where should the 'vscode' object be accessible?

2023-09-03 Thread Félix
Thanks to you both!! g.app.vscode also felt right to me, so I'm glad this is a shared view! Félix On Sunday, September 3, 2023 at 7:10:10 AM UTC-4 Edward K. Ream wrote: > On Sat, Sep 2, 2023 at 8:49 PM Félix wrote: > >> Not sure what to decide for this so I thought of doing this quick survey!

Re: ENB: info re unit tests

2023-09-03 Thread Edward K. Ream
On Sun, Sep 3, 2023 at 6:54 AM Edward K. Ream wrote: > This Engineering Notebook post discusses conventions for unit testing. It > continues a discussion in PR #3532 > . This post will be > pre-writing for an info item. > See #3534

ENB: info re unit tests

2023-09-03 Thread Edward K. Ream
This Engineering Notebook post discusses conventions for unit testing. It continues a discussion in PR #3532 . This post will be pre-writing for an info item. Félix asked about the difference between assert and self.assertX (self.assertEq

Expect Leo 6.7.5 on Friday, September 16

2023-09-03 Thread Edward K. Ream
Leo 6.7.5 contains significant improvements to Leo's python importers. It also adds several new commands. I'll save any further bright ideas for enhancements for Leo 6.7.6 :-) This release will be the last before the first official release of leoJS. Félix continues to suggest small changes. I'l

Re: Quick Survey: When running script in leojs, where should the 'vscode' object be accessible?

2023-09-03 Thread Edward K. Ream
On Sat, Sep 2, 2023 at 8:49 PM Félix wrote: > Not sure what to decide for this so I thought of doing this quick survey! > :) > > When running scripts, (CTRL+B) Leo offers the g, c and p variables. I > obviously want to expose the vscode API from it's base object "vscode". > > Should it be top-lev

Re: Help needed with understanding @others vs @all directives

2023-09-03 Thread Edward K. Ream
On Sat, Sep 2, 2023 at 6:15 PM Félix wrote: I've never used the @all directive and I'd like to test it properly with > both Leo and LeoJS. In leoPy.leo (LeoPyRef.leo) the node @file ../doc/leoAttic.txt contains the only @all directive that Leo uses. A recent PR cleared most of the attic, but y