本文整理汇总了C#中ITreeNode.GetDocumentRange方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeNode.GetDocumentRange方法的具体用法?C# ITreeNode.GetDocumentRange怎么用?C# ITreeNode.GetDocumentRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITreeNode
的用法示例。
在下文中一共展示了ITreeNode.GetDocumentRange方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InteriorShouldBeProcessed
public bool InteriorShouldBeProcessed(ITreeNode element)
{
if (_disabledEndOffset != -1)
{
if (element.GetDocumentRange().TextRange.EndOffset <= _disabledEndOffset)
{
return false;
}
_disabledEndOffset = -1;
}
return true;
}
示例2: ProcessAfterInterior
public void ProcessAfterInterior(ITreeNode element)
{
var binexpr = element as IEqualityExpression;
if(binexpr == null)
{
return;
}
if(IsInNeedOfFixing(binexpr))
{
DocumentRange range_to_replace = element.GetDocumentRange();
this.Highlightings.Add(new HighlightingInfo(range_to_replace, new MakeEnumComparisonTypeSafeWarningHighlight(range_to_replace, this.ReplacementText)));
}
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:14,代码来源:MakeEnumComparisonTypeSafeFinderElementProcessor.cs
示例3: VisitNode
public override void VisitNode(ITreeNode element, IHighlightingConsumer consumer)
{
DocumentRange colorConstantRange = element.GetDocumentRange();
if ((element is ITokenNode) && ((ITokenNode)element).GetTokenType().IsWhitespace)
{
return;
}
var variableName = element as VariableName;
if (variableName != null)
{
ResolveResultWithInfo resolve = variableName.Resolve();
if ((resolve != null) && ((resolve.Result.DeclaredElement != null) || (resolve.Result.Candidates.Count > 0)))
{
AddHighLighting(colorConstantRange, element, consumer, new PsiVariableHighlighting(element));
}
else
{
AddHighLighting(colorConstantRange, element, consumer, new PsiUnresolvedVariableReferenceHighlighting(variableName));
return;
}
}
var pathName = element as PathName;
if (pathName != null)
{
ResolveResultWithInfo resolve = pathName.Resolve();
if ((resolve != null) && ((resolve.Result.DeclaredElement != null) || (resolve.Result.Candidates.Count > 0)))
{
AddHighLighting(colorConstantRange, element, consumer, new PsiRuleHighlighting(element));
}
else
{
AddHighLighting(colorConstantRange, element, consumer, new PsiUnresolvedPathReferenceHighlighting(pathName));
}
}
}
示例4: GetLineNumberForElement
/// <summary>
/// Get the line number that the provided element is on. 0 based.
/// </summary>
/// <param name="element">
/// The element to use.
/// </param>
/// <returns>
/// An <see cref="int"/> of the line number. 0 based. -1 if the element was invalid.
/// </returns>
public static JB::JetBrains.Util.dataStructures.TypedIntrinsics.Int32<DocLine> GetLineNumberForElement(ITreeNode element)
{
DocumentRange range = element.GetDocumentRange();
if (range == DocumentRange.InvalidRange)
{
JB::JetBrains.Util.dataStructures.TypedIntrinsics.Int32<DocLine> line = (JB::JetBrains.Util.dataStructures.TypedIntrinsics.Int32<DocLine>)0;
return line.Minus1();
}
return range.Document.GetCoordsByOffset(range.TextRange.StartOffset).Line;
}
示例5: AddHighlighting
private void AddHighlighting(HighlightedWarning warning, ITreeNode node)
{
var sameHighlight = highlightings.SingleOrDefault(SameNode(node));
if (sameHighlight != null)
{
((LintHighlightingBase)sameHighlight.Highlighting).AddWarning(warning.Warning);
}
else
{
var highlightingInfo = new HighlightingInfo(node.GetDocumentRange(), CreateHighlighting(warning, node));
highlightings.Add(highlightingInfo);
}
warning.Highlighted = true;
}
示例6: GetDocumentRange
public virtual DocumentRange GetDocumentRange(ITreeNode treeNode)
{
return treeNode.GetDocumentRange();
}
示例7: GetTextRange
private static TextRange GetTextRange(ITreeNode node, ReparsedCodeCompletionContext context = null)
{
if (context == null)
return node.GetDocumentRange().TextRange;
return context.ToDocumentRange(node.GetTreeTextRange());
}
示例8: CallExtensionMethodsAsStatic
private static void CallExtensionMethodsAsStatic(ITreeNode node, CSharpElementFactory factory, string qualifiedName)
{
var targetsCollector = new TypeUsagesCollector(node, node.GetDocumentRange());
var references = targetsCollector.Run();
foreach (var reference in references)
{
var resolve = reference.Resolve();
var declaredElement = resolve.DeclaredElement;
var imethod = declaredElement as IMethod;
var methodExecution = reference.GetTreeNode();
var method = methodExecution as IReferenceExpression;
var containingNsQualifiedName =
imethod.IfNotNull(m => m.GetContainingType())
.IfNotNull(t => t.GetContainingNamespace())
.IfNotNull(ns => ns.QualifiedName);
if (method != null && method.IsExtensionMethod() && containingNsQualifiedName == qualifiedName)
{
var invocate = InvocationExpressionNavigator.GetByInvokedExpression(method);
//if (invocate == null) return null;
// build string like $0($1,$2,..argc)
var tokens = string.Format(
"$0({0})",
string.Join(
",",
new[] { "$1" }.Concat(invocate.Arguments.Select((a, i) => "$" + (i + 2).ToString("G"))).ToArray()));
var funcAndThis = new object[] { "faketobind", (invocate.InvokedExpression as IReferenceExpression).QualifierExpression };
var paramsObject = funcAndThis.Concat(invocate.Arguments).ToArray();
var cSharpExpression = (IInvocationExpression)factory.CreateExpression(tokens, paramsObject);
var replaceResult = invocate.ReplaceBy(cSharpExpression);
(replaceResult.InvokedExpression as IReferenceExpression).Reference.BindTo(declaredElement);
}
}
}