Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] Orion editor with server-side parser ?

Hi Mark, folks,

Ok, we're getting there ! I have reused and adapted some of your code and I have async, server-backed parsing and highlighting ! quite cool...

I have borrowed your "shadow model" (I could not figure out how to access the text buffer otherwise, plus the helper methods in there helped me to do the rest) : I'm observing the model changes, and connecting to existing HTTP parsing services that return "styles" as JSON for a given text. I only had to translate this into Orion-enabled data structures and fire "orion.edit.highlighter.styleReady" events with the appropriate lines, offsets etc. It's only a POC but so far it worked pretty well !

I only have one problem left : our styles are CSS classes that are not built in Orion. Our parser service returns structures like :

{
  start: 12,
  end: 20,
  name: "myStyle"
}

So, in my current code, the DOM in the editor ends up styled with a "myStyle" class, which doesn't exist in Orion. By chance, some of them exist (like 'variable' or 'string' which are defined in edit.css), which added some colors to my text :P



Is there a way for my plugin to contribute CSS stylesheets ?

Cheers

Rémi



From: Mark Macdonald <mamacdon@xxxxxxxxx>
To: Orion developer discussions <orion-dev@xxxxxxxxxxx>
Date: 19/01/2015 17:58
Subject: Re: [orion-dev] Orion editor with server-side parser ?
Sent by: orion-dev-bounces@xxxxxxxxxxx





Hi Rémi,

Error markers and completion proposals are provided by implementing an Orion service. Services are inherently asynchronous, so yes -- you can keep the "real" work on your remote server, and just call it from the client.

Syntax highlighting is another matter. We experimented with asynchronous highlighting in the past: a service could asynchronously feed highlighting info into the editor, based on text changes. This allowed you to use arbitrary parsing logic, but the user experience was poor.

Instead, I would recommend trying the current
declarative grammar-based approach. It allows the editor to update the syntax highlighting in realtime with no delay. While the grammar is more restrictive than a full-blown parser, we've found that a reasonable subset of most languages can be parsed using regexps and simple begin..end nesting blocks.

Regards,
Mark



On Mon, Jan 19, 2015 at 8:45 AM, Remi Vankeisbelck <VANKEISB@xxxxxxxxxx> wrote:
Hi,

We'd like to use Orion in order to support a custom language of ours. We already have a parser, completion engine etc. for this language. In fact, we even already have a JS editor, but it's based on content-editable div and has limitations. Therefore, we are looking at alternative "web-based text editors" that we could plug our services into, and let it handle all the dirty GUI business... Orion looks quite nice, and we're IBM as well, so we'd like to try it first.


Our "problem" is that our parser etc is written in Java, and runs in a server back-end. We have a protocol that allows our client-side editor to interact with the server : basically parse the text and send back highlighting infos, error markers, or completion proposals.


Does Orion support this kind of async, server-managed custom languages ?


I've googled a bit and seen in the doc that a grammar can be passed, or that the proposals could be customized. Can all this be done asynchronously, by communicating with a server ?


Thanks for any info.


Cheers


Rémi
Sauf indication contraire ci-dessus:/ Unless stated otherwise above:
Compagnie IBM France
Siège Social : 17 avenue de l'Europe, 92275 Bois-Colombes Cedex
RCS Nanterre 552 118 465
Forme Sociale : S.A.S.
Capital Social : 657.364.587 €
SIREN/SIRET : 552 118 465 03644 - Code NAF 6202A

_______________________________________________
orion-dev mailing list

orion-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

https://dev.eclipse.org/mailman/listinfo/orion-dev
_______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/orion-dev


Sauf indication contraire ci-dessus:/ Unless stated otherwise above:
Compagnie IBM France
Siège Social : 17 avenue de l'Europe, 92275 Bois-Colombes Cedex
RCS Nanterre 552 118 465
Forme Sociale : S.A.S.
Capital Social : 657.364.587 €
SIREN/SIRET : 552 118 465 03644 - Code NAF 6202A

Back to the top