Refactoring is your friend / moving from 6.x to 9.x

Ali Lloyd ali.lloyd at livecode.com
Wed Jan 2 13:11:15 CET 2019


> Is there a way to "safely" add to LC contextual menu in the script editor?

Yes! It is in a script-only stack behavior of the editor field:
https://github.com/livecode/livecode-ide/blob/develop/Toolset/palettes/script%20editor/behaviors/revseeditorbehavior.livecodescript#L1024

There is also the script editor's menu bar code in a script only stack:
https://github.com/livecode/livecode-ide/blob/develop/Toolset/palettes/script%20editor/behaviors/revsemenubarbehavior.livecodescript

On Wed, Jan 2, 2019 at 11:34 AM Andre Garzia via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Bob,
>
> Yes but it is not as ergonomic. Let me tell an example from a different
> platform. I was working in WebStorm IDE in a JavaScript project. I was
> refactoring a ton of it.
>
> One of the functions worked better with a different parameter order than
> what I originally used. I could select the function declaration, use the
> refactor contextual menu, use "change signature" and alter the param order.
> The IDE then made sure that all code that called that function was changed
> to support the new order automatically.
>
> There was a piece of code inside a function that was useful elsewhere.
> Click refactor, select "extract to new function", fill the new function
> name. It creates a new function and place a call to that function in the
> original place where it was.
>
> These are just two examples. Those refactor tools go much deeper than that.
> It makes it easy and even fun to rework your code.
>
> It would be hard to have the same power in LC because LC is more dynamic
> than JS in terms of scope and what is available. JS modern IDEs maintain an
> AST in memory for your software so that when you refactor, they can locate
> and fix the side effects of your changes. It is more powerful and flexible
> than text replacements because the IDEs actually understand the code
> through having their own parser and stuff.
>
> Buuuuuut some of it could be done in LC with simple text replacement based
> tools.
>
> Is there a way to "safely" add to LC contextual menu in the script editor?
>
> On Mon, Dec 31, 2018, 17:33 Bob Sneidar via use-livecode <
> use-livecode at lists.runrev.com wrote:
>
> > Find/Replace works great. I've done it a few times, so long as the thing
> > you are finding has a unique name that cannot be a part of any other bit
> of
> > code, you should be fine. Backup your stack of course before doing
> > something so drastic.
> >
> > A while ago, the LC dev team optimized the search engine so that it is
> > orders of magnitude faster.
> >
> > Bob S
> >
> >
> > > On Dec 30, 2018, at 11:57 , Andre Alves Garzia via use-livecode <
> > use-livecode at lists.runrev.com> wrote:
> > >
> > > Malte,
> > >
> > > So happy that you're back here my friend. I too spent some time away.
> > >
> > > So, refactoring and constantly trying to erase mistakes of my past
> > coding self are a constant here. I wish we had better refactoring tools
> so
> > that we could rename a handler and all code that called that handler was
> > fixed, or stuff such as rename variable...
> > >
> > > Cheers
> > >
> > > andre
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


More information about the use-livecode mailing list