[MonoDevelop] Using the managed source editor outside of MonoDevelop

Michael Hutchinson m.j.hutchinson at gmail.com
Tue Sep 30 12:40:06 EDT 2008


On Tue, Sep 30, 2008 at 8:18 AM, Andy Selvig <ajselvig at gmail.com> wrote:
>> It will syntax highlight text when you tell it the mimetype of the
>> document. There are built-in highlighting schemes for C# and Boo
>> (among others), and APIs to add your own schemes.
>
> Okay, I guessed I missed that when browsing the code. Is mimetype a
> property of Document? (I don't have the code in front of me)

Not sure, but it should be pretty straightforward.

>> Beyond that, things get more complicated. There's a simple property
>> somewhere for telling it to "auto-indent" (i.e. maintain the current
>> indentation level), but "smart" indentation requires a
>> language-specific indenter. We have ones for C# and C, but they're
>> elsewhere in MD.
>
> Yeah, "smart" indentation is what I was thinking of.
>
>> For folding, you need to feed the TextEditor a list
>> of fold regions so it knows where to fold -- likewise, we get this
>> from parsers elsewhere in MD. I can provide more info on where/how if
>> you need it, but if you're implementing this much, you might as well
>> just use all of MD :-)
>
> That's one heck of an upstream dependency just to get a text editor :-)

Well, here's the thing: smart indentation and folding require a
relatively complex language-specific parser to do accurately, so we
put them in the language bindings. The text editor will do the actual
/folding/, you just have to feed it the list of fold points.

>> The MonoDevelop.SourceEditor2 assembly is the only MD assembly that
>> depends on the TextEditor. It basically plugs it into MD's abstract
>> text editor interfaces, and completion & smart indenters etc sit on
>> top of these interfaces.
>>
>> Can you tell me what you're writing? It would help in understanding
>> the functionality you need.
>
> I'd like to have an integrated text editor that will allow for
> scripting extensibility in my application (mainly Boo, but ideally
> Python or Ruby also). In Windows, I can use the ScintillaNET
> (http://www.codeplex.com/ScintillaNET) bindings that give me an easy
> to use editor with the following features:
>  - syntax highlighting
>  - code folding
>  - code completion API
>
> I was hoping to be able to use the MD component as it seems (correct
> me if I'm wrong) that GtkSourceView lacks the last two. And, as far as
> I know, there is no way to use Scintilla with Gtk# without writing my
> own bindings.

Well, don't give up yet :-) The MD code completion window is
relatively easy to isolate, as are the smart indenters.


-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list