Commits

Anonymous committed 4d068fb

fixes for generic arguments not being listed as ignore words for a file

Comments (0)

Files changed (3)

src/YouCantSpell.Core/CStyle/CStyleFreeTextParser.cs

 		/// <summary>
 		/// The characters that may be striped from the start or end of words.
 		/// </summary>
-		private static readonly char[] WordTrimChars = new[] { '!', '.', '(', ')', '[', ']', ',', ':', ';', '?', '{', '}' };
+		private static readonly char[] WordTrimChars = new[] { '!', '.', '(', ')', '[', ']', ',', ':', ';', '?', '{', '}', '<', '>' };
 		/// <summary>
 		/// Locates XML styled tags within a string.
 		/// </summary>
-		private static readonly Regex XmlNodeSplitRegex = new Regex(@"<([/])?\s*?([\p{L}\p{N}]+)\s*(.*?)?\s*?([/])?>", RegexOptions.Compiled | RegexOptions.Singleline);
+        public static readonly Regex XmlNodeSplitRegex = new Regex(@"<([/])?\s*?([\p{L}\p{N}]+)\s*(.*?)?\s*?([/])?>", RegexOptions.Compiled | RegexOptions.Singleline);
 		/// <summary>
 		/// Used to extract non space parts (words or expressions) from a free form text string.
 		/// </summary>
-		private static readonly Regex StringLiteralWordParser = new Regex(@"\S+", RegexOptions.Compiled | RegexOptions.Singleline);
+        public static readonly Regex StringLiteralWordParser = new Regex(@"\S+", RegexOptions.Compiled | RegexOptions.Singleline);
 		/// <summary>
 		/// Identifies words that appear to be like C styled identifiers.
 		/// </summary>
-		private static readonly Regex CodeWordDetectionRegex = new Regex(@"^\p{Lu}+$|^\p{Ll}+\p{Lu}|^\p{Lu}\p{Ll}+\p{Lu}", RegexOptions.Compiled | RegexOptions.Singleline);
+        public static readonly Regex CodeWordDetectionRegex = new Regex(@"^\p{Lu}+$|^\p{Ll}+\p{Lu}|^\p{Lu}\p{Ll}+\p{Lu}", RegexOptions.Compiled | RegexOptions.Singleline);
 		/// <summary>
 		/// Determines if a word is composed only of valid characters.
 		/// </summary>
-		private static readonly Regex WordParserRegex = new Regex(@"^[\p{L}\']([\p{L}-\']*[\p{L}\'])?$", RegexOptions.Compiled);
+		public static readonly Regex WordParserRegex = new Regex(@"^[\p{L}\']([\p{L}-\']*[\p{L}\'])?$", RegexOptions.Compiled);
 
 		/// <summary>
 		/// Trims punctuation characters from the two ends of a word.

src/YouCantSpell.Core/Utility/StringUtil.cs

 		/// </summary>
 		public static readonly Regex LetterParserRegex = new Regex(@"[\p{L}]+", RegexOptions.Compiled);
 
+        public static readonly Regex WordParserRegex = new Regex(@"\w+", RegexOptions.Compiled);
+
 		/// <summary>
 		/// Replaces a section of a string.
 		/// </summary>

src/YouCantSpell.ReSharper.Shared/CStyleSpellCheckDaemonStageProcessBase.cs

 			}
 		}
 
+        protected virtual IEnumerable<string> GeneratePresentableNameParts(IType type)
+        {
+            var fullPresentableName = type.GetPresentableName(LanguageType);
+            yield return fullPresentableName;
+            foreach (var match in Utility.StringUtil.WordParserRegex.Matches(fullPresentableName).Cast<Match>())
+            {
+                yield return match.Value;
+            }
+
+        }
+
 		protected IEnumerable<HighlightingInfo> FindHighlightings(IIdentifier identifier) {
 			var results = new List<HighlightingInfo>(0);
 
 
 			var localIgnoredWords = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
 			var relatedTypeNames = GetRelatedTypes(declaration)
-				.Select(x => x.GetPresentableName(LanguageType))
+                .SelectMany(GeneratePresentableNameParts)
 				.ToList();
 
 			localIgnoredWords.AddRange(relatedTypeNames);