Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] orion-dev Digest, Vol 40, Issue 6

Hi Mark,

I  have used your new API. Cide is more cleaner. See https://github.com/angelozerr/tern.orion/blob/master/lib/tern-orion.js#L168

I have pluug it too charTriggers, but I had to call contentAssist.setAutoTriggerEnabled(true); (see https://github.com/angelozerr/tern.orion/blob/master/lib/tern-orion.js#L176)

It work's only for Orion 6.0.I don't know why charTriggers doesnt work for 0.5?

I have noticed too that 6.0 remove jsTemplateContentAssistProvider. Why? I think it's really shame to loose this feature.

Regards Angelo


2014-04-24 21:44 GMT+02:00 Angelo zerr <angelo.zerr@xxxxxxxxx>:
Hi Mark,

Many thank's for your reply.


Hi Angelo,

Re: (1) I agree this code is awkward. In Orion master I've cleaned up the
API a bit, so you can do something like this now:

var providers = contentAssist.getProviders();
providers.push(ternContentAssistProvider);
contentAssist.setProviders(providers);

Basically getProviders() returns the _providerInfoArray that used to be
internal. You can also take advantage of the 5.0 support for automatically
invokiung a content assist provider when certain characters are typed by
wrapping your provider in an object with id and charTriggers properties, eg:

providers.push({
    id: "tern",
    charTriggers: /[.]/,   // invoke tern provider automatically when dot
is typed
    provider: ternContentAssistProvider
});

Cool! I will try it.

Just one question. It seems that _providerInfoArray comes from 5.0. Is it released?
I would like support the whole version of Orion,that's why I tell me if I must keep my code with _providerInfoArray

I think it should better to continue our discussion in https://bugs.eclipse.org/bugs/show_bug.cgi?id=432940

I have posted my question too about hover and hyperlink.

Many thank's for your help.

Regards Angelo
 




On Wed, Apr 16, 2014 at 11:25 AM, Michael Rennie
<Michael_Rennie@xxxxxxxxxx>wrote:

> 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
>
> [image: 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*<http://ternjs.net/> to
> benefit with powerful JS completion inside Orion editor. You can see
> project at *https://github.com/angelozerr/tern.orion*<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*<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*<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
>
>
> _______________________________________________
> orion-dev mailing list
> orion-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/orion-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/orion-dev/attachments/20140424/c1371884/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://dev.eclipse.org/mailman/private/orion-dev/attachments/20140424/c1371884/attachment.gif>

------------------------------

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


End of orion-dev Digest, Vol 40, Issue 6
****************************************



Back to the top