JetBrains Rider 2024.2 Help

Predefined Live Templates for Razor

This topic lists all predefined live templates for Razor in JetBrains Rider 2024.2. For more information about live templates, refer to Create source code using live templates.

Template

Details

ctx

Current file context

Scope Everywhere

Body

$CTX$

Parameters

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

nguid

Insert new GUID

Scope Everywhere

Body

$GUID$

Parameters

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

<script

Create script tag

Scope HTML and similar tags

Body

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

Parameters

  • attributeValue - Suggests an attribute value for the current HTML tag attribute

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

t

Create tag

Scope HTML tags, Razor tags

Body

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

Parameters

  • TAG - Suggests a tag name used in the current document

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

tc

Create closed tag

Scope HTML tags, Razor tags

Body

<$TAG$ $END$/>

Parameters

  • TAG - Suggests a tag name used in the current document

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

a

Create tag attribute

Scope HTML and similar attributes

Body

$ATTR$="$END$"

Parameters

  • ATTR - Suggests an attribute name used in the same tags in the current document

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

@inherits

Razor inherits directive

Scope Razor CSharp tags

Body

@inherits $TYPENAME$ $END$

Parameters

  • TYPENAME - Guesses the type expected at this point

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

@model

Razor model directive

Scope Razor CSharp tags

Body

@model $TYPENAME$ $END$

Parameters

  • TYPENAME - Shows type completion list at the point where the variable is evaluated

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

@section

Razor section

Scope Razor CSharp tags

Body

@section $section$ { $END$ }

Parameters

  • section - Shows basic code completion list at the point where the variable is evaluated

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

Last modified: 18 August 2024