Page 1 of 1
Search option to exclude comments
Posted: Fri Nov 14, 2003 9:56 am
by dcrocker
When searching in a source code file for which syntax highlighting is configured, I am often not interested in matches that occur within comments. So it would be useful if the Find options box had a radio button with options "Exclude comments", "Search comments only" and "All text".
Posted: Thu Nov 20, 2003 8:01 am
by ramonsky
Now THAT is a cool idea. Neat, simple, easy to implement, and very very useful.
Hell, I'd say this is pollable. But before you send it to the polls, what about being able to choose to exclude or include the contents of string constants too?
Or (even more specific), let's say you wanted to search only within "keyword 1" colored text, or only within "comment" colored text, etc. In fact, for each color, you could have "search here" and "don't search here" radio buttons (with a couple of convenient "include all" and "exclude all" buttons for easy setup).
Suggest you let this thread run a bit more to brainstorm a few more ideas, and then do a poll. I'd vote for it - especially with the enhancements.
Jill
Posted: Thu Nov 20, 2003 8:53 am
by CyberSlug
Great idea!
I'd also really like to be able to constrain searches (and replaces) to bookmarked lines.
(Incidentally, there is an option to toggle spell checking of comments [Configure > Preferences > Document Classes], so I'd think Helios could implement your idea pretty easliy.)
EDIT: There might be a way to kludge together a user-defined tool with some similar features.... I'm thinking about how one could use TextPad's "Copy as a HTML [sic] page" feature and do some complex regular expression searches... but that seems a non-trivial task!
Posted: Thu Nov 20, 2003 3:12 pm
by ramonsky
I would certainly appreciate this in "Find in Files" too.
ESPECIALLY after it's been changed to "Find and Replace in Files". Wow - just imagine how powerful these two features combined would be!
The more I think about it, the more I realise that this would be an incredibly powerful tool. And all it would take to implement is to take the color (strictly the syntax category) into account.
Jill
Posted: Thu Nov 20, 2003 3:13 pm
by ramonsky
And it gets better. This enhancement works even better in combination with others. For example, if the embedded (i.e. multi-language) feature were implemented (see separate thread) then we could also limit searches to [i]a particular language[/i]. For example, search only in HTML text, but not in any PHP or Javascript in the same document. With a suitable syntax definition file, in combination with this feature, one could search for specific HTML tags or attributes, for example, or alternative, one could seach only within the character-data (not in tags) of an HTML document.
Jill (thinking ahead...)