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; }
Hello Tomas,
I have been investigating into this behavior with the sample project at the forum thread you have linked, and I have reproduced the behavior you are seeing. To ensure it was not something that was wrong with the custom XamSyntaxEditor that you are using, I isolated this behavior out to a new sample project that uses a base XamSyntaxEditor with our built-in C# language. This behavior is still reproducible there as well.
This behavior is unexpected, and as such, I have asked our engineering staff to examine it further. To ensure it receives attention, I have logged it in our internal tracking systems with a development ID of 260048. I have also created you a private support case that I will be linking to this behavior. It has an ID of CAS-199556-X3V5C3 and you can access it on the support activity page after signing into your account.
Please let me know if you have any other questions or concerns on this matter.
Dear Andrew,
Thanks for feedback. There is also another bug in search which I found. Our code usually provides syntax from the database and the value contains only \n characters for new line. This is displays correctly in the viewer and other editors except Notepad. As result, xamSytaxEditor search functionality does not find any words right after new line character. I've already tested manually and added additional \r character and this results in correct expected behavior.
So in provided earlier example please remove all \r characters before providing value to syntax editor and try to search for text '41' and it should find 'S2F41W'. It won't find this line until character \r is added as part of new line or space added before this text.