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. 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:
Complete Statement: method declaration
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:
Complete Statement: method declaration

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

Complete Statement: class declaration

Complete Statement: class declaration

Delegate declaration

Complete Statement: delegate declaration

Complete Statement: delegate declaration

Method declaration

Complete Statement: method declaration

Complete Statement: method declaration

Nested method invocation

Complete Statement: method invocation

Complete Statement: method invocation

if statement

Complete Statement: if statement

Complete Statement: if statement

case clause

Complete Statement: case clause

Complete Statement: case clause

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

Complete Statement: single line to block

Complete Statement: single line to block

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

Complete Statement: single line to block

Complete Statement: single line to block

Element access expression

Complete Statement: access to a collection item

Complete Statement: access to a collection item

See Also

Procedures