Search option to exclude comments

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
dcrocker
Posts: 7
Joined: Fri Nov 14, 2003 9:31 am
Location: UK
Contact:

Search option to exclude comments

Post 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".
David Crocker
User avatar
ramonsky
Posts: 88
Joined: Fri Nov 14, 2003 10:54 am

Post 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
User avatar
CyberSlug
Posts: 120
Joined: Sat Oct 04, 2003 3:41 am

Post 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!
User avatar
ramonsky
Posts: 88
Joined: Fri Nov 14, 2003 10:54 am

Post 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
User avatar
ramonsky
Posts: 88
Joined: Fri Nov 14, 2003 10:54 am

Post 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...)
Post Reply