本文整理汇总了C#中ITreeNode.GetHighlightingRange方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeNode.GetHighlightingRange方法的具体用法?C# ITreeNode.GetHighlightingRange怎么用?C# ITreeNode.GetHighlightingRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITreeNode
的用法示例。
在下文中一共展示了ITreeNode.GetHighlightingRange方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessBeforeInterior
/// <summary>
/// Processes a node, before its descendants are processed.
/// </summary>
/// <param name="element">The node to process.</param>
public override void ProcessBeforeInterior(ITreeNode element) {
string attributeId = GetHighlightingAttributeId(element);
if (attributeId != null) {
DocumentRange range = element.GetHighlightingRange();
AddHighlighting(new HighlightingInfo(range, new PredefinedHighlighting(attributeId, range)));
}
}
示例2: VisitNode
public override void VisitNode(ITreeNode node, IHighlightingConsumer context) {
base.VisitNode(node, context);
DocumentRange highlightingRange = node.GetHighlightingRange();
//context.AddHighlighting(new PredefinedHighlighting(VsPredefinedHighlighterIds.RazorCode), highlightingRange);
string attributeId = GetHighlightingAttributeId(node);
if (attributeId != null)
context.AddHighlighting(new PredefinedHighlighting(attributeId, highlightingRange));
}
示例3: ProcessBeforeInterior
/// <summary>
/// Processes a node, before its descendants are processed.
/// </summary>
/// <param name="element">The node to process.</param>
public override void ProcessBeforeInterior(ITreeNode element) {
var errorElement = element as MissingTokenErrorElement;
if (errorElement != null) {
AddHighlighting(new HighlightingInfo(GetMissingTokenRange(errorElement), new MissingTokenHighlighting(errorElement)));
return;
}
// can't have a statement block (<# #>) after a feature block (<#+ #>)
var statementBlock = element as T4StatementBlock;
if (statementBlock != null && _gotFeature) {
AddHighlighting(new HighlightingInfo(element.GetHighlightingRange(), new StatementAfterFeatureHighlighting(statementBlock)));
return;
}
// verify that a directive attribute value is valid
if (element.GetTokenType() == T4TokenNodeTypes.Value) {
ProcessAttributeValue((T4Token) element);
return;
}
var directive = element as IT4Directive;
if (directive != null)
ProcessDirective(directive);
else if (element is T4FeatureBlock) {
_gotFeature = true;
if (element == _lastFeature) {
_gotLastFeature = true;
_inLastFeature = true;
return;
}
}
// can't have anything after the last feature block
if (!_gotLastFeature || _inLastFeature || _afterLastFeatureErrorAdded)
return;
TokenNodeType tokenType = element.GetTokenType();
if (tokenType != null && tokenType.IsWhitespace)
return;
// highlight from just after the last feature to the end of the document
DocumentRange range = element.GetHighlightingRange().SetEndTo(File.GetDocumentRange().TextRange.EndOffset);
AddHighlighting(new HighlightingInfo(range, new AfterLastFeatureHighlighting(element)));
_afterLastFeatureErrorAdded = true;
}
示例4: VisitNode
public override void VisitNode(ITreeNode node, IHighlightingConsumer context)
{
base.VisitNode(node, context);
string attributeId = GetHighlightingAttributeId(node);
if (attributeId != null)
context.AddHighlighting(new PredefinedHighlighting(attributeId), node.GetHighlightingRange());
}