public override void VisitEnumMemberDeclaration(IEnumMemberDeclaration decl, SST context) { var shortName = decl.DeclaredName; context.Fields.Add( new FieldDeclaration { Name = Names.Field("[{0}] [{0}].{1}", context.EnclosingType, shortName) }); }
/// <summary> /// Reflow the given comment block to fit within the given maximum line length /// </summary> /// <param name="blockNode">The comment block to reflow</param> /// <param name="maxLineLength">The maximum line length</param> /// <returns>The text for the new reflown comment.</returns> public string ReflowAndRetag(IDocCommentBlockNode blockNode, int maxLineLength) { ITreeNode parent = blockNode.Parent; ICSharpTypeMemberDeclaration parentDeclaration = parent as IClassMemberDeclaration; if (parentDeclaration == null) { IMultipleFieldDeclaration multipleFieldDeclaration = parent as IMultipleFieldDeclaration; if (multipleFieldDeclaration != null) { foreach (IFieldDeclaration field in multipleFieldDeclaration.Children <IFieldDeclaration>()) { parentDeclaration = field; break; } } IEnumMemberDeclaration enumMemberDeclaration = parent as IEnumMemberDeclaration; if (enumMemberDeclaration != null) { parentDeclaration = enumMemberDeclaration; } } // get the xml from the comment XmlNode node = blockNode.GetXML(null); // Walk the xml tree and process elements as we go. Use a recursive algo for now - comments shouldn't be that complex. XmlCommentOptions options = new XmlCommentOptions(); options.Declaration = parentDeclaration; options.IdentifierLookupScope = IdentifierLookupScopes.ProjectAndUsings; options.Solution = blockNode.GetSolution(); List <Regex> ignoreList = new List <Regex>(_settings.CompiledWordsToIgnoreForMetatagging); ignoreList.Add(new Regex("^[Aa]$")); ignoreList.Add(new Regex("^[iI]f$")); ignoreList.Add(new Regex("^[tT]his$")); ignoreList.Add(new Regex("^[eE]lse$")); ignoreList.Add(new Regex("^[lL]ong$")); ignoreList.Add(new Regex("^[wW]hile$")); ignoreList.Add(new Regex("^[lL]ock$")); ignoreList.Add(new Regex("^[fF]ixed$")); ignoreList.Add(new Regex("^[bB]ase$")); ignoreList.Add(new Regex("^[oO]bject$")); options.IdentifiersToIgnoreForMetaTagging = ignoreList; options.Settings = _reflowSettings; XmlComments.XmlComment comment = new XmlComments.XmlComment(options); comment.FromXml(node); comment.InsertMissingTags(); return(comment.ToXml(0, maxLineLength, 0)); }