Statement Completion

Statement completion is very similar to the IntelliSense feature of Visual Studio. With Statement Completion, Template Editor prompts you with identifier names as you type.

You can bring up the completion lists at any time within a code block by pressing 'Ctrl+Space'.

The dropdown list of identifiers appear as soon as you type the dot after an object name. To select a identifier, click it with the mouse or select it with the arrow keys or by typing enough letters to uniquely identity it and then type a space or other separator character to auto-complete.

Statement completion depends on reflection to gather the information that it presents. This means that your template must compile successfully for statement completion to work on types defined in the template. Types defined in an external assembly will show up in the statement completion lists whether the current template compiles or not.

Statement completion is also available in C# and Visual Basic code behind files. You can control which assembly references should be imported for a code behinds statement completion through the References Tool Window.

You can open this tool window through the Tools -> Manage References menu item.

Code Behind statement completion is only available in the standalone Template Editor.

Quick Info

Automated quick info tips show whenever the mouse is hovered over words such as identifiers. The quick info tips display detailed information about the related type, member, variable, etc. Similar to parameter info tips, all information is presented using rich text formatting.

Parameter Info

Automated parameter info tips show whenever typing an invocation (E.G., a method call). The tips show detailed information about the invoked member along with details about the current argument being typed. In the case where the invoked member has multiple overloads, arrows show on the popup and allow toggling between all the available overloads.

As with quick info, parameter info can handle rich-formatted content display using HTML-like markup tags. Colors and font weights or styles can be used to bring attention to portions of the info tip. The screenshot above shows the font weights bringing attention out to the current parameter seed.

Multiple signature options can be displayed in a single parameter info tip. In those scenarios, arrows automatically appear that can be clicked. Alternatively the end user can use the up/down arrow keys to switch between options.

Anonymous Types

In previous versions of CodeSmith Generator there was no support for anonymous types or extension methods. The sample below will show off an example of Anonymous Type support.

In this screenshot, we have implicitly declared a variable anonymousType as an anonymous type.  The anonymous type's properties are initialized using a variable (numbers) as well as a string constant ("Blake").  Hovering over the anonymousType variable will display quick info, which reveals anonymousType as an anonymous type. 

We can bring up the statement completion list by typing period after our variable. This will display a list that contains all of the members of the variable anonymousTypeThe two properties we declared (Numbers and Name) in the anonymous type's creation expression appear in the list.  You can see it has correctly assigned property names and their types.

LINQ

In previous versions of CodeSmith Generator there was no statement completion support for LINQ query expressions. The sample below will show off statement completion for LINQ query expressions.

First, let's start typing a new LINQ query expression:

The SourceTables property shows up as a TableSchemaCollection.  Now we'll start a where clause:

The table range variable is of type TableSchemaAfter typing a period to see the table variable's members, we see fields like Columns and Database

Typing a period to see the Columns field's members shows how all the Enumerable extension methods get pulled in.

Now we add an orderby clause and follow it up with a select clause to end the expression.

Finally, after the first statement, we do a Ctrl+Space to bring up the statement completion and the results variable in the list shows the result type from the query expression, which is IEnumerable<TableSchema>.