예제 #1
0
		public virtual void AddChildNode (XNode newChild)
		{
			newChild.Parent = this;
			if (lastChild != null)
				lastChild.NextSibling = newChild;
			if (firstNode == null)
				firstNode = newChild;
			lastChild = newChild;
		}
예제 #2
0
		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);
		}
예제 #3
0
		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);
		}		
예제 #4
0
		public void Close (XNode closingTag)
		{
			this.closingTag = closingTag;
			if (closingTag is XClosingTag)
				closingTag.Parent = this;
		}
예제 #5
0
		public override void AddChildNode (XNode newChild)
		{
			if (RootElement == null && newChild is XElement)
				RootElement = (XElement) newChild;
			base.AddChildNode (newChild);
		}
예제 #6
0
 public static XNode FindPreviousNode(this XNode node)
 => node.FindPreviousSibling() ?? node.Parent as XNode;
예제 #7
0
 public static TextSpan GetSquiggleSpan(this XNode node)
 {
     return(node is XElement el ? el.NameSpan : node.NextSibling.Span);
 }