Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
925
xamSyntaxEditor not finding commented text matches
posted

Hi,

After providing the custom language with multi line comments I am having a problem searching for matches within comments. Is this feature or it is a bug? Strangely searching on same line keeps finding the matches but not on different lines.

My Syntax editor language comments code (based on this code with sample):

 <TerminalSymbol Name="COMMENT_START" Value="/*" LanguageElementName="Comment"> 
  <LexerState Name="Comment"> 
   <TerminalSymbol Name="COMMENT_TEXT" Value="([^\*]|\*[^|/])+" Comparison="RegularExpression" LanguageElementName="Comment" LookaheadPattern="\*/"/>
	<TerminalSymbolReference Name="NewLineToken"/> 
	<TerminalSymbolReference Name="WhitespaceToken"/> 
   <TerminalSymbol Name="COMMENT_END" Value="*/" LanguageElementName="Comment" IsExitSymbol="true"/> 
  </LexerState>
 </TerminalSymbol>
 <TerminalSymbol Name="SINGLE_LINE_COMMENT" Value="//.*" Comparison="RegularExpression"  LanguageElementName="Comment"/>

Sample of code:

/*
Find me
*/

Looking in the Syntax Editor for 'find' finds no matches. The search code:

				var data = value.ToString();
				var tsc = new TextSearchCriteria(data);
				var searchResults = ActiveDocumentView.Document.CurrentSnapshot.FindAll(tsc);

				if (searchResults == null)
					return;

				// Clear the current results.
				if (mSearchResults.Count > 0)
					mSearchResults.Clear();

				if (searchResults.Results.Count == 0)
				{
					DialogManager.ShowMessageBox("There are no items matching your search criteria.", "Search results");
					return;
				}