Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] Get text style of selected char

Hey Andrew,

AFAIK there is no API on the editor for doing this. Styles are write only.

Depending on the text styler that generated the style, there is sometimes an auxiliary data structure that you can dig into to find out style info. For example, the default textStyler.js keeps a list of begin/end offsets of block comments. And the ModeApplier (in mirror.js) that we use to apply CodeMirror highlight modes stores all the style ranges for each line (ouch).
You can dig around in those if you have access to the styler... but it is not an API.

On Thu, Jan 31, 2013 at 4:17 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
> Hi Orion team,
>
> I'm looking to find the text style of a given offset in the orion
> editor (eg- is this offset inside of a comment, a string, a keyword,
> etc?).  Is there some API to do this already, or do I have to dig wade
> through the html elements to find it? Or is the best way to create my
> own scanner?
>
> More specifically, I don't really need to know about the html, I just
> need to know if the current caret position is inside a comment,
> string, or not.
>
> Thanks for the help on this.
>
> Andrew
> _______________________________________________
> orion-dev mailing list
> orion-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/orion-dev

On Thu, Jan 31, 2013 at 4:17 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
> Hi Orion team,
>
> I'm looking to find the text style of a given offset in the orion
> editor (eg- is this offset inside of a comment, a string, a keyword,
> etc?).  Is there some API to do this already, or do I have to dig wade
> through the html elements to find it? Or is the best way to create my
> own scanner?
>
> More specifically, I don't really need to know about the html, I just
> need to know if the current caret position is inside a comment,
> string, or not.
>
> Thanks for the help on this.
>
> Andrew
> _______________________________________________
> orion-dev mailing list
> orion-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/orion-dev


Back to the top