Skip to main content

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

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

Back to the top