This page is likely outdated. Visit the new documentation for updated content.

Status Owner Importance Complexity MD Version
Completed mkrueger Normal Medium 2.2

Overview

Code templates are a very useful feature to have in an IDE, but MonoDevelop only has very limited support. This page explores the various types of code template features that other IDEs and text editor have, so that we can evaluate what we should do in MonoDevelop.

Common Code Template Features

Placeholders are regions within the template that are replaced when the template is used:

There are various ways of activating templates:

Advanced templates:

Existing Implementations

ReSharper

Visual Assist

CodeRush

GEdit

TextMate

Visual Studio

Visual Studio supports snippets via 2 mechanisms: tab-activation, or a dedicated snippet command. There is a snippet manager, and snippets are stored within the user’s Documents directory. The snippet command launches a dedicated embedded mini-browser that can be used to find move advanced snippets within a directory structure; this means that not all snippets need have tab-activated shortcuts. Snippets may also be used to surround the current selection via a similar command.

The snippets are defined in an XML format, for which a full schema is available. The format supports placeholders, with mirroring and a few simple functions.

For C# it supports a limited number of functions that can be use to get the name of the enclosing class, generate switch statements for enum types, or remove unnecessary qualification on type names.

There is a Visual Basic snippet editor, and a more flexible open source snippet editor.

Note that people sometimes have large collections of VS snippets, so being able to import this format would be good. This would also allow importing third-party collections such as CodePlex.Snippets.

 There is some discussion at https://bugzilla.novell.com/show_bug.cgi?id=386494

Rework snippet dialog usability

Status Owner Importance Complexity MD Version
Pending Normal Medium

The snippet editing dialog is not easy to use. There are many examples in other IDEs and addins we could take inspiration from.

Snippet sharing webservice

Status Owner Importance Complexity MD Version
Pending Normal Medium

Web service and integration to MD for sharing code snippets. This would make it super-easy for users to start contributing useful content to MD.

Snippets provided by add-ins

Status Owner Importance Complexity MD Version
Pending Normal Medium

It should be possible for addins, e.g. language bindings or project types, to add default code snippets.