Closed Squareys closed 9 years ago
I will do a quick rebase onto master to make sure, then this can be merged, too.
Ah, much better :) You may have a look at this, it's ready from my side.
@Squareys this is really cool stuff.
I think how the API is actually being used needs a bit of tweaking though:
initialize
on the service. It's called at context startup.LanguageSupportService
should just be a (non-static) @Parameter
like the other servicesLanguageSupport
instance. When setLanguage
is called, just check the current language, use that information to get the LanguageSupport
from the LanguageSupportService
, uninstall it, then install the new service like you were.As a side note - is it possible to install the language support on the tab instead of the pane..? Does switching tabs cause setLanguage
to be called? (just can't remember offhand) If not sure it matters.. just wondering.
@hinerm:
You don't need to call initialize on the service. It's called at context startup.
The Service is not added to the context. (Or is it... automatically?)
The LanguageSupportService should just be a (non-static) @Parameter
Well, see above.
You shouldn't need to cache the LanguageSupport instance.
Alright, your suggestion makes sense, will do so tomorrow (German time, therefore in 12-14 hrs)
is it possible to install the language support on the tab instead of the pane
You mean install it on the pane but from the outside? Theoretically yes.
Does switching tabs cause setLanguage to be called?
I do not believe so. It should at least only be called, when:
The Service is not added to the context. (Or is it... automatically?)
Yes, it is. You wrote @Plugin(type = Service.class)
so when a full-blown Context
is created during ImageJ startup, it will instantiate and initialize a LanguageSupportService
which is part of that context. You should never call new
on it directly, or initialize
for that matter.
Yes, it is.
Awesome! I will change the code respectively.
Best to have a single version property for the com.fifesoft stuff that is set to 2.5.7 and reuse it in all relevant deps.
Alright, will do.
@ctrueden Alright, I think I addressed all the issues mentioned above.
Well, for some reason, AutoCompletion is not working anymore. I will need to investigate that first, before this can be merged.
Alright, done! This may be merged.
Hi @Squareys . This is looking really good.
The main problem I'm finding is that it seems like an uncaught exception is thrown by code completion parser when there's a compilation error. It's redundant because the error is already displayed in the editor.. so we don't want the stack trace to pop up in the console window. Is there a way to suppress these IOExceptions
?
You can see this easily by dropping this into Fiji and opening any Java template. It currently is inserting .java
into the class names which causes compilation errors. (I'm looking into fixing the .java error)
OK, fixed the .java
class name: https://github.com/imagej/imagej-ui-swing/commit/5ba7bf8b3b406355ac153413fd619de8830b7e97
bleh.. so there is a catch block guarding these exceptions, it's being caught earlier here and printed.
Alright @Squareys ... I just commented out the Java language plugin for now, until the stacktrace printing is resolved upstream. Everything on your end looked good so I merged. Thanks again for your work on this!
@hinerm You're welcome, thank you, too! :)
Hello everybody!
This adds codecompletion/-assist to the script editor using fifesoft
Autocomplete
andRSTALanguageSupport
. This branch is based on #51, which is needed to be merged first.Support for Autocompletion can be extend by extending the
LanguageSupportPlugin
. The repositoryRSTALanguageSupport
also implements outline trees for java for example, which one could take into consideration for the script editor. (Not implemented in this PR!)For this pullrequest, code assist is implemented for Java and JavaScript.
Have a nice day, Squareys.