public CreatePsiRuleContext(CreatePsiRuleTarget target)
 {
     myTarget   = target;
     myAnchor   = target.Anchor;
     myOffset   = myAnchor.GetNavigationRange().TextRange.EndOffset;
     myDocument = myAnchor.GetSourceFile().Document;
     myRuleName = myTarget.Reference.GetTreeNode() as IRuleName;
 }
 public CreatePsiRuleContext(CreatePsiRuleTarget target)
 {
   myTarget = target;
   myAnchor = target.Anchor;
   myOffset = myAnchor.GetNavigationRange().TextRange.EndOffset;
   myDocument = myAnchor.GetSourceFile().Document;
   myRuleName = myTarget.Reference.GetTreeNode() as IRuleName;
 }
Ejemplo n.º 3
0
        public static void ReplaceChild(ITreeNode parent, ITreeNode nameNode, string name)
        {
            if (name.IsEmpty())
            {
                throw new ArgumentException("name shouldn't be empty", "name");
            }

            using (WriteLockCookie.Create(parent.IsPhysical()))
            {
                IRuleName ruleName = PsiElementFactory.GetInstance(parent.GetPsiModule()).CreateIdentifierExpression(name);
                LowLevelModificationUtil.ReplaceChildRange(nameNode, nameNode, ruleName.FirstChild);
            }
        }
    public override void VisitRuleName(IRuleName ruleName, IHighlightingConsumer consumer)
    {
      DocumentRange colorConstantRange = ruleName.GetDocumentRange();

      ResolveResultWithInfo resolve = ruleName.RuleNameReference.Resolve();

      bool isRuleResolved = resolve.Result.DeclaredElement != null || (resolve.Result.Candidates.Count > 0);
      if (isRuleResolved)
      {
        AddHighLighting(colorConstantRange, ruleName, consumer, new PsiRuleHighlighting(ruleName));
      }
      else
      {
        AddHighLighting(colorConstantRange, ruleName, consumer, new PsiUnresolvedRuleReferenceHighlighting(ruleName));
      }

      base.VisitRuleName(ruleName, consumer);
    }
Ejemplo n.º 5
0
        public override void VisitRuleName(IRuleName ruleName, IHighlightingConsumer consumer)
        {
            DocumentRange colorConstantRange = ruleName.GetDocumentRange();

            ResolveResultWithInfo resolve = ruleName.RuleNameReference.Resolve();

            bool isRuleResolved = resolve.Result.DeclaredElement != null || (resolve.Result.Candidates.Count > 0);

            if (isRuleResolved)
            {
                AddHighLighting(colorConstantRange, ruleName, consumer, new PsiRuleHighlighting(ruleName));
            }
            else
            {
                AddHighLighting(colorConstantRange, ruleName, consumer, new PsiUnresolvedRuleReferenceHighlighting(ruleName));
            }

            base.VisitRuleName(ruleName, consumer);
        }