Click a method to access it

Hi,

In Script Debugger, can I click a method called to access it in the script where it is written, like in Eclipse for example ?

Thx.

1 Like

If by “method” you mean an AppleScript hander, then yes, there is a pop-up menu at the top of the script window called the Navigation Bar that shows the names of each appleScript handler and selecting it will put the cursor the handler in the script.

If you don’t see it, click “Show Navigation Bar” in the view menu

We don’t offer a means of jumping directly from a handler reference to its declaration. There is the Table Of Contents menu (in the nav bar just above the text editor) which lets you go to any handler, property or script object declaration.

This would be a nice-to-have feature though, command-click on a handler declaration to take you to the handler definition, Xcode-style. :slight_smile:

2 Likes

Along the same lines, what would thing think about when selecting a hander from the TOC menu, the entire handler is selected if the Shift-key is down; the hander contents are selected in the option key is down; the handler declaration is selected if the command key is down?

All the modifier keys are already used to control how the TOC menu is sorted.

Yes, on mouse down, but once the menu is display the user could change modifier keys and get the different behaviors when the selection is made. (although that would probably violate all kinds of User Interface guidelines)

Well we could give it its own shortcut. How about command-B? Oh, that’s already taken. Wonder what it does in this situation?

:wink:

Agreed. I’d also asked for this some time ago. I haven’t upgraded to version 7 yet because so far I haven’t noticed any particular feature that I would expect to make a big difference in my day to day usage, but this one would definitely get me to upgrade because of how incredibly useful it would be! Although I understand it’s probably not the most trivial one to implement.

The opposite direction would also be nice, i.e. call hierarchy!

It looks like it either sorts alphabetically or order in script, depending on preference setting.

Shift toggles sort order from the preference setting to alphabetical or order in script.

Control or option removes Properties from the list

Shift used with control or option changes sort order and removes properties.

So it seems there’s more that could be done with the modifier keys, unless there are functions I’m not seeing.

It would be easy enough to script that kind of navigation, but not sure how to trigger that with a command-click.

The preference can change the sort order from alpha to order in the script. Is “call hierarchy” something else?

Not sure about that. Possibly for trivial cases. Once you account for all of the possible ways handlers on script objects can called , think it could get tricky pretty fast to identify the handler reference and locate its declaration. :face_with_raised_eyebrow: Would be cool to have though and certainly worth paying for.

I basically meant a way of seeing all the places a handler is called from, so that in the following example you could not just move to drinkCoffee() from e.g. getSomethingDone(), but you could also start by looking at drinkCoffee() and see that it is called from both getSomethingDone() and relax().

to getSomethingDone()
	drinkCoffee()
end getSomethingDone


to relax()
	drinkCoffee()
end relax


to drinkCoffee()
	# ...
end drinkCoffee

A post was split to a new topic: macOS Mojave Dark Mode