static XmlExpandSelectionAnnotation GetAnnotation(TextEditor editor, Func <XmlParser> getTreeParser) { var result = editor.Annotation <XmlExpandSelectionAnnotation> (); if (result == null) { result = new XmlExpandSelectionAnnotation(editor, getTreeParser()); editor.AddAnnotation(result); } return(result); }