Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] Mark occurrences in the editor

Andrew:
I have the similar situations as you do in several places. Basically I need to highlight occurrence of keywords, char level difference ,etc, in the editor or compare widget.
Could you open a bug ? I will follow up to see how much the code will be shared.

Thanks,
Libing



Inactive hide details for Andrew Eisenberg ---03/05/2012 11:08:01 PM---I saw the orion.edit.highlighter and orion.edit.validatoAndrew Eisenberg ---03/05/2012 11:08:01 PM---I saw the orion.edit.highlighter and orion.edit.validator services, but realized that they aren't su

From: Andrew Eisenberg <andrew@xxxxxxxxxxxx>
To: Orion developer discussions <orion-dev@xxxxxxxxxxx>
Date: 03/05/2012 11:08 PM
Subject: Re: [orion-dev] Mark occurrences in the editor
Sent by: orion-dev-bounces@xxxxxxxxxxx





I saw the orion.edit.highlighter and orion.edit.validator services,
but realized that they aren't sufficient for what I need.

>From my perspective as a plugin developer, I'd rather not have to
worry about exactly how the regions are styled. I just want to tell
the editor which regions should be marked and the editor figures out
what it looks like (with perhaps an entry on the editor preferences
page).

I am currently using the orion.edit.model service and hooking into the
ModelChanging event to grab the current contents of the editor and the
Selection event to feed mark occurrences when the selection changes.

I am just missing a way to tell the editor to (temporarily) mark
specific regions of the editor.

Perhaps a new mark occurrences service is not really needed. Instead
we can augment the Selection event in a way that would be sufficient.

Here's what it would need:

1. the Selection event provides a way to access the full text of the buffer
2. the Selection event provides an output parameter that contains a
list of source locations to highlight (perhaps this list comes
pre-populated with the previously highlighted source locations from
this plugin).

Does something like this work? Perhaps we're better off moving this
to bugzilla.

On Mon, Mar 5, 2012 at 5:31 PM, Mark Macdonald <mamacdon@xxxxxxxxx> wrote:
> This would be awesome. I miss "mark occurrences" too.
>
> There is a way to provide styling for the editor from a plugin -- the
> orion.edit.highlighter service [1], which is what powers the CodeMirror
> plugin. But this API won't solve your problem in its current state, for a
> few reasons:
>
> It can't combine contributions from multiple plugins.
> You can't write a plugin that just styles identifiers and expect someone
> else to provide the regular language syntax highlighting. You have to
> provide everything, or nothing.
> The annotation treatment is limited.
> You can supply styled regions to be styled as "errors" (squiggly line under
> the text) in the editor. But you can't specify annotations to appear in the
> overview ruler, which is important for marking occurrences.
>
> To do a decent job here, we'll have to pull out a more generic way of
> supplying styling. Or make "mark occurrences" into a first-class extension
> point that plugins can implement, but leave the presentation up to the Orion
> side. Maybe both of these.
>
> This extension is really a first crack, powerful enough to support the
> CodeMirror plugin, but no more. I'd be happy to evolve it into something
> more useful in 0.5.
>
> Mark
>
> [1]
>
http://wiki.eclipse.org/Orion/Documentation/Developer_Guide/Plugging_into_the_editor#orion.edit.highlighter
>
> On Mon, Mar 5, 2012 at 7:33 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx>
> wrote:
>>
>> One thing that I have been missing in the Orion editor is mark
>> occurrences.  When I select an identifier, I'd like to have all
>> occurrences highlighted in some way (just like in Eclipse's Java
>> editor).  So, I started implementing a plugin for this.  As a first
>> step, mark occurrences will just use a regular _expression_ to find
>> occurrences (and this makes it possible to work across languages and
>> content types, but will not have any smarts).
>>
>> I got far enough such that I have a plugin that spits occurrence
>> information to the console on all selection changes.  However, I am
>> stuck now in that I don't see any infrastructure to add styling
>> information to a region of text.  Is this currently possible?
>>
>> thanks,
>> Andrew
>> _______________________________________________
>> 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
>
_______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/orion-dev


GIF image


Back to the top