コード例 #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);
 }