private bool TryEvaluateSparkSyntax(int caretPosition, out Node sparkNode)
        {
            var sparkSyntax = new SparkSyntax();
            var currentNode = sparkSyntax.ParseNode(_textView.TextBuffer.CurrentSnapshot.GetText(), caretPosition);

            sparkNode = null;
            return(_projectExplorer.IsCurrentDocumentASparkFile()
                ? sparkSyntax.IsSparkElementNode(currentNode, out sparkNode)
                : false);
        }
示例#2
0
        public void IsSparkNodeShouldReturnAnElementNodeIfNotSparkSyntax()
        {
            var sparkSyntax = new SparkSyntax();
            var node        = sparkSyntax.ParseNode("<div id='products'/>", position: 1);

            Node elementNode;
            var  isSparkNode = sparkSyntax.IsSparkElementNode(node, out elementNode);

            Assert.That(!isSparkNode);
            Assert.IsNotNull(elementNode);
            Assert.That(elementNode, Is.InstanceOfType(typeof(ElementNode)));
        }
示例#3
0
        public void IsSparkNodeShouldReturnASpecialNodeForUnclosedElement()
        {
            var sparkSyntax = new SparkSyntax();
            var node        = sparkSyntax.ParseNode("<use >", position: 1);

            Node sparkNode;
            var  isSparkNode = sparkSyntax.IsSparkElementNode(node, out sparkNode);

            Assert.That(isSparkNode);
            Assert.IsNotNull(sparkNode);
            Assert.That(sparkNode, Is.InstanceOfType(typeof(SpecialNode)));
        }