Class ElementRule<TElement>
Denotes a rule that is used to create elements
public abstract class ElementRule<TElement> : SequenceRule
Type Parameters
TElementthe type of elements to create
- Inheritance
-
ElementRule<TElement>
- Derived
- Inherited Members
Properties
CodeActions
Gets the list of code actions for this rule.
protected virtual IEnumerable<CodeActionInfo<TElement>> CodeActions { get; }
Property Value
- IEnumerable<CodeActionInfo<TElement>>
CodeLenses
Gets the list of code lenses for this rule.
protected virtual IEnumerable<CodeLensInfo<TElement>> CodeLenses { get; }
Property Value
- IEnumerable<CodeLensInfo<TElement>>
IsDefinition
True, if the application of this rule denotes a definition
public override bool IsDefinition { get; }
Property Value
Methods
CanSynthesize(object, ParseContext, SynthesisPlan)
Determines whether the current rule can synthesize rule applications for the given semantic element
public override bool CanSynthesize(object semanticElement, ParseContext context, SynthesisPlan synthesisPlan)
Parameters
semanticElementobjectthe semantic element
contextParseContextthe context in which the rule is synthesized
synthesisPlanSynthesisPlanthe plan of the synthesis
Returns
- bool
true, if a rule application can be synthesized, otherwise false
CreateElement(IEnumerable<RuleApplication>)
Creates an element
protected virtual TElement CreateElement(IEnumerable<RuleApplication> inner)
Parameters
innerIEnumerable<RuleApplication>the inner rule applications
Returns
- TElement
an instance of the model element type
CreateRuleApplication(ParsePosition, List<RuleApplication>, ParsePositionDelta, ParsePositionDelta, object)
Creates a rule application for a success
protected override RuleApplication CreateRuleApplication(ParsePosition currentPosition, List<RuleApplication> inner, ParsePositionDelta length, ParsePositionDelta examined, object semanticElement = null)
Parameters
currentPositionParsePositionthe current parser position
innerList<RuleApplication>the inner list of rule applications
lengthParsePositionDeltathe length of the match
examinedParsePositionDeltathe amount of text examined
semanticElementobjectan already existing semantic model element
Returns
- RuleApplication
a new rule application
GetHoverText(RuleApplication, Parser, ParsePosition)
Retrieves the hover text for a symbol at a given position in the document, if available.
public override string GetHoverText(RuleApplication ruleApplication, Parser document, ParsePosition position)
Parameters
ruleApplicationRuleApplicationThe rule application context that is used to process the document.
documentParserThe document being parsed.
positionParsePositionThe position in the document where the hover text is requested.
Returns
- string
A string containing the hover text, or null if no matching symbol or hover text is found.
OnActivate(RuleApplication, ParseContext, bool)
Gets called when a rule application is activated
protected override void OnActivate(RuleApplication application, ParseContext context, bool initial)
Parameters
applicationRuleApplicationthe rule application that is activated
contextParseContextthe context in which the rule application is activated
initialboolflag indicating whether the activation happened due to initial parse
OnDeactivate(RuleApplication, ParseContext)
Gets called when a rule application is deactivated
protected override void OnDeactivate(RuleApplication application, ParseContext context)
Parameters
applicationRuleApplicationthe rule application that is deactivated
contextParseContextthe context in which the rule application is deactivated
RegisterSymbolKind(Dictionary<Type, SymbolKind>)
Registers the correct symbol kind for the reference type if any.
public override void RegisterSymbolKind(Dictionary<Type, SymbolKind> _symbolKinds)
Parameters
_symbolKindsDictionary<Type, SymbolKind>
Synthesize(object, ParsePosition, ParseContext)
Synthesizes a rule application for the given semantic element
public override RuleApplication Synthesize(object semanticElement, ParsePosition position, ParseContext context)
Parameters
semanticElementobjectpositionParsePositionthe parse position at which the element should be synthesized
contextParseContextthe parse context
Returns
- RuleApplication
a rule application
Validate(TElement, RuleApplication, ParseContext)
Validates the given semantic element
protected virtual void Validate(TElement element, RuleApplication ruleApplication, ParseContext context)
Parameters
elementTElementthe element that should be validated
ruleApplicationRuleApplicationthe rule application in the context of which validation is performed
contextParseContextthe context in which validation is performed