Class ElementRule<TElement>
Denotes a rule that is used to create elements
public abstract class ElementRule<TElement> : SequenceRule
Type Parameters
TElement
the 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
semanticElement
objectthe semantic element
context
ParseContextthe context in which the rule is synthesized
synthesisPlan
SynthesisPlanthe 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
inner
IEnumerable<RuleApplication>the inner rule applications
Returns
- TElement
an instance of the model element type
CreateRuleApplication(ParsePosition, List<RuleApplication>, ParsePositionDelta, ParsePositionDelta)
Creates a rule application for a success
protected override RuleApplication CreateRuleApplication(ParsePosition currentPosition, List<RuleApplication> inner, ParsePositionDelta length, ParsePositionDelta examined)
Parameters
currentPosition
ParsePositionthe current parser position
inner
List<RuleApplication>the inner list of rule applications
length
ParsePositionDeltathe length of the match
examined
ParsePositionDeltathe amount of text examined
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
ruleApplication
RuleApplicationThe rule application context that is used to process the document.
document
ParserThe document being parsed.
position
ParsePositionThe 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.
GetReferenceString(TElement, ParseContext)
Gets the printed reference for the given object
protected virtual string GetReferenceString(TElement reference, ParseContext context)
Parameters
reference
TElementthe referenced object
context
ParseContextthe parse context
Returns
- string
a string representation
OnActivate(RuleApplication, ParseContext)
Gets called when a rule application is activated
protected override void OnActivate(RuleApplication application, ParseContext context)
Parameters
application
RuleApplicationthe rule application that is activated
context
ParseContextthe context in which the rule application is activated
OnDeactivate(RuleApplication, ParseContext)
Gets called when a rule application is deactivated
protected override void OnDeactivate(RuleApplication application, ParseContext context)
Parameters
application
RuleApplicationthe rule application that is deactivated
context
ParseContextthe 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
_symbolKinds
Dictionary<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
semanticElement
objectposition
ParsePositionthe parse position at which the element should be synthesized
context
ParseContextthe 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
element
TElementthe element that should be validated
ruleApplication
RuleApplicationthe rule application in the context of which validation is performed
context
ParseContextthe context in which validation is performed