Best way to handle a remote call from a plugin

I'm pretty new to IntelliJ plugin development so I might be far off here (apologies in advance). I have a plugin that is correctly parsing lines and making gutter marks correctly. What I would like to do is kick off a thread to be able to make an api call to my server and when that gets back update the PSIElement that I made the call for with some information. I think that I can put that into the user data for the psielement, but the problem is because it is threaded it looks like I missed my chance to make an update.

What I would like to know is, am I doing this correct? and if so, is there a way to tell my plugin to "update" that gutter and annotation?

Thanks in advance

0
4 comments
Official comment

Have you tried implementing ExternalAnnotator extension?

No I haven't, as I said I am totally new to this :-) literally learning as I go and 3 days into the project. I will take a look at that though.  Thanks for a starting point.

0

So I started having a look at the ExternalAnnotator which I think you are right, that's what I need. But the documentation seems weak on it for someone that isn't familiar with the plugin flow. 

I see that it is calling my collectInformation override and my doAnnotate but it never seems to call apply. What am I missing? Is there an example of this thing somewhere that we can go by or a tutorial?

0

Ok as an update, I was able to figure this out. Each of the overrides has to return a non-null object or the subsequent functions appear to not get called, which makes sense, if there isn't anything to work on no reason to keep going.

Thanks for the help on this.

0

Please sign in to leave a comment.