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 ?

 
Did your async experiments behave badly also for relatively small files ? We usually do not need to edit very large files with our language(s).

The main problem is a perceptible latency between typing and seeing the colors update. When you type, un-styled characters appear in the editor, then flick into the correct style an instant later. The editor remains usable, but it doesn't feel as quick & responsive as it should. (Also, I ran the parser on the client side; with network I/O in play the latency would get worse.)

If you decide to go down this route, the async styler API that I used still works in Orion 8.0. Here are the API docs (see the type == "highlighter" case).

The "experiment" I've been referring to is available as an Orion plugin here: https://orion-codemirror.googlecode.com/git/codeMirrorPlugin.html. The source is on Github.
Install it, and it will take over syntax highlighting for various file types (.js, etc) so you can see how it performs.

Here's a brief sketch of how the approach works, more notes here.
  • The plugin listens to text model deltas using an implementation of the orion.edit.model service, which it uses to maintain a shadow copy of the text buffer. (This is more efficient than grabbing the entire text buffer from the editor every time, although for very small files the difference will be minimal.)
  • Parser runs on the shadow buffer, calculates style info.
  • Style info is sent to the editor by having the orion.edit.highlighter service dispatch a styleReady event on itself.
  • The editor uses the styleReady event data to redraw the affected lines.
Regards
Mark

 

On Mon, Jan 19, 2015 at 12:16 PM, Remi Vankeisbelck <VANKEISB@xxxxxxxxxx> wrote:
Hi Mark,

Thanks for the prompt response.

Indeed, we also have problems with our current approach, especially for "large" (actually pretty small) files. Writing a robust editor with good UX ain't easy, I reckon. That's why we're investigating for a better foundation to build upon.

Good news for content assist / problem markers. If it's designed async, then, we should be able to plug into this.

Unfortunately, we cannot use a client-side tooling for syntax highlighting. Our stuff is actually more complex than a regular LALR grammar, we use a dedicated parser especially because of this. We may be able to extract parts of our "grammar" as keywords or stuff like this, but we definitely need our full-blown parser if we want to be feature-equivalent in terms of highlight.

Did your async experiments behave badly also for relatively small files ? We usually do not need to edit very large files with our language(s).

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

_______________________________________________
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


Back to the top