-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autocomplete methods and functions #220
Conversation
* underscores allowed in function names * upper/lower case enabled * put macro-dependent stuff first * sorted it alphabetically
Thanks, @haesleinhuepf. I'd like to dig in to the Travis CI failure. The issue is probably with explicit ImageJ1 class references. I am considering how best to deal with it. We could whitelist the class |
the Interpreters additional methods are now listed in auto-complete as well.
fixed html to be parsed correctly https://imagej.nih.gov/ij/developer/macro/functions.html
ed5d5eb
to
da5ffb5
Compare
I force-pushed a change that I hope will fix it. |
Here is the patch that I squashed in: diff --git src/main/java/net/imagej/legacy/IJ1Helper.java src/main/java/net/imagej/legacy/IJ1Helper.java
index 41ee03b..4919c4e 100644
--- src/main/java/net/imagej/legacy/IJ1Helper.java
+++ src/main/java/net/imagej/legacy/IJ1Helper.java
@@ -598,6 +598,11 @@ public class IJ1Helper extends AbstractContextual {
return Interpreter.getInstance();
}
+ /** Gets the result of {@link Interpreter#getAdditionalFunctions()}. */
+ public static String getAdditionalMacroFunctions() {
+ return Interpreter.getAdditionalFunctions();
+ }
+
/**
* Gets the value of the specified variable, from the given macro
* {@link Interpreter}.
diff --git src/main/java/net/imagej/legacy/plugin/MacroAutoCompletionProvider.java src/main/java/net/imagej/legacy/plugin/MacroAutoCompletionProvider.java
index 760d3c5..4ee4ff2 100644
--- src/main/java/net/imagej/legacy/plugin/MacroAutoCompletionProvider.java
+++ src/main/java/net/imagej/legacy/plugin/MacroAutoCompletionProvider.java
@@ -42,14 +42,14 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import ij.macro.Interpreter;
+import net.imagej.legacy.IJ1Helper;
+
import org.fife.ui.autocomplete.BasicCompletion;
import org.fife.ui.autocomplete.Completion;
import org.fife.ui.autocomplete.DefaultCompletionProvider;
import org.fife.ui.autocomplete.SortByRelevanceComparator;
import org.fife.ui.rtextarea.RTextArea;
import org.fife.ui.rtextarea.ToolTipSupplier;
-
import org.scijava.module.ModuleInfo;
import org.scijava.module.ModuleService;
@@ -324,7 +324,7 @@ class MacroAutoCompletionProvider extends DefaultCompletionProvider implements
e.printStackTrace();
return;
}
- text = text + "\n" + Interpreter.getAdditionalFunctions();
+ text = text + "\n" + IJ1Helper.getAdditionalMacroFunctions();
int linecount = 0;
String[] textArray = text.split("\n"); |
The CI passed, so I merged it. |
Great, thanks @ctrueden ! 😍 |
Solves issue imagej#232 which affected functions pulled from the doc html files. The behaviour seems to have been inadvertedly introduced in merge imagej#220.
Solves issue imagej#232 which affected functions pulled from the doc html files. The behaviour seems to have been inadvertedly introduced in merge imagej#220.
Hey all, hey @imagejan, hey @ctrueden,
I'm testing the autocompletion of variable names and functions+comments for some time. Also users on the forum seemed to be pretty happy about it.
https://forum.image.sc/t/auto-code-completion-for-ij-macro/11642/95
Do you see any issues? Shall we merge it? Thanks!
Cheers,
Robert