public virtual void AddChildNode (XNode newChild)
		{
			newChild.Parent = this;
			if (lastChild != null)
				lastChild.NextSibling = newChild;
			if (firstNode == null)
				firstNode = newChild;
			lastChild = newChild;
		}
		new void SelectNode (XNode n)
		{
			var region = n.Region;
			
			XElement el = n as XElement;
			if (el != null && el.IsClosed && el.ClosingTag.Region.End > region.End) {
				region = new DomRegion (region.Begin, el.ClosingTag.Region.End);
			}
			
			int s = Editor.Document.LocationToOffset (region.BeginLine, region.BeginColumn );
			int e = Editor.Document.LocationToOffset (region.EndLine, region.EndColumn);
			if (e > s && s > -1)
				Editor.SetSelection (s, e);
		}
		public void SelectNode (XNode n)
		{
			var region = n.Region;
			
			var el = n as XElement;
			if (el != null && el.IsClosed && el.ClosingTag.Region.End > region.End) {
				region = new DocumentRegion (region.Begin, el.ClosingTag.Region.End);
			}
			EditorSelect (region);
		}		
Example #4
0
		public void Close (XNode closingTag)
		{
			this.closingTag = closingTag;
			if (closingTag is XClosingTag)
				closingTag.Parent = this;
		}
Example #5
0
		public override void AddChildNode (XNode newChild)
		{
			if (RootElement == null && newChild is XElement)
				RootElement = (XElement) newChild;
			base.AddChildNode (newChild);
		}
 public static XNode FindPreviousNode(this XNode node)
 => node.FindPreviousSibling() ?? node.Parent as XNode;
 public static TextSpan GetSquiggleSpan(this XNode node)
 {
     return(node is XElement el ? el.NameSpan : node.NextSibling.Span);
 }