[MonoDevelop] Who ate my code templates ?

Mike Krüger mkrueger at novell.com
Tue Mar 24 01:24:18 EDT 2009


Hi

> On Mon, Mar 23, 2009 at 1:42 AM, Mike Krüger <mkrueger at novell.com> wrote:
> <snip>
> > Context sensitive templates
> >
> > Note that templates can be context sensitive, therefore not all
> > templates are available anywhere.
> 
> Is it possible for extensions to add template contexts?
> 

Currently no, but it's not a 'very big' change. Currently template
contexts are an enum. I would move it to the extension object and make a
"string GetCurrentContext ()" method. The extension objects should be
able to be provided by extensions.

> BTW, VS templates have a feature where templates can add references
> and imports. I'm not sure which is the best approach -- automatic
> import insertion or automatic namespace shortening.
> 

How did they do this ? With a function ? I like the automatic namespace
shortening because it's not changing parts of the file that may not be
visible. But I think adding a function "Import ("name")" would do this
job.

> Is it possible to add templates in an extension?

It's a bit tricky, but I think yes :). But it's not really designed for
this. It would be easier if I make some functions public. 

> It seems pretty usable so far! I've only run into a couple of issues
> -- the undo stack seems to get confused by templates, and it's not
> possible to use "enter" to end the template when a completion dropdown
> is present. Maybe including the end position in the tabbable regions
> would help for this, and typing there would end the template.
> 

Yes the old problem with the enter key. The enter key is used for ending
the template and for selecting something from the dropdown. When you tab
through the regions the caret is at the end. 

> > The functions that are available through the extension object need to be
> > extended. I think we should let drive this by the requests of the
> > template writers.
> 
> This would also be useful to be able to implement in extensions.
> 

Thats what the name "extension object" stands for :). I don't think that
all functions that can be provided make sense in all languages. The
object may be able to handle more language specific stuff (like the
context - see above).

Regards
Mike



More information about the Monodevelop-list mailing list