Auto code completion for IJ macro

imagej
macro
auto-completion

#64

I just implemented auto completion and online help for ImageJ macro in the script editor. I think that’s quite useful. Or at least I would have loved to have it when I started with macro programming. It’s basic but functional, as you can see here:


#65

Hey @shontie

which language are you using in the script editor? The auto-completion is supposed to work for IJ macro only for now. IJ macro is not really object oriented and input. is not supposed to open any pulldown as there are no methods for objects…

Furthermore, please take care to use the forum functions properly. Your post looks like @frauzufall wrote it and my words look like yours…

Cheers,
Robert


#66

@shontie

I also just tested the IJ. issue you reported and in my Fiji it works:

Can you maybe explain in more detail what you did?

Cheers,
Robert


#67

Hi @haesleinhuepf!

I’ve been using this new functionality a lot lately, and it really speeds up coding. It also has changed the way new users approach macros.

What I realized today is that the autocompletition doesn’t work when typing nested commands, as in:

Could it be possible to include autocompletition in these cases?

Thanks again for the great work!

Cheers,
Nico


#68

Hey @NicoDF

thanks for the suggestion. Nested auto-completion works if you put a space before the method call:

The bracket is considered as part of a command in order to make this working:

But I see your point. Also the run("... commands often don’t work because they are missing parameters in the auto-complete. Furthermore, apparently there is a bug at the moment, because the quotation mark is not considered as part of the command… I can fix that one soonish.


#69

However, I like user-driven software development and I don’t want to nanny coders. Thus, let’s make a poll. I like polls :wink:

What appears more important to you? Auto-completion in nested calls or auto-completion of the string behind the run method? (Examples shown above)

  • print(getP...
  • run("...

0 voters


#70

Dear *,

we’re considering a little update to the IJ macro auto-completion. However, before we ship it to everyone, it would be nice if some volunteers could just test it in order to ensure that it’s not confusing. The idea is: If you search for bit, the new auto-completion might suggest run("8-bit") as well:

Furthermore, the nested auto-completion discussed above should work now…

To test it, please download imagej-legacy.jar and put it in the jars directory of your Fiji installation. Please remove the other image-legacy.jar in the same folder.

Thanks for the support and let me know what you think!

Cheers,
Robert


#71

I tried but it only appears the first option of bitDepth


#72

Hey @mmvpgs,

are you sure you deleted the old imagej-legacy jar file? Oh and, did you restart Fiji after that?

Thanks for testing!

Cheers,
Robert


#73

Sorry, I put it in the wrong folder. It is working!

Cheers,
Mafalda


#74

Hi @haesleinhuepf, thanks for continuing to develop this. Helpful new feature!

Had a quick try and mostly works as expected. Couple of comments:

I noticed that if you start typing to instantiate the autocomplete box, then left-arrow back through the word you get the search results based on the position, see for example this (by moving the cursor back, it’s like I only typed s):
Clipboard

Also the other thing (although I don’t think this is based on the latest version), is that I was using the command run("Select None") and it made me realise that the auto complete is case sensitive. This may be something to consider removing if possible.

Noticed this too and you’re probably well aware of this but you seem to be able to omit the quote altogether and have it work (although it’s still case sensitive as above):
Clipboard2

Thanks again!


#75

Hey @dnmason

thanks for the very valuable feedback!

That’s indeed confusing. I’m not sure how to make this working perfectly. For the moment, I fixed this bug by closing the pulldown in case the Left or Right arrow keys are pressed. If someone knows a better solution, just let me know.

That’s a clear bug introduced with the new auto-complete. I just fixed it. This nicely shows why testers are so important. Thanks @dnmason for taking part!

I fact, run("...") commands with parameters don’t work in general, but we don’t know how to differentiate them from other commands. Furthermore, with the recent changes in the auto-completion, run(select is auto-completed to run(run("Select None") because the nested auto-completion discussed in the poll above. I think that makes sense, but in case anybody knows a better solution, I’m happy to get it working.

Thanks again!

Who wants to test the new-new version, just download imagej-legacy.jar and put it in the jars directory of your Fiji installation. Please remove the other image-legacy.jar in the same folder. Restart Fiji afterwards.

Cheers,
Robert


#76

Hi @haesleinhuepf, this is just great. For now I tested it briefly and it worked just fine for me. The next days I’ll go in more depth and detail.
Thanks for your commitment.
Carsten


#77

Agreed. I hadn’t realised that is what it would do, but it does indeed make sense. Thanks for sorting case-sensitivity.


#78

Hi @haesleinhuepf,

It’s amazing to see that this feature keeps growing! The global search is a great addition indeed. I’ve been playing with it for a while, and I would certainly use it to look for not-so-commonly-used functions, for which I just recall (or have some intuition of) a part of the name.

However, there’s something that I think could improve it’s ease of use: when presenting the list of suggestions, it might be better if the exact “startsWith” matches appeared first (as in the previous version) and then all the rest. What do you think?

Thanks for all the work!

Cheers,
Nico


#79

Hey @NicoDF

This is a fantastic idea! I love it.

I just implemented it. :slight_smile:

Who wants to test the new-new version, just download imagej-legacy.jar and put it in the jars directory of your Fiji installation. Please remove the other image-legacy.jar in the same folder. Restart Fiji afterwards.

Thanks for the great suggestion!

Cheers,
Robert


#80

Hi Robert,

Great effort on the autocomplete!
The new-new version works great for me, except one thing: when starting to type ‘r’ the screen hangs for multiple seconds, which unfortunately is a bit annoying. Perhaps there are too many possible statements?
All other letters are fast enough.

Thanks!
Bram


#81

Hey @bramvdbroek,

welcome to the forum!

That’s indeed annoying. Thanks for the bug report!

I just added a timeout: It should stop searching for auto-completion entries after 250 milliseconds. Furthermore, I increased the minimum word length to 2.

Would you please test it again?

Who wants to test the new-new version, just download imagej-legacy.jar and put it in the jars directory of your Fiji installation. Please remove the other image-legacy.jar in the same folder. Restart Fiji afterwards.

Thanks a lot!

Cheers,
Robert


#82

Thanks @haesleinhuepf,

The minimum word length of 2 characters works well (good idea), but the delay after typing ‘ru’ is still about 2 seconds, in my hands at least.

Best regards,
Bram


Issue in SciJava common
#83

Hey @bramvdbroek,

could you please try again with a freshly downloaded imagej-legacy.jar ?

I just introduced a maximum number for search results hoping the the UI responds faster now. In case you can confirm that it’s working better now, @ctrueden might consider putting the update into the currently running wave of updates…

Thanks again!

Cheers,
Robert