ReSharper 2021.1 Help

Predefined Live Templates for Razor

ReSharper | Templates Explorer | Live Templates | Razor

This topic lists all predefined live templates for Razor in ReSharper 2021.1. For more information about live templates, see Create Source Code Using Live Templates

TemplateDetails
ctx

Current file context

Scope everywhere

Body

$CTX$

Parameters

  • CTX- Provides list of items describing current context. This includes file name, containing type name, namespace name, etc.(context)

nguid

Insert new GUID

Scope everywhere

Body

$GUID$

Parameters

  • GUID- Generates new Globally Unique Identifier (GUID)(guid)

<script

Create script tag

Scope HTML and similar tags

Body

<script type="$attributeValue$">$END$</script>

Parameters

  • attributeValue- Suggest attribute value for current html tag attribute(suggestAttributeValue)

  • END- The caret position after the template is applied.

t

Create tag

Scope HTML tags, Razor tags

Body

<$TAG$>$END$</$TAG$>

Parameters

  • TAG- Suggest tag name used in current document(suggestTagName)

  • END- The caret position after the template is applied.

tc

Create closed tag

Scope HTML tags, Razor tags

Body

<$TAG$ $END$/>

Parameters

  • TAG- Suggest tag name used in current document(suggestTagName)

  • END- The caret position after the template is applied.

a

Create tag attribute

Scope HTML and similar attributes

Body

$ATTR$="$END$"

Parameters

  • ATTR- Suggests attribute name used in the same tags in current document(suggestAttributeNameByTag)

  • END- The caret position after the template is applied.

@inherits

Razor inherits directive

Scope Razor CSharp tags

Body

@inherits $TYPENAME$ $END$

Parameters

  • TYPENAME- Guess type expected at this point(guessExpectedType)

  • END- The caret position after the template is applied.

@model

Razor model directive

Scope Razor CSharp tags

Body

@model $TYPENAME$ $END$

Parameters

  • TYPENAME- Show type completion list at the point where the variable is evaluated(completeType)

  • END- The caret position after the template is applied.

@section

Razor section

Scope Razor CSharp tags

Body

@section $section$ { $END$ }

Parameters

  • section- Show basic code completion list at the point where the variable is evaluated(complete)

  • END- The caret position after the template is applied.

Last modified: 12 July 2021