ReSharper Web Help

Complete Statement, introduced in ReSharper 4.0, is a feature that inserts necessary syntax elements (braces, semicolons etc.) and gets you in position to start the next statement.

To invoke complete statement
  1. Place the caret at an applicable position (see scenarios below for detials).
  2. On the main menu, choose ReSharper | Edit | Complete Statement or press Ctrl+Shift+Enter.

Complete Statement (also known as Smart Enter) is helpful in numerous scenarios, including auto-closing parentheses, adding semicolons, completing if, while and for statements, and so on.

For example, whenever you declare a new method, Complete Statement comes handy after specifying method parameters:

At this point, to start writing the method body, you normally have to:

  • Insert a missing parenthesis.
  • Press Enter.
  • Insert an opening brace.
  • Press Enter once again.
With Complete Statement, instead of this tricky procedure, you only have to press Ctrl+Shift+Enter, and ReSharper will automatically insert a closing parenthesis, as well as both braces, and put the caret right where you can proceed with writing the method body:

In similar ways, Complete Statement is known to work with the following language constructs:

  • Type members: class, interface, struct, enum, delegate, field, event, and method declarations.
  • Statements: if, while, do, switch, using, lock, continue, break, and return statements; case and default clauses; conversion of single-line statements to block statements.
  • Expressions: invocation, element access, string/char literals; object, member, and collection item initializers; expressions that create anonymous types and implicitly typed arrays.

Below are a number of specific examples of the assistance that Complete Statement provides in specific contexts.

Use case Before Complete Statement After Complete Statement

Class declaration

Delegate declaration

Method declaration

Nested method invocation

if statement

case clause

Conversion of a single-line statement into block (case A)

Conversion of a single-line statement into block (case B)

Element access expression

See Also