当前位置: 首页>>代码示例>>C#>>正文


C# ITreeNode.GetDocumentRange方法代码示例

本文整理汇总了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;
 }
开发者ID:sergeyt,项目名称:karma-resharper,代码行数:12,代码来源:JasmineFileExplorer.cs

示例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));
        }
      }
    }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:37,代码来源:IdentifierHighlighterProcess.cs

示例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;
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:22,代码来源:Utils.cs

示例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;
 }
开发者ID:cfiet,项目名称:resharper-jshint,代码行数:14,代码来源:DaemonStageProcess.cs

示例6: GetDocumentRange

 public virtual DocumentRange GetDocumentRange(ITreeNode treeNode)
 {
     return treeNode.GetDocumentRange();
 }
开发者ID:Nangal,项目名称:resharper-postfix,代码行数:4,代码来源:PostfixExecutionContext.cs

示例7: GetTextRange

        private static TextRange GetTextRange(ITreeNode node, ReparsedCodeCompletionContext context = null)
        {
            if (context == null)
            return node.GetDocumentRange().TextRange;

              return context.ToDocumentRange(node.GetTreeTextRange());
        }
开发者ID:Restuta,项目名称:PostfixCompletion,代码行数:7,代码来源:PostfixTemplatesManager.cs

示例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);
                }
            }
        }
开发者ID:ulex,项目名称:resharper-introduce-ns-alias,代码行数:39,代码来源:IntoduceNsAliasRefactoring.cs


注:本文中的ITreeNode.GetDocumentRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。