Skip to main content

Code

  • 8 minutes to read

This article describes all Context Providers in the Editor | Code group. Refer to the Context Providers article for details on how to access Context Providers from the other groups.

A … InAb InAn … InE InF … InM InN … InS InT … Z
AppearsToDeclare InAnyComment InField InNamespace InType
AtRegionEnd InAttribute InFieldInitializer InObjectInitializer InTypeDeclaration
AtRegionStart InBreakableLoop InIdentifier InParameter InValueType
CharLeftIsWhitespace InCase InInterface InParameterBlock InXmlDocComment
DeclaresLocal InClass InInterpolatedString InParens InheritsFrom
DeclaresMember InCodeBlock InIterator InPreprocessorDirective InHTMLScriptTag
HasConstructors InConstructor InLambdaInsideMethodCall InProperty IsNamespaceReferenced
HasFields InDelegateDeclaration InLiteral InPropertyAccessor LeftTextMatchesRegEx
HasLeadingUnseparatedParameter InDelegateParameters InLocal InRefType MethodIsDeclared
HasMethods InDestructor InMember InStaticClass PropertyIsDeclared
HasProperties InEnum InMemberDeclaration InStaticMember RightTextMatchesRegEx
HasTrailingUnseparatedParameter InEvent InMethod InStaticType SelectionExpression
IdentifierIsDeclared InEventAccessor InMethodBlock InString StatementCanBePlaced
InAbstractMember InExpression InModule InStruct
InAbstractType InExpressionBody InMvcController InSwitch


[AppearsToDeclare(name)]

Position Parameter Description
1 Name The identifier name.

Satisfied when the caret is on a local variable, field, or parameter that appears to be declared.

Supported Languages: C#, Visual Basic


[AtRegionEnd]

Satisfied when the caret is located right after the #endregion keyword.

Supported Languages: C#, Visual Basic


[AtRegionStart]

Satisfied when the caret is located left before the #region keyword.

Supported Languages: C#, Visual Basic


[CharLeftIsWhitespace]

Satisfied if the character to the left of the caret is whitespace (e.g., Space, Tab, or line break characters).

Supported Languages: All


[DeclaresLocal(localName)]

Position Parameter Description
1 Local Name The local variable identifier.

Satisfied if the specified identifier is declared as a local variable or a parameter in the current property or method.

Supported Languages: C#, Visual Basic


[DeclaresMember(memberName)]

Position Parameter
1 Member Name

Satisfied if the specified identifier is declared as a member of the current type.

Supported Languages: C#, Visual Basic


[HasConstructors]

Satisfied when the current type has one or more constructors.

Supported Languages: C#, Visual Basic


[HasFields]

Satisfied when the current type has fields declared.

Supported Languages: C#, Visual Basic


[HasLeadingUnseparatedParameter]

Satisfied when the caret is positioned right after a parameter.

Supported Languages: C#, Visual Basic


[HasMethods]

Satisfied when the current type has methods declared (except constructors).

Supported Languages: C#, Visual Basic


[HasProperties]

Satisfied when the current type has properties declared.

Supported Languages: C#, Visual Basic


[HasTrailingUnseparatedParameter]

Satisfied when the caret is positioned left before a parameter.

Supported Languages: C#, Visual Basic


[IdentifierIsDeclared(name)]

Position Parameter Description
1 Name The identifier name.

Satisfied if the specified identifier is declared.

Supported Languages: C#, Visual Basic


[InAbstractMember]

Satisfied when the caret is inside an abstract member (method, property, event, etc.).

Supported Languages: C#, Visual Basic


[InAbstractType]

Satisfied when the caret is inside an abstract type.

Supported Languages: C#, Visual Basic


[InAnyComment]

Satisfied when the caret is inside a comment or XML doc comment.

Supported Languages: C#, Visual Basic


[InAttribute([name])]

Position Parameter Description
1 Name (optional) The member identifier.

Satisfied when the caret is located on an attribute.

Supported Languages: C#, Visual Basic


[InBreakableLoop]

Satisfied when the caret is located within a breakable loop body.

Supported Languages: C#, Visual Basic


[InCase]

Satisfied when the caret is inside a case statement.

Supported Languages: C#, Visual Basic


[InClass([name])]

Position Parameter Description
1 Name (optional) The class identifier.

Satisfied when caret is located within a class body.

Supported Languages: C#, Visual Basic


[InCodeBlock]

Satisfied when the caret is inside a method or property, but not inside a string or comment.

Supported Languages: C#, Visual Basic


[InConstructor]

Satisfied when the caret is inside a constructor.

Supported Languages: C#, Visual Basic


[InDelegateDeclaration([name])]

Position Parameter Description
1 Name (optional) The delegate identifier.

Satisfied when the caret is inside a delegate declaration.

Supported Languages: C#, Visual Basic


[InDelegateParameters]

Satisfied when the caret is inside a delegate parameters.

Supported Languages: C#, Visual Basic


[InDestructor]

Satisfied when the caret is inside a destructor.

Supported Languages: C#, Visual Basic


[InEnum([name])]

Position Parameter Description
1 Name (optional) The enum identifier.

Satisfied when the caret is inside an enumeration.

Supported Languages: C#, Visual Basic


[InEvent([name])]

Position Parameter Description
1 Name (optional) The event identifier.

Satisfied when the caret is located inside an event.

Supported Languages: C#, Visual Basic


[InEventAccessor]

Satisfied when the caret is located inside an event accessor.

Supported Languages: C#, Visual Basic


[InExpression]

Satisfied when the caret is inside an expression.

Supported Languages: C#, Visual Basic


[InExpressionBody]

Satisfied when the caret is inside a method or property expression body, but not inside a string, comment or directive.

Supported Language: C#


[InField([name])]

Position Parameter Description
1 Name (optional) The field identifier.

Satisfied when the caret is inside a field.

Supported Languages: C#, Visual Basic


[InFieldInitializer]

Satisfied when the caret is inside a field initializer.

Supported Languages: C#, Visual Basic


[InIdentifier([name])]

Position Parameter Description
1 Name (optional) The identifier name.

Satisfied when the caret is on a declared identifier.

Supported Languages: C#, Visual Basic


[InInterface([name])]

Position Parameter Description
1 Name (optional) The interface identifier.

Satisfied when the caret is located inside an interface.

Supported Languages: C#, Visual Basic


[InInterpolatedString]

Satisfied when the caret is inside an interpolated string.

Supported Languages: C#, Visual Basic


[InIterator]

Satisfied when the caret is inside an iterator, but not inside a string, a comment or an anonymous method expression.

Supported Languages: C#, Visual Basic


[InLambdaInsideMethodCall]

Satisfied when the caret is on a lambda expression, which is inside a method call.

Supported Languages: C#, Visual Basic


[InLiteral]

Satisfied when the caret is inside a literal expression.

Supported Languages: C#, Visual Basic


[InLocal([name])]

Position Parameter Description
1 Name (optional) The local variable identifier.

Satisfied when the caret is on a local variable declaration.

Supported Languages: C#, Visual Basic


[InMember([name])]

Position Parameter Description
1 Name (optional) The member identifier.

Satisfied when the caret is located on a member.

Supported Languages: C#, Visual Basic


[InMemberDeclaration([name])]

Position Parameter Description
1 Name (optional) The member identifier.

Satisfied when the caret is located on a member declaration.

Supported Languages: C#, Visual Basic


[InMethod([name])]

Position Parameter Description
1 Name (optional) The method identifier.

Satisfied when the caret is located in a method.

Supported Languages: C#, Visual Basic


[InMethodBlock]

Satisfied when the caret is inside a method at a point where statements can be added (e.g., inside a method body).

Supported Languages: C#, Visual Basic


[InModule([name])]

Position Parameter Description
1 Name (optional) The module identifier.

Satisfied when the caret is located in a module.

Supported Language: Visual Basic


[InMvcController]

Satisfied when the caret is located in an MVC controller.

Supported Languages: C#, Visual Basic


[InNamespace([name])]

Position Parameter Description
1 Name (optional) The namespace identifier.

Satisfied when the caret is located inside a namespace.

Supported Languages: C#, Visual Basic


[InObjectInitializer]

Satisfied when the caret is inside an object initializer expression.

Supported Languages: C#, Visual Basic


[InParameter([name])]

Position Parameter Description
1 Name (optional) The method identifier.

Satisfied when the caret is on a parameter.

Supported Languages: C#, Visual Basic


[InParameterBlock]

Satisfied when the caret is in the method’s parameters list (inside parentheses in the method’s signature).

Supported Languages: C#, Visual Basic


[InParens]

Satisfied when the editor caret is inside parentheses.

Supported Languages: C#, Visual Basic


[InPreprocessorDirective]

Satisfied when the caret is on a preprocessor directive.

Supported Languages: C#, Visual Basic


[InProperty([name])]

Position Parameter Description
1 Name (optional) The property identifier.

Satisfied when the caret is located in a property.

Supported Languages: C#, Visual Basic


[InPropertyAccessor]

Satisfied when the caret is located in a property accessor.

Supported Languages: C#, Visual Basic


[InRefType]

Satisfied when the caret is located on a referenced type.

Supported Languages: C#, Visual Basic


[InStaticClass]

Satisfied when the caret is inside a static class.

Supported Languages: C#, Visual Basic


[InStaticMember]

Satisfied when the caret is inside a static member.

Supported Languages: C#, Visual Basic


[InStaticType]

Satisfied when the caret is inside a static type.

Supported Languages: C#, Visual Basic


[InString]

Satisfied when the caret is inside a string.

Supported Languages: C#, Visual Basic


[InStruct([name])]

Position Parameter Description
1 Name (optional) The structure identifier.

Satisfied when the caret is located in a struct.

Supported Languages: C#, Visual Basic


[InSwitch]

Satisfied when the caret is inside a switch statement.

Supported Languages: C#, Visual Basic


[InType([name])]

Position Parameter Description
1 Name (optional) The type identifier.

Satisfied when the caret is located on a type.

Supported Languages: C#, Visual Basic


[InTypeDeclaration([name])]

Position Parameter Description
1 Name (optional) The type identifier.

Satisfied when the caret is located inside a type declaration.

Supported Languages: C#, Visual Basic


[InValueType]

Satisfied when the caret is located in a value type.

Supported Languages: C#, Visual Basic


[InXmlDocComment]

Satisfied when the caret is inside an XML documentation comment.

Supported Languages: C#, Visual Basic


[InheritsFrom(typeName)]

Position Parameter
1 Type Name

Satisfied if the active class descends on a specified type.

Supported Languages: C#, Visual Basic


[InHTMLScriptTag]

Satisfied when the caret is inside an HTML <script> tag.

Supported Languages: HTML


[IsNamespaceReferenced(name)]

Position Parameter Description
1 Name The namespace identifier.

Satisfied if the specified namespace is referenced in the current file.

Supported Languages: C#, Visual Basic


[LeftTextMatchesRegEx(pattern)]

Position Parameter Description
1 Pattern The regular expression.

Satisfied if the text to the left of the caret matches the specified regular expression.

Supported Languages: All


[MethodIsDeclared(name)]

Position Parameter Description
1 Name The method identifier.

Satisfied if the specified method is declared.

Supported Languages: C#, Visual Basic


[PropertyIsDeclared(name)]

Position Parameter Description
1 Name The property identifier.

Satisfied if the specified property is declared.

Supported Languages: C#, Visual Basic


[RightTextMatchesRegEx(pattern)]

Position Parameter Description
1 Pattern The regular expression

Satisfied when the text to the right of the caret matches the specified regular expression.

Supported Languages: All


[SelectionExpression]

Satisfied when a boolean expression is selected in the editor.

Supported Languages: C#, Visual Basic


[StatementCanBePlaced]

Satisfied when the caret is located at a point where statements can be added (e.g., inside a method, property or event).

Supported Languages: C#, Visual Basic