示例#1
0
 public static void AcceptCallsVisitAttributeNameMethodOfSyntaxNodeVisitor()
 {
     var visitor = Substitute.For<SyntaxNodeVisitor>();
     var node = new AttributeName(0, string.Empty);
     node.Accept(visitor);
     visitor.Received().VisitAttributeName(node);
 }
        protected internal override void VisitAttributeName(AttributeName node)
        {
            base.VisitAttributeName(node);

            if (node.Span.Start <= this.position && this.position <= node.Span.End)
            {
                Debug.Assert(this.currentDirective != null, "currentDirective");
                var directiveDescriptor = DirectiveDescriptor.GetDirectiveDescriptor(this.currentDirective.GetType());

                var completions = new List<Completion>();
                foreach (AttributeDescriptor attribute in directiveDescriptor.Attributes.Values)
                {
                    if (!this.currentDirective.Attributes.ContainsKey(attribute.DisplayName))
                    {
                        completions.Add(CreateAttributeCompletion(attribute));
                    }
                }

                if (completions.Count > 0)
                {
                    this.Completions = completions;
                    this.Node = node;
                }
            }
        }
 public static void VisitAttributeNameCallsVisitCaptureNodeToAllowProcessingAllCaptureNodesPolymorphically()
 {
     var visitor = Substitute.ForPartsOf<SyntaxNodeVisitor>();
     var attributeName = new AttributeName(0, "attribute");
     visitor.VisitAttributeName(attributeName);
     visitor.Received().VisitCaptureNode(attributeName);
     Assert.Equal(typeof(CaptureNode), typeof(AttributeName).BaseType);
 }
示例#4
0
        public static void AcceptCallsVisitAttributeNameMethodOfSyntaxNodeVisitor()
        {
            var visitor = Substitute.For <SyntaxNodeVisitor>();
            var node    = new AttributeName(0, string.Empty);

            node.Accept(visitor);
            visitor.Received().VisitAttributeName(node);
        }
示例#5
0
        public static void VisitCaptureNodeCallsVisitTerminalNodeToAllowProcessingAllTerminalNodesPolymorphically()
        {
            var visitor     = Substitute.ForPartsOf <SyntaxNodeVisitor>();
            var captureNode = new AttributeName(0, "attribute");

            visitor.VisitCaptureNode(captureNode);
            visitor.Received().VisitTerminalNode(captureNode);
            Assert.Equal(typeof(TerminalNode), typeof(CaptureNode).BaseType);
        }
示例#6
0
 public static void ChildNodesReturnsNodesSpecifiedInConstructor()
 {
     var name = new AttributeName(0, "language");
     var equals = new Equals(8);
     var quote1 = new DoubleQuote(9);
     var value = new AttributeValue(10, "C#");
     var quote2 = new DoubleQuote(12);
     var attribute = new Attribute(name, equals, quote1, value, quote2);
     Assert.True(new SyntaxNode[] { name, equals, quote1, value, quote2 }.SequenceEqual(attribute.ChildNodes()));
 }
示例#7
0
        public static void ChildNodesReturnsNodesSpecifiedInConstructor()
        {
            var name      = new AttributeName(0, "language");
            var equals    = new Equals(8);
            var quote1    = new DoubleQuote(9);
            var value     = new AttributeValue(10, "C#");
            var quote2    = new DoubleQuote(12);
            var attribute = new Attribute(name, equals, quote1, value, quote2);

            Assert.True(new SyntaxNode[] { name, equals, quote1, value, quote2 }.SequenceEqual(attribute.ChildNodes()));
        }
示例#8
0
 public static void SpanStartsAtName()
 {
     AttributeName name;
     var attribute = new Attribute(
         name = new AttributeName(10, "language"), 
         new Equals(18), 
         new DoubleQuote(19), 
         new AttributeValue(20, "C#"), 
         new DoubleQuote(22));
     Assert.Equal(name.Span.Start, attribute.Span.Start);
 }
示例#9
0
        public static void SpanStartsAtName()
        {
            AttributeName name;
            var           attribute = new Attribute(
                name = new AttributeName(10, "language"),
                new Equals(18),
                new DoubleQuote(19),
                new AttributeValue(20, "C#"),
                new DoubleQuote(22));

            Assert.Equal(name.Span.Start, attribute.Span.Start);
        }
示例#10
0
        public Attribute(AttributeName name, Equals equals, DoubleQuote quote1, AttributeValue value, DoubleQuote quote2)
        {
            Debug.Assert(name != null, "name");
            Debug.Assert(equals != null, "equals");
            Debug.Assert(quote1 != null, "quote1");
            Debug.Assert(value != null, "value");
            Debug.Assert(quote2 != null, "quote2");

            this.name   = name;
            this.equals = equals;
            this.quote1 = quote1;
            this.value  = value;
            this.quote2 = quote2;
        }
示例#11
0
        public Attribute(AttributeName name, Equals equals, DoubleQuote quote1, AttributeValue value, DoubleQuote quote2)
        {
            Debug.Assert(name != null, "name");
            Debug.Assert(equals != null, "equals");
            Debug.Assert(quote1 != null, "quote1");
            Debug.Assert(value != null, "value");
            Debug.Assert(quote2 != null, "quote2");

            this.name = name;
            this.equals = equals;
            this.quote1 = quote1;
            this.value = value;
            this.quote2 = quote2;
        }
 public static void NodeReturnsAttributeNameWhenPositionIsWithinAttributeName()
 {
     AttributeName attributeName;
     var directive = new OutputDirective(
         new DirectiveBlockStart(0),
         new DirectiveName(4, "output"),
         new[] { new Attribute(attributeName = new AttributeName(11, "e"), new Equals(12), new DoubleQuote(13), new AttributeValue(14, string.Empty), new DoubleQuote(14)) },
         new BlockEnd(16));
     var builder = new TemplateCompletionBuilder(12);
     builder.Visit(directive);
     Assert.Same(attributeName, builder.Node);
 }
示例#13
0
 protected internal virtual void VisitAttributeName(AttributeName node)
 {
     this.VisitCaptureNode(node);
 }
示例#14
0
 protected internal virtual void VisitAttributeName(AttributeName node)
 {
     this.VisitCaptureNode(node);
 }
示例#15
0
 public static void KindReturnsAttributeNameSyntaxKind()
 {
     var target = new AttributeName(0, string.Empty);
     Assert.Equal(SyntaxKind.AttributeName, target.Kind);
 }
示例#16
0
        public static void KindReturnsAttributeNameSyntaxKind()
        {
            var target = new AttributeName(0, string.Empty);

            Assert.Equal(SyntaxKind.AttributeName, target.Kind);
        }