22using System . Collections . Generic ;
33using System . Linq ;
44using System . Text . RegularExpressions ;
5- using System . Threading ;
65using CodeDocumentor . Vsix2022 ;
7- using EnvDTE ;
86using Microsoft . CodeAnalysis ;
97using Microsoft . CodeAnalysis . CSharp ;
108using Microsoft . CodeAnalysis . CSharp . Syntax ;
11- using Microsoft . VisualStudio . OLE . Interop ;
12- using SimpleInjector . Diagnostics ;
139
1410namespace CodeDocumentor . Helper
1511{
@@ -34,6 +30,14 @@ public static class DocumentationHeaderHelper
3430 /// <summary> The summary. </summary>
3531 public const string SUMMARY = "summary" ;
3632
33+ /// <summary> The reg ex. </summary>
34+ private static readonly Regex _regEx = new Regex ( @"throw\s+new\s+\w+" , RegexOptions . IgnoreCase | RegexOptions . Multiline ) ;
35+
36+ private static readonly Regex _regExInline = new Regex ( @"(\w+Exception)\.Throw\w+" , RegexOptions . IgnoreCase | RegexOptions . Multiline ) ;
37+
38+ /// <summary> type param regex. </summary>
39+ private static readonly Regex _typeParamRegex = new Regex ( @"""\w+""" ) ;
40+
3741 /// <summary> Creates the exception nodes. </summary>
3842 /// <param name="exceptionType"> The exception type. </param>
3943 /// <returns> An array of XmlNodeSyntaxes </returns>
@@ -559,14 +563,23 @@ internal static SyntaxTriviaList UpsertLeadingTrivia(this SyntaxTriviaList leadi
559563 /// <returns> <![CDATA[IEnumerable<string>]]> </returns>
560564 internal static IEnumerable < string > GetExceptions ( string textToSearch )
561565 {
566+
562567 if ( string . IsNullOrEmpty ( textToSearch ) )
563568 {
564569 return Enumerable . Empty < string > ( ) ;
565570 }
571+
572+
573+
566574 var exceptions = _regEx . Matches ( textToSearch ) . OfType < Match > ( )
567575 . Select ( m => m ? . Groups [ 0 ] ? . Value )
568- . Distinct ( ) ;
569- return exceptions ;
576+ . ToList ( ) ;
577+ System . Diagnostics . Debugger . Break ( ) ;
578+
579+ var exceptionsInline = _regExInline . Matches ( textToSearch ) . OfType < Match > ( )
580+ . Select ( m => m ? . Groups . Count == 1 ? m ? . Groups [ 0 ] ? . Value : m ? . Groups [ 1 ] ? . Value ) . ToArray ( ) ;
581+ exceptions . AddRange ( exceptionsInline ) ;
582+ return exceptions . Distinct ( ) ;
570583 }
571584
572585 /// <summary> Withs the exception types. </summary>
@@ -722,12 +735,6 @@ internal static SyntaxList<XmlNodeSyntax> WithTypeParamters(this SyntaxList<XmlN
722735
723736 #endregion Builders
724737
725- /// <summary> The reg ex. </summary>
726- private static readonly Regex _regEx = new Regex ( @"throw\s+new\s+\w+" , RegexOptions . IgnoreCase | RegexOptions . Multiline ) ;
727-
728- /// <summary> type param regex. </summary>
729- private static readonly Regex _typeParamRegex = new Regex ( @"""\w+""" ) ;
730-
731738 /// <summary> Creates the comment exterior. </summary>
732739 /// <returns> A SyntaxTriviaList. </returns>
733740 private static SyntaxTriviaList CreateCommentExterior ( )
0 commit comments