Ejemplo n.º 1
0
    public static PsiIntentionResult Create(CreatePsiRuleContext context)
    {
      var declaration = context.Declaration;

      declaration = PsiIntentionsUtil.AddToTarget(declaration, context.Target);


      var holders = new List<ITemplateFieldHolder>();
      if(declaration.Parameters != null)
      {
        var child = declaration.Parameters.FirstChild;
        while(child != null)
        {
          if((child is IRuleName) || (child is IVariableDeclaration))
          {
            holders.Add(new FindersTemplateFieldHolder(new TemplateField(child.GetText(), child.GetNavigationRange().TextRange.StartOffset), new PsiTemplateFinder[] { new PsiTemplateFinder(child) }));
          }
          child = child.NextSibling;
        }
      }

      return new PsiIntentionResult(holders, declaration, context.Anchor, new DocumentRange(context.Document, declaration.GetNavigationRange().TextRange));
    }
Ejemplo n.º 2
0
        public static PsiIntentionResult Create(CreatePsiRuleContext context)
        {
            var declaration = context.Declaration;

            declaration = PsiIntentionsUtil.AddToTarget(declaration, context.Target);


            var holders = new List <ITemplateFieldHolder>();

            if (declaration.Parameters != null)
            {
                var child = declaration.Parameters.FirstChild;
                while (child != null)
                {
                    if ((child is IRuleName) || (child is IVariableDeclaration))
                    {
                        holders.Add(new FindersTemplateFieldHolder(new TemplateField(child.GetText(), child.GetNavigationRange().TextRange.StartOffset), new ITemplateFieldFinder[] { new PsiTemplateFinder(child) }));
                    }
                    child = child.NextSibling;
                }
            }

            return(new PsiIntentionResult(holders, declaration, context.Anchor, new DocumentRange(context.Document, declaration.GetNavigationRange().TextRange)));
        }
 public PsiIntentionResult ExecuteEx(CreatePsiRuleContext context)
 {
   return PsiRuleBuilder.Create(context);
 }
 public PsiIntentionResult ExecuteEx(CreatePsiRuleContext context)
 {
     return(PsiRuleBuilder.Create(context));
 }