Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] Orion with Tern

Hi Angelo,

The idea of using Tern in Orion is very interesting!

I opened a bug for us to continue the discussion: https://bugs.eclipse.org/bugs/show_bug.cgi?id=432940

As for your three questions,

(1) The code looks fine to me, although I am not that familiar with setting up the editor in a webpage, so maybe someone with more knowledge could add more details.

(2) and (3)There currently is no API way to get a handle to the editor from that call-back, and there is no API to provide hovers (unless the doc is wrong): http://wiki.eclipse.org/Orion/Documentation/Developer_Guide/Plugging_into_the_editor

Michael Rennie

Inactive hide details for Angelo zerr ---16/04/2014 09:07:46 AM---Hi Orion team, I contact you, because I'm developping a glue Angelo zerr ---16/04/2014 09:07:46 AM---Hi Orion team, I contact you, because I'm developping a glue between Orion and

From: Angelo zerr <angelo.zerr@xxxxxxxxx>
To: orion-dev@xxxxxxxxxxx
Date: 16/04/2014 09:07 AM
Subject: [orion-dev] Orion with Tern
Sent by: orion-dev-bounces@xxxxxxxxxxx





Hi Orion team,

I contact you, because I'm developping a glue between Orion and Tern to benefit with powerful JS completion inside Orion editor. You can see project at https://github.com/angelozerr/tern.orion

Do you think you could interest with this project?

I develop this glue because I'm developping a wizard inside Eclipse IDE which generates orion editor with tern (see https://github.com/angelozerr/tern.java/wiki/Tern-Toolings). I have already integrated tern inside Eclipse IDE and generates Orion editor with tern will help to test and debug custom tern plugin.

When I have developped this glue between tern and orion, I had several problems that I would like  to share you : 

1) how to add custom completion with 5.0?

With 5.0, I had a problem to add my own completion. See code at https://github.com/angelozerr/tern.orion/blob/master/demos/tern-orion.html#L55

----------------------------------
if (contentAssist.providers) {
   // Orion < 5.0
   contentAssist.providers.push(ternProvider);
  } else {
   // Orion >= 5.0
   var providers = [];
   var infos = contentAssist._providerInfoArray
   if (infos) {
     for(var i=0; i<infos.length; i++) {
      providers.push(infos[i].provider);
     }      
   }
   providers.push(ternProvider);
   contentAssist.setProviders(providers);
}
----------------------------------

As you can see, code for Orion 5.0 is ugly. Have you some suggestion to clean this code?

2) how to get orion editor when completion is applied?

When completion is applied, it call my function

----------------------------------
 computeProposals : function(buffer, offset, context) {
----------------------------------

In this function, I need to add some listener in the editor, but i cannot retrieve it. Do you know how I can do that (for CodeMirror and Ace,it' spossible to retrieve the editor when completion is applied).

3) how to manage text hover?

I would like to create a Tern text hover when mouse move on JS editor (ex : display doc of teh functions in a tooltip). I think I must use AnnotationType (like TODO popup), but I don't know how I can add my custom AnnotationType.

Many thank's for your help.

Regards Angelo_______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/orion-dev

GIF image


Back to the top